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

[bug] AutoToolsDeps sets includes to CPPFLAGS, but MesonToolchain reads only CFLAGS/CXXFLAGS? #11397

Closed
SSE4 opened this issue Jun 5, 2022 · 1 comment · Fixed by #11557
Closed
Assignees
Milestone

Comments

@SSE4
Copy link
Contributor

SSE4 commented Jun 5, 2022

related to #10683, coming from conan-io/conan-center-index#11053

in an attempt to migrate Glib to MesonToolchain I had to put the following workaround:

        cppflags = tc.vars().get("CPPFLAGS")
        tc.environment.append('CFLAGS', cppflags)
        tc.environment.append('CXXFLAGS', cppflags)

to propagate CPPFLAGS into CFLAGS/CXXFLAGS.
AutoToolsDeps sets includedirs to CPPFLAGS only:
https://github.com/conan-io/conan/blob/1.48.2/conan/tools/gnu/autotoolsdeps.py#L46
https://github.com/conan-io/conan/blob/1.48.2/conan/tools/gnu/autotoolsdeps.py#L74
while MesonToolchain currently only reads from CFLAGS/CXXFLAGS:
https://github.com/conan-io/conan/blob/1.48.2/conan/tools/meson/toolchain.py#L154-L157

so they kinda cannot connect to each other as is, which is disappointing. I don't know where shoud be the right fix, in MesonToolchain or AutoToolsDeps.

Environment Details (include every applicable attribute)

  • Operating System+version:
  • Compiler+version:
  • Conan version:
  • Python version:

Steps to reproduce (Include if Applicable)

Logs (Executed commands with output) (Include/Attach if Applicable)

@jcar87
Copy link
Contributor

jcar87 commented Jun 13, 2022

According to: https://www.gnu.org/software/make/manual/html_node/Implicit-Variables.html#Implicit-Variables

  • CXXFLAGS are for the C++ compiler
  • CFLAGS for the C compiler
  • CPPFLAGS are for the C and Fortran preprocessor - that said, this is a bit confusing - because most flags that control the preprocessor https://gcc.gnu.org/onlinedocs/gcc/Preprocessor-Options.html - can be passed directly to the compiler as far as I'm aware

Meson only listens to CXXFLAGS (similar to cmake) - but they recommend not using these: https://mesonbuild.com/Reference-tables.html#compiler-and-linker-flag-environment-variables

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

Successfully merging a pull request may close this issue.

3 participants