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

Unconditional use of -fdiagnostics-color=always #11509

Closed
olafhering opened this issue Mar 3, 2025 · 6 comments
Closed

Unconditional use of -fdiagnostics-color=always #11509

olafhering opened this issue Mar 3, 2025 · 6 comments

Comments

@olafhering
Copy link
Contributor

The SUSE dune rpm package was upgraded from 8118ddb to fedec66. This broke build in SLES12, which uses gcc 4.8 as default compiler.

[   28s] $ (cd _build/default/otherlibs/xdg && /usr/bin/gcc -std=gnu99 -O2 -fno-strict-aliasing -fwrapv -fno-builtin-memcmp -pthread -Werror=implicit-function-declaration -Werror=return-type -Wno-deprecated-declarations -fPIC -pipe -D_FILE_OFFSET_BITS=64 -fdiagnostics-color=always -g -I /usr/lib64/ocaml -o xdg_stubs.o -c xdg_stubs.c)
[   28s] gcc: error: unrecognized command line option '-fdiagnostics-color=always'

Was this changed intentionally? According to the changelog, this command line option was already added in 3.7 via issue #4083. I did not spot a related changelog entry between 3.15 and 3.17. Is GCC 4.8.5 still a supported system compiler with OCaml 4.14? I think I have seen no specific depreciation notice, maybe I just missed it and things work just by luck.

@nojb
Copy link
Collaborator

nojb commented Mar 3, 2025

Was this changed intentionally?

I think you are being bitten by #10883, which makes it so that -fdiagnostics-color=always is passed unconditionally to gcc (even if standard output is not a terminal). This was done to avoid gratuitious recompilations under some conditions.

@olafhering
Copy link
Contributor Author

Is there a way to avoid it, so that this old system gcc can be used? Maybe a configure knob. Not sure how much time you are willing to sink into such old code base. As a workaround I could switch to a newer, separate system compiler in SLE12 for the entire OCaml toolchain.

@nojb
Copy link
Collaborator

nojb commented Mar 3, 2025

I can't think of any way you can work around this without some modification to Dune or by using a more recent compiler on your side. The support for this flag was added in GCC 4.9. I guess we could check for the GCC version in Dune or add a configure flag as you suggest, but am not sure if it is worth the trouble (GCC 4.8 was released in 2013). What do you think?

@olafhering
Copy link
Contributor Author

For CC it is possible to hardcode /usr/bin/gcc-N during build of ocaml, which is then used for every ocaml.opt usage.
How is this supposed to be done for CXX? ocaml.opt does not seem to have a concept of CXX.

@nojb
Copy link
Collaborator

nojb commented Mar 3, 2025

How is this supposed to be done for CXX? ocaml.opt does not seem to have a concept of CXX.

As far as I know the OCaml compiler never calls out to the C++ compiler.

@olafhering
Copy link
Contributor Author

dune does invoke c++. When g++-N is available for gcc-N, mccs and re2 succeed to build.

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