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

Macos constexpr constructor failure w/o -std=c++2b flag for clang #257

Open
god-shatter opened this issue Dec 28, 2023 · 1 comment
Open

Comments

@god-shatter
Copy link

god-shatter commented Dec 28, 2023

Compilation on my mac won't work unless I append the explicit std version flag -std=c++2b to the makefile CXXFlags.
It trips up on a constexpr constructor.

-> clang --version
Apple clang version 14.0.3 (clang-1403.0.22.14.1)
Target: arm64-apple-darwin23.1.0
Thread model: posix
InstalledDir: /Library/Developer/CommandLineTools/usr/bin

After fixing that and trying to run the glfw/opengl3 backend it errors on an incorrect linking call to ld.

➜  example_glfw_opengl3 git:(docking_inter) ✗ make
[ 59%] Built target glfw
[ 62%] Building CXX object CMakeFiles/cimgui.dir/Users/sugar/code/cimgui/cimgui.cpp.o
[ 66%] Linking CXX shared library libcimgui.dylib
ld: library not found for -lGL
clang: error: linker command failed with exit code 1 (use -v to see invocation)

For macos (m1 atleast) it should be -framework OpenGL to link opengl

EDIT2:

OK I got the example to build by changing the CMake OpenGL linking logic for macos to:

find_library(OPENGL OpenGL)
if (NOT OPENGL)
    message(FATAL_ERROR "OPENGL not found")
endif()
target_link_libraries(${PROJECT_NAME} ${OPENGL})

apparently find_library has special handling for macos

EDIT3:

Ah ok, so the backend_test example build processes will output a dll with the backend symbols exported. I get it now.

@sonoro1234
Copy link
Contributor

I cant test on macosx so PR is welcome

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