Skip to content

src_base: cmake: Link libm for the shared library#86

Merged
dariusz-f merged 1 commit intompeg5:masterfrom
Conan-Kudo:always-link-libm
Aug 28, 2025
Merged

src_base: cmake: Link libm for the shared library#86
dariusz-f merged 1 commit intompeg5:masterfrom
Conan-Kudo:always-link-libm

Conversation

@Conan-Kudo
Copy link
Contributor

@Conan-Kudo Conan-Kudo commented Aug 24, 2025

Otherwise it fails to link with errors like so:

/usr/bin/ld: /usr/lib/gcc/x86_64-redhat-linux/15/../../../../lib64/libxevdb.so: undefined reference to 'log2'
/usr/bin/ld: /usr/lib/gcc/x86_64-redhat-linux/15/../../../../lib64/libxevdb.so: undefined reference to 'pow'

@jamrial
Copy link

jamrial commented Aug 24, 2025

For context, this is only a problem with xevdb, not the main xevd. And no, i don't think this is the correct approach. The .so file will still not link to -lm on its own.

The correct fix would be

diff --git a/src_base/CMakeLists.txt b/src_base/CMakeLists.txt
index 0d8575a..5a2ff99 100644
--- a/src_base/CMakeLists.txt
+++ b/src_base/CMakeLists.txt
@@ -92,6 +92,7 @@ elseif( UNIX OR MINGW )
     endif()
     set_target_properties(${LIB_NAME_BASE}_dynamic PROPERTIES FOLDER lib
                                                             LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
+    target_link_libraries(${LIB_NAME_BASE}_dynamic m)
     target_compile_definitions( ${LIB_NAME_BASE} PUBLIC ANY LINUX )
     target_link_libraries(${LIB_NAME_BASE} m)
 endif()

Same with xeveb

Otherwise it fails to link with	errors like so:

/usr/bin/ld: /usr/lib/gcc/x86_64-redhat-linux/15/../../../../lib64/libxevdb.so: undefined reference to 'log2'
/usr/bin/ld: /usr/lib/gcc/x86_64-redhat-linux/15/../../../../lib64/libxevdb.so: undefined reference to 'pow'
@Conan-Kudo
Copy link
Contributor Author

That's fair, fixed.

@Conan-Kudo Conan-Kudo changed the title pkgconfig: Always link libm src_base: cmake: Link libm for the shared library Aug 24, 2025
@Conan-Kudo
Copy link
Contributor Author

Refreshed with the right fix.

@dariusz-f dariusz-f merged commit 4087f63 into mpeg5:master Aug 28, 2025
3 checks passed
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 this pull request may close these issues.

3 participants