-
Notifications
You must be signed in to change notification settings - Fork 616
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
fix missing library on BSD systems #147
Conversation
Builds work in Linux, so this seems to be freebsd only. I'm going to also test this on openbsd as well for good measure. |
Hi @tony, this looks great. One note: I've found that "-lc++abi" is needed on Linux (when using Clang), and your patch removes it for that platform. Let me know when this is ready to merge. Best, |
8a8ed6a
to
9076996
Compare
Hi @wjakob. I've tested on OpenBSD 6.0, FreeBSD 11-CURRENT, OS X, however have had issues with testing on Ubuntu. It does compile and link correctly on Ubuntu 16.10, but not run due to lack of OpenGL 3.3 support in VirtualBox. |
Hi @tony, this looks great now. No worries about Ubuntu, I am using that frequently myself and everything works fine. One quick question after looking at the PR once more: I saw that you actually completely disabled I've run into many incompatibilities in the alternative libstdc++ / Clang combination on Linux, hence this setting in the CMake script. Best, |
(note that this comment is unrelated to the |
FreeBSD 11-STABLE will say So I can add it back, but we'll get the warning. I have to check OpenBSD again.
I'm not 100% sure. I omit including I know CMake does some magic when it comes to adding flags on your behalf. I can't think of a time I've had the need to go in and add the standard lib stuff manually. libc++abi-build.txt is my |
Is this OpenBSD |
Default compiler on OpenBSD is going to be GCC 4.2... So yeah that's a caveat. My testing requires installing llvm (which includes clang). This may change in OpenBSD 6.1 (https://www.phoronix.com/scan.php?page=news_item&px=OpenBSD-Adds-LLVM-To-Base) On OpenBSD I am using |
A few things,
|
@@ -175,10 +175,14 @@ if (NANOGUI_BUILD_SHARED) | |||
endif() | |||
|
|||
# Always use libc++ on Clang | |||
if (CMAKE_CXX_COMPILER_ID MATCHES "Clang") | |||
if (CMAKE_CXX_COMPILER_ID MATCHES "Clang" AND NOT ${CMAKE_SYSTEM_NAME} MATCHES "BSD") | |||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -stdlib=libc++") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
On OpenBSD 6.0 (clang 3.8) and FreeBSD 11-STABLE (system clang), this will raise a warning clang-3.8: warning: argument unused during compilation: '-stdlib=libc++'
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -stdlib=libc++ -lc++abi") | ||
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -stdlib=libc++ -lc++abi") | ||
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -stdlib=libc++") | ||
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -stdlib=libc++") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Even when removing these, OpenBSD 6.0 will do this on linking:
Scanning dependencies of target nanogui
[ 88%] Linking CXX shared library libnanogui.so
/usr/bin/ld: cannot find -lc++
clang-3.8: error: linker command failed with exit code 1 (use -v to see invocation)
*** Error 1 in . (CMakeFiles/nanogui.dir/build.make:157 'libnanogui.so')
*** Error 1 in . (CMakeFiles/Makefile2:107 'CMakeFiles/nanogui.dir/all')
*** Error 1 in /root/study/c++/nanogui/build (Makefile:128 'all')
|
Merged, thank you! |
On FreeBSD (haven't tried Linux yet) this library will be missing. I believe it's only available on OS X.
http://libcxxabi.llvm.org/