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

Compilation with LLVM fails on Linux Rocky9/Ubuntu-22.04 - stdlib incorrectly chosen #969

Open
dslarm opened this issue Oct 23, 2024 · 0 comments · May be fixed by #970
Open

Compilation with LLVM fails on Linux Rocky9/Ubuntu-22.04 - stdlib incorrectly chosen #969

dslarm opened this issue Oct 23, 2024 · 0 comments · May be fixed by #970

Comments

@dslarm
Copy link

dslarm commented Oct 23, 2024

In CMakeLists.txt, check_cxx_compiler_flag(-stdlib=libc++ HAVE_LIBCPP) is used to determine whether to use LLVM's C++ stdlib - libc++, or the system's own GNU one (libstdc++).

Unfortunately, those distros do not ship with that library (per the clip below) - and yet the test succeeds - yielding failure later in the build process due to lots of missing header files.

[rocky@ip-10-11-36-33 ~]$ cat >test.cpp
#include <iostream>

int main() {
std::cout << "Helloworld";
}
[rocky@ip-10-11-36-33 ~]$ clang++ -stdlib=libc++ test.cpp 
test.cpp:1:10: fatal error: 'iostream' file not found
    1 | #include <iostream>
      |          ^~~~~~~~~~
1 error generated.

The cause is that CMake's check_cxx_compiler_flag(-stdlib=libc++ HAVE_LIBCPP) test which is used in Salmon only tests if the compiler accepts the flag (the test code it uses doesn't have any includes - just main() {return 0;}) rather than if it works.

I don't know the whys behind the missing library - the library is available on OS/X for example - however it seems this behaviour should be changed for now on Linux platforms.

dslarm added a commit to dslarm/salmon that referenced this issue Oct 23, 2024
@dslarm dslarm linked a pull request Oct 23, 2024 that will close this issue
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.

1 participant