lighttransport / nanort

NanoRT, single header only modern ray tracing kernel.
MIT License
1.07k stars 89 forks source link

CMake build error relating to 'Dear ImGui' #46

Closed zmertens closed 5 years ago

zmertens commented 5 years ago

I encountered this CMake build error relating to 'Dear ImGui' library on latest Ubuntu Linux:

[ 17%] Built target path_tracer
[ 23%] Linking CXX executable ../../bin/gui
[ 41%] Built target bidir_path_tracer
CMakeFiles/gui.dir/__/common/imgui/imgui.cpp.o: In function `ImGuiWindow::ImGuiWindow(ImGuiContext*, char const*)':
imgui.cpp:(.text+0x6a56): undefined reference to `ImGuiMenuColumns::ImGuiMenuColumns()'
CMakeFiles/gui.dir/__/common/imgui/imgui.cpp.o: In function `ImGui::ShowMetricsWindow(bool*)::Funcs::NodeDrawList(ImGuiWindow*, ImDrawList*, char const*) [clone .constprop.171]':
imgui.cpp:(.text+0x8b5b): undefined reference to `ImGui::TreeNode(void const*, char const*, ...)'
imgui.cpp:(.text+0x8c17): undefined reference to `ImGui::BulletText(char const*, ...)'
imgui.cpp:(.text+0x8cce): undefined reference to `ImGui::TreeNode(void const*, char const*, ...)'
imgui.cpp:(.text+0x8d81): undefined reference to `ImGui::TextColored(ImVec4 const&, char const*, ...)'
imgui.cpp:(.text+0x8d8b): undefined reference to `ImGui::TreePop()'
imgui.cpp:(.text+0x8f64): undefined reference to `ImGui::Selectable(char const*, bool, int, ImVec2 const&)'
imgui.cpp:(.text+0x8f99): undefined reference to `ImGui::TreePop()'
CMakeFiles/gui.dir/__/common/imgui/imgui.cpp.o: In function `ImGui::ShowMetricsWindow(bool*)::Funcs::NodeWindow(ImGuiWindow*, char const*)':
imgui.cpp:(.text+0x92f8): undefined reference to `ImGui::TreeNode(void const*, char const*, ...)'
imgui.cpp:(.text+0x9365): undefined reference to `ImGui::BulletText(char const*, ...)'
imgui.cpp:(.text+0x9407): undefined reference to `ImGui::BulletText(char const*, ...)'
imgui.cpp:(.text+0x9472): undefined reference to `ImGui::BulletText(char const*, ...)'
imgui.cpp:(.text+0x949c): undefined reference to `ImGui::BulletText(char const*, ...)'
imgui.cpp:(.text+0x94ca): undefined reference to `ImGui::BulletText(char const*, ...)'
CMakeFiles/gui.dir/__/common/imgui/imgui.cpp.o:imgui.cpp:(.text+0x94ea): more undefined references to `ImGui::BulletText(char const*, ...)' follow
CMakeFiles/gui.dir/__/common/imgui/imgui.cpp.o: In function `ImGui::ShowMetricsWindow(bool*)::Funcs::NodeWindow(ImGuiWindow*, char const*)':
imgui.cpp:(.text+0x95d9): undefined reference to `ImGui::TreeNode(char const*, char const*, ...)'
imgui.cpp:(.text+0x9636): undefined reference to `ImGui::TreeNode(void const*, char const*, ...)'
imgui.cpp:(.text+0x9668): undefined reference to `ImGui::BulletText(char const*, ...)'
imgui.cpp:(.text+0x96b8): undefined reference to `ImGui::BulletText(char const*, ...)'
imgui.cpp:(.text+0x96c3): undefined reference to `ImGui::TreePop()'
imgui.cpp:(.text+0x96e4): undefined reference to `ImGui::TreeNode(char const*, char const*, ...)'
imgui.cpp:(.text+0x9733): undefined reference to `ImGui::TreePop()'
imgui.cpp:(.text+0x975d): undefined reference to `ImGui::BulletText(char const*, ...)'
imgui.cpp:(.text+0x97c1): undefined reference to `ImGui::TreePop()'
CMakeFiles/gui.dir/__/common/imgui/imgui.cpp.o: In function `ImGuiTextFilter::Draw(char const*, float)':
imgui.cpp:(.text+0xb1b7): undefined reference to `ImGui::InputText(char const*, char*, unsigned long, int, int (*)(ImGuiInputTextCallbackData*), void*)'
imgui.cpp:(.text+0xb200): undefined reference to `ImGui::InputText(char const*, char*, unsigned long, int, int (*)(ImGuiInputTextCallbackData*), void*)'
CMakeFiles/gui.dir/__/common/imgui/imgui.cpp.o: In function `ImGui::EndColumns()':
imgui.cpp:(.text+0x111a1): undefined reference to `ImGui::ButtonBehavior(ImRect const&, unsigned int, bool*, bool*, int)'
CMakeFiles/gui.dir/__/common/imgui/imgui.cpp.o: In function `ImGui::LogButtons()':
imgui.cpp:(.text+0x12fca): undefined reference to `ImGui::Button(char const*, ImVec2 const&)'
imgui.cpp:(.text+0x1304a): undefined reference to `ImGui::Button(char const*, ImVec2 const&)'
imgui.cpp:(.text+0x130ca): undefined reference to `ImGui::Button(char const*, ImVec2 const&)'
imgui.cpp:(.text+0x131a0): undefined reference to `ImGui::SliderInt(char const*, int*, int, int, char const*)'
CMakeFiles/gui.dir/__/common/imgui/imgui.cpp.o: In function `ImGui::Begin(char const*, bool*, int)':
imgui.cpp:(.text+0x15e58): undefined reference to `ImGuiMenuColumns::Update(int, float, bool)'
imgui.cpp:(.text+0x15f74): undefined reference to `ImGui::CloseButton(unsigned int, ImVec2 const&, float)'
imgui.cpp:(.text+0x1776e): undefined reference to `ImGui::ButtonBehavior(ImRect const&, unsigned int, bool*, bool*, int)'
imgui.cpp:(.text+0x178ec): undefined reference to `ImGui::ButtonBehavior(ImRect const&, unsigned int, bool*, bool*, int)'
imgui.cpp:(.text+0x188b8): undefined reference to `ImGui::CollapseButton(unsigned int, ImVec2 const&)'
imgui.cpp:(.text+0x188d3): undefined reference to `ImGui::Scrollbar(int)'
imgui.cpp:(.text+0x188e6): undefined reference to `ImGui::Scrollbar(int)'
CMakeFiles/gui.dir/__/common/imgui/imgui.cpp.o: In function `ImGui::SetTooltipV(char const*, __va_list_tag*)':
imgui.cpp:(.text+0x1d28f): undefined reference to `ImGui::TextV(char const*, __va_list_tag*)'
CMakeFiles/gui.dir/__/common/imgui/imgui.cpp.o: In function `ImGui::ShowMetricsWindow(bool*)':
imgui.cpp:(.text+0x1d87e): undefined reference to `ImGui::Text(char const*, ...)'
imgui.cpp:(.text+0x1d8ab): undefined reference to `ImGui::Text(char const*, ...)'
imgui.cpp:(.text+0x1d8d9): undefined reference to `ImGui::Text(char const*, ...)'
imgui.cpp:(.text+0x1d8f3): undefined reference to `ImGui::Text(char const*, ...)'
imgui.cpp:(.text+0x1d907): undefined reference to `ImGui::Text(char const*, ...)'
imgui.cpp:(.text+0x1d91a): undefined reference to `ImGui::Checkbox(char const*, bool*)'
imgui.cpp:(.text+0x1d92d): undefined reference to `ImGui::Checkbox(char const*, bool*)'
imgui.cpp:(.text+0x1d932): undefined reference to `ImGui::Separator()'
imgui.cpp:(.text+0x1d95c): undefined reference to `ImGui::TreeNode(char const*, char const*, ...)'
imgui.cpp:(.text+0x1d9d8): undefined reference to `ImGui::TreeNode(void const*, char const*, ...)'
imgui.cpp:(.text+0x1da3c): undefined reference to `ImGui::BulletText(char const*, ...)'
imgui.cpp:(.text+0x1dadf): undefined reference to `ImGui::BulletText(char const*, ...)'
imgui.cpp:(.text+0x1db52): undefined reference to `ImGui::BulletText(char const*, ...)'
imgui.cpp:(.text+0x1db88): undefined reference to `ImGui::BulletText(char const*, ...)'
imgui.cpp:(.text+0x1dbb9): undefined reference to `ImGui::BulletText(char const*, ...)'
CMakeFiles/gui.dir/__/common/imgui/imgui.cpp.o:imgui.cpp:(.text+0x1dbdc): more undefined references to `ImGui::BulletText(char const*, ...)' follow
CMakeFiles/gui.dir/__/common/imgui/imgui.cpp.o: In function `ImGui::ShowMetricsWindow(bool*)':
imgui.cpp:(.text+0x1dc9b): undefined reference to `ImGui::TreePop()'
imgui.cpp:(.text+0x1dca5): undefined reference to `ImGui::TreePop()'
imgui.cpp:(.text+0x1dcc5): undefined reference to `ImGui::TreeNode(char const*, char const*, ...)'
imgui.cpp:(.text+0x1dd55): undefined reference to `ImGui::TreeNode(void const*, char const*, ...)'
imgui.cpp:(.text+0x1dde3): undefined reference to `ImGui::BulletText(char const*, ...)'
imgui.cpp:(.text+0x1de9c): undefined reference to `ImGui::TreeNode(void const*, char const*, ...)'
imgui.cpp:(.text+0x1df58): undefined reference to `ImGui::TextColored(ImVec4 const&, char const*, ...)'
imgui.cpp:(.text+0x1df61): undefined reference to `ImGui::TreePop()'
imgui.cpp:(.text+0x1df86): undefined reference to `ImGui::TreePop()'
imgui.cpp:(.text+0x1dfa6): undefined reference to `ImGui::TreeNode(char const*, char const*, ...)'
imgui.cpp:(.text+0x1e016): undefined reference to `ImGui::BulletText(char const*, ...)'
imgui.cpp:(.text+0x1e04f): undefined reference to `ImGui::TreePop()'
imgui.cpp:(.text+0x1e05b): undefined reference to `ImGui::TreeNode(char const*)'
imgui.cpp:(.text+0x1e0d7): undefined reference to `ImGui::Text(char const*, ...)'
imgui.cpp:(.text+0x1e100): undefined reference to `ImGui::Text(char const*, ...)'
imgui.cpp:(.text+0x1e135): undefined reference to `ImGui::Text(char const*, ...)'
imgui.cpp:(.text+0x1e174): undefined reference to `ImGui::Text(char const*, ...)'
imgui.cpp:(.text+0x1e198): undefined reference to `ImGui::Text(char const*, ...)'
CMakeFiles/gui.dir/__/common/imgui/imgui.cpp.o:imgui.cpp:(.text+0x1e1c1): more undefined references to `ImGui::Text(char const*, ...)' follow
CMakeFiles/gui.dir/__/common/imgui/imgui.cpp.o: In function `ImGui::ShowMetricsWindow(bool*)':
imgui.cpp:(.text+0x1e2cf): undefined reference to `ImGui::TreePop()'
imgui.cpp:(.text+0x1e5f3): undefined reference to `ImGui::Selectable(char const*, bool, int, ImVec2 const&)'
imgui.cpp:(.text+0x1e62b): undefined reference to `ImGui::TreePop()'
imgui.cpp:(.text+0x1e8ca): undefined reference to `ImGui::TreeNode(char const*, char const*, ...)'
imgui.cpp:(.text+0x1e93b): undefined reference to `ImGui::TreeNode(void const*, char const*, ...)'
imgui.cpp:(.text+0x1e96d): undefined reference to `ImGui::BulletText(char const*, ...)'
imgui.cpp:(.text+0x1e9b8): undefined reference to `ImGui::BulletText(char const*, ...)'
imgui.cpp:(.text+0x1e9c3): undefined reference to `ImGui::TreePop()'
imgui.cpp:(.text+0x1e9e0): undefined reference to `ImGui::TreeNode(char const*, char const*, ...)'
imgui.cpp:(.text+0x1ea26): undefined reference to `ImGui::TreePop()'
imgui.cpp:(.text+0x1ea46): undefined reference to `ImGui::TreePop()'
imgui.cpp:(.text+0x1ea8e): undefined reference to `ImGui::BulletText(char const*, ...)'
CMakeFiles/gui.dir/__/common/imgui/imgui.cpp.o: In function `ImGui::EndFrame()':
imgui.cpp:(.text+0x1f136): undefined reference to `ImGui::Selectable(char const*, bool, int, ImVec2 const&)'
CMakeFiles/gui.dir/__/common/imgui/imgui.cpp.o: In function `ImGui::ShowMetricsWindow(bool*)::Funcs::NodeWindow(ImGuiWindow*, char const*)':
imgui.cpp:(.text+0x95ac): undefined reference to `ImGui::TreePop()'
CMakeFiles/gui.dir/main.cc.o: In function `main':
main.cc:(.text.startup+0x667): undefined reference to `ImGui::InputFloat3(char const*, float*, char const*, int)'
main.cc:(.text.startup+0x68c): undefined reference to `ImGui::InputFloat3(char const*, float*, char const*, int)'
main.cc:(.text.startup+0x6b1): undefined reference to `ImGui::InputFloat3(char const*, float*, char const*, int)'
main.cc:(.text.startup+0x6cf): undefined reference to `ImGui::RadioButton(char const*, int*, int)'
main.cc:(.text.startup+0x6f8): undefined reference to `ImGui::RadioButton(char const*, int*, int)'
main.cc:(.text.startup+0x721): undefined reference to `ImGui::RadioButton(char const*, int*, int)'
main.cc:(.text.startup+0x74a): undefined reference to `ImGui::RadioButton(char const*, int*, int)'
main.cc:(.text.startup+0x773): undefined reference to `ImGui::RadioButton(char const*, int*, int)'
CMakeFiles/gui.dir/main.cc.o:main.cc:(.text.startup+0x79c): more undefined references to `ImGui::RadioButton(char const*, int*, int)' follow
CMakeFiles/gui.dir/main.cc.o: In function `main':
main.cc:(.text.startup+0x7e9): undefined reference to `ImGui::InputFloat(char const*, float*, float, float, char const*, int)'
main.cc:(.text.startup+0x805): undefined reference to `ImGui::InputFloat2(char const*, float*, char const*, int)'
main.cc:(.text.startup+0x818): undefined reference to `ImGui::Checkbox(char const*, bool*)'
collect2: error: ld returned 1 exit status
examples/gui/CMakeFiles/gui.dir/build.make:334: recipe for target 'bin/gui' failed
make[2]: *** [bin/gui] Error 1
CMakeFiles/Makefile2:164: recipe for target 'examples/gui/CMakeFiles/gui.dir/all' failed
make[1]: *** [examples/gui/CMakeFiles/gui.dir/all] Error 2
Makefile:83: recipe for target 'all' failed
make: *** [all] Error 2

I fixed it by adding ../common/imgui/imgui_widgets.cpp to sources in examples/gui/CMakeLists.txt:

https://github.com/lighttransport/nanort/blob/44a429067cab38617f0a716ffb80cc4e09547c49/examples/gui/CMakeLists.txt#L30

syoyo commented 5 years ago

Thanks! Fixed.