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

Cmake build: load_j2b.cpp.o: In function `Inflate': undefined reference to… #36

Closed
DAP-DarkneSS opened this issue Jul 3, 2016 · 11 comments
Labels

Comments

@DAP-DarkneSS
Copy link

DAP-DarkneSS commented Jul 3, 2016

QMPlay2 16.07.02, openSUSE 13.2 x64, legacy build is fine.
cmake.build.log.txt
compile_unix.build.log.txt

@zaps166
Copy link
Owner

zaps166 commented Jul 3, 2016

Looks like missing zlib linking for Linux (worked when I tested without this). Please apply:

diff --git a/src/modules/Modplug/CMakeLists.txt b/src/modules/Modplug/CMakeLists.txt
index e868ee2..2d3eb3e 100644
--- a/src/modules/Modplug/CMakeLists.txt
+++ b/src/modules/Modplug/CMakeLists.txt
@@ -61,10 +61,8 @@ add_library(${PROJECT_NAME} MODULE
     ${Modplug_SRC}
 )

-if(WIN32 OR CMAKE_SYSTEM_NAME STREQUAL "Darwin")
-    find_package(ZLIB REQUIRED)
-    target_link_libraries(${PROJECT_NAME} ${ZLIB_LIBRARY})
-endif()
+find_package(ZLIB REQUIRED)
+target_link_libraries(${PROJECT_NAME} ${ZLIB_LIBRARY})

 if(USE_QT5)
     qt5_use_modules(${PROJECT_NAME} Gui Widgets)

If it will help I'll push a patch :)

@zaps166 zaps166 added the bug label Jul 3, 2016
@DAP-DarkneSS
Copy link
Author

Thank you, the patch is fine but there is similar but another linking error now.
I suppose that issue depends on what libraries Qt was linked with.
cmake2.build.log.txt

@zaps166
Copy link
Owner

zaps166 commented Jul 3, 2016

The problem with OpenGL and ModPlug is in -Wl,--no-undefined which is used in your build. The best solution I think is to link to OpenGL libraries instead of removing the flag.

@zaps166
Copy link
Owner

zaps166 commented Jul 3, 2016

Or maybe it is better to force-remove -Wl,--no-undefined from CMake link flags?

As a workaround please apply:

XVideo:

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 3cd8de2..d49b97a 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -142,7 +142,7 @@ option(USE_PULSEAUDIO "Build with PulseAudio module" ${LIBPULSE_FOUND})
 add_feature_info(PulseAudio USE_PULSEAUDIO "Build with PulseAudio module")

 if(NOT DEFINED USE_XVIDEO)
-    pkg_check_modules(LIB_X11_XV x11 xv)
+    pkg_check_modules(LIB_X11_XV x11 xv xext)
 endif()
 option(USE_XVIDEO "Build with XVideo module" ${LIB_X11_XV_FOUND})
 add_feature_info(XVideo USE_XVIDEO "Build with XVideo module")
diff --git a/src/modules/XVideo/CMakeLists.txt b/src/modules/XVideo/CMakeLists.txt
index 92c6cd7..fb8383b 100644
--- a/src/modules/XVideo/CMakeLists.txt
+++ b/src/modules/XVideo/CMakeLists.txt
@@ -28,7 +28,7 @@ set(XVideo_RESOURCES
     icon.qrc
 )

-pkg_check_modules(LIB_X11_XV x11 xv REQUIRED)
+pkg_check_modules(LIB_X11_XV x11 xv xext REQUIRED)
 link_directories(${LIB_X11_XV_LIBRARY_DIRS})

 if(USE_QT5)

OpenGL2:

diff --git a/src/modules/OpenGL2/CMakeLists.txt b/src/modules/OpenGL2/CMakeLists.txt
index 8464ce2..0fe2b4a 100644
--- a/src/modules/OpenGL2/CMakeLists.txt
+++ b/src/modules/OpenGL2/CMakeLists.txt
@@ -97,11 +97,13 @@ target_link_libraries(${PROJECT_NAME}
 if(CMAKE_SYSTEM_NAME STREQUAL "Darwin")
     find_package(OpenGL REQUIRED)
     target_link_libraries(${PROJECT_NAME} ${OPENGL_LIBRARIES})
-elseif(WIN32)
+else()
     if(QT_USES_OPENGLES)
         target_link_libraries(${PROJECT_NAME} GLESv2)
-    else()
+    elseif(WIN32)
         target_link_libraries(${PROJECT_NAME} opengl32)
+    else()
+        target_link_libraries(${PROJECT_NAME} GL)
     endif()
 endif()

@DAP-DarkneSS
Copy link
Author

DAP-DarkneSS commented Jul 3, 2016 via email

@zaps166
Copy link
Owner

zaps166 commented Jul 3, 2016

Ok and I'll force-remove this flag from CMake build.

@DAP-DarkneSS
Copy link
Author

DAP-DarkneSS commented Jul 3, 2016 via email

@zaps166
Copy link
Owner

zaps166 commented Jul 3, 2016

The first patch is not necessary if you not use the -Wl,--no-undefined.

@zaps166 zaps166 closed this as completed in f274748 Jul 3, 2016
@zaps166
Copy link
Owner

zaps166 commented Jul 3, 2016

The patch: f274748 should fix it without doing any modifications, please test it instead of doing any other modification and patches (I want to know if it works and if it doesn't break anything else) :)

@DAP-DarkneSS
Copy link
Author

             | vanilla | f274748

just cmake | OK | OK

packaging macro | Fail | *

*: Shared objects files are put into /usr/usr/lib64 not /usr/lib64. Should
I file another report about it?

@zaps166
Copy link
Owner

zaps166 commented Jul 3, 2016

Also 65f826c is needed if there is no additional linker flags.

Should I file another report about it?

Hmm... Yes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants