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

Build failure on Fedora 29 #1239

Closed
nitronoid opened this issue May 29, 2019 · 10 comments · Fixed by #1245
Closed

Build failure on Fedora 29 #1239

nitronoid opened this issue May 29, 2019 · 10 comments · Fixed by #1245

Comments

@nitronoid
Copy link
Contributor

Describe the bug
Getting the same error output as #16 with an up to date clone of master.

To Reproduce
I'm using this CMAKE command:

> CC=/usr/bin/clang CXX=/usr/bin/clang++ CXXFLAGS=-stdlib=libc++ cmake -G Ninja -DCMAKE_BUILD_TYPE=Release -DFILAMENT_REQUIRES_CXXABI=true -DCMAKE_INSTALL_PREFIX=../release/filament ../..
> ninja

Same story with regular make files. As you can see I do have the CXXABI flag.

Desktop (please complete the following information):

  • OS: Fedora 29
  • GPU: NVIDIA Quadro M3000M

Additional context
I was able to fix this problem by modifying the main CMakeLists.txt to link libc++, apparently it wasn't doing this? I added link_libraries(libc++.a) and now it builds fine. Maybe there's a better fix.

@romainguy
Copy link
Collaborator

We link against libc++ via this flag: set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -stdlib=libc++") which works on other Linux distributions (and macOS and Android). I'm not sure why an extra link_libraries() directive is required here.

@nitronoid
Copy link
Contributor Author

I think the problem is that -stdlib=libc++ is not visible to the linker, instead of adding link_libraries(libc++.a) I can alternatively use

set(CMAKE_LINK_FLAGS "${CMAKE_LINK_FLAGS} -stdlib=libc++")

which also fixes the problem.

@romainguy
Copy link
Collaborator

Ah good point, I'll give it a try, thanks!

@nitronoid
Copy link
Contributor Author

Just an update on this, the second solution I posted only works when compiling for debug, to build the release version I still require the link_libraries(libc++.a). I noticed the conditional linking against static-libc++ for release mode, does adding the extra link_libraries have any negative effects?

@romainguy
Copy link
Collaborator

It should be fine but this link_libraries should be done implicitly by -static-libstdc++, and it's what happens when we build on Debian. What version of Clang are you using btw?

@nitronoid
Copy link
Contributor Author

I'm using clang 7.0.1 with Fedora 29, I also tested with clang 9.0.0 on a rhel-7 workstation.

@romainguy
Copy link
Collaborator

Would you mind trying #1245 please? It works on my Debian (custom Google) and our CI (Ubuntu 14). This change always links statically against libc++ and libc++abi, in debug and release.

@nitronoid
Copy link
Contributor Author

Sure I'll try it now

@nitronoid
Copy link
Contributor Author

Works for me! Don't need to put any special flags either which is nice 👍

CC=/usr/bin/clang CXX=/usr/bin/clang++ cmake -G "Unix Makefiles" -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=../release/filament ../..

@romainguy
Copy link
Collaborator

Awesome, thank you so much for your help! I really appreciate it.

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.

2 participants