Skip to content

Conversation

@tpetazzoni
Copy link

BUILD_SHARED_LIBS is a standard CMake option [1] that specifies whether shared libraries should be built or not. This commit adjusts src/CMakeLists.txt to observe this variable to decide whether the shared library variant should be built or not. This allows check to only build a static library in environments where only a static library can be compiled.

This needs a bit of refactoring to avoid duplication:

  • Additional source files from libcompat are directly added to the ${SOURCES} variable as needed

  • Additional libraries are collected into ${ADDITIONAL_LIBS} before being associated to the static library and shared library (if enabled)

[1] https://cmake.org/cmake/help/latest/variable/BUILD_SHARED_LIBS.html

Fixes:

__uClibc_main.c:(.text+0x12c): undefined reference to __fini_array_end' /home/autobuild/autobuild/instance-20/output-1/host/lib/gcc/sparc-buildroot-linux-uclibc/13.3.0/../../../../sparc-buildroot-linux-uclibc/bin/ld: __uClibc_main.c:(.text+0x130): undefined reference to __fini_array_start'
/home/autobuild/autobuild/instance-20/output-1/host/lib/gcc/sparc-buildroot-linux-uclibc/13.3.0/../../../../sparc-buildroot-linux-uclibc/bin/ld: __uClibc_main.c:(.text+0x134): undefined reference to `__fini_array_end'

BUILD_SHARED_LIBS is a standard CMake option [1] that specifies
whether shared libraries should be built or not. This commit adjusts
src/CMakeLists.txt to observe this variable to decide whether the
shared library variant should be built or not. This allows check to
only build a static library in environments where only a static
library can be compiled.

This needs a bit of refactoring to avoid duplication:

- Additional source files from libcompat are directly added to the
  ${SOURCES} variable as needed

- Additional libraries are collected into ${ADDITIONAL_LIBS} before
  being associated to the static library and shared library (if enabled)

[1] https://cmake.org/cmake/help/latest/variable/BUILD_SHARED_LIBS.html

Fixes:

__uClibc_main.c:(.text+0x12c): undefined reference to `__fini_array_end'
/home/autobuild/autobuild/instance-20/output-1/host/lib/gcc/sparc-buildroot-linux-uclibc/13.3.0/../../../../sparc-buildroot-linux-uclibc/bin/ld: __uClibc_main.c:(.text+0x130): undefined reference to `__fini_array_start'
/home/autobuild/autobuild/instance-20/output-1/host/lib/gcc/sparc-buildroot-linux-uclibc/13.3.0/../../../../sparc-buildroot-linux-uclibc/bin/ld: __uClibc_main.c:(.text+0x134): undefined reference to `__fini_array_end'

Signed-off-by: Thomas Petazzoni <[email protected]>
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.

1 participant