Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Question - how to capture built in compiler options #579

Open
wonk-andy opened this issue Jun 11, 2024 · 1 comment
Open

Question - how to capture built in compiler options #579

wonk-andy opened this issue Jun 11, 2024 · 1 comment

Comments

@wonk-andy
Copy link

wonk-andy commented Jun 11, 2024

I am trying to use Bear 3.1.4 to generate the compile_commands.json file from a Makefile based project which cross compiles for QNX on a Linux host. The compile command line for one of the source files is:

aarch64-unknown-nto-qnx7.0.0-gcc -std=gnu99 -MMD -MP -Iinclude -o build/1.01.00/src/iMX8.o -c src/iMX8.c

The output for this file that is captured says:

  {
    "arguments": [
      "/opt/tools/qnx700/host/linux/x86_64/usr/bin/aarch64-unknown-nto-qnx7.0.0-gcc",
      "-std=gnu99",
      "-Iinclude",
      "-c",
      "-o",
      "build/1.01.00/src/iMX8.o",
      "src/iMX8.c"
    ],
    "directory": "/opt/samba/customers/xxxx/GetMacAddr",
    "file": "/opt/samba/customers/xxxx/GetMacAddr/src/iMX8.c",
    "output": "/opt/samba/customers/xxxx/GetMacAddr/build/1.01.00/src/iMX8.o"
  }

There are other built-in compiler options that it isn't capturing, for example the compiler defines __QNX__ which is used for conditional compilation within the source files. How do I capture this, and any other, built in variable?

-Andy.

@rizsotto
Copy link
Owner

Hey Andy,

The compilation database is capturing the compiler calls only. Compiler internals are not presented in the output.

Compiler specific variables are not easy to mimic with other compilers. OS specific defines can be placed into a common header, but might interfere with the host header files.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants