conan-io / conan-center-index

Recipes for the ConanCenter repository
https://conan.io/center
MIT License
960 stars 1.77k forks source link

[package] libbsd/0.10.0: Linking libbsd into shared library fails under linux #2607

Closed ItsBasi closed 4 years ago

ItsBasi commented 4 years ago

Package and Environment Details (include every applicable attribute)

Conan profile (output of conan profile show default or conan profile show <profile> if custom profile is in use)

[settings] arch=x86_64 arch_build=x86_64 build_type=Release compiler=gcc compiler.libcxx=libstdc++ compiler.version=5 os=Linux os_build=Linux [options] minizip:shared=True

Steps to reproduce (Include if Applicable)

clone commit 8b5a5a70f61351f847b34df5db49adc2c1fff9d2 of https://github.com/ItsBasi/conan-center-index conan create . minizip/2.10.0@ -pr profile.txt

Logs (Include/Attach if Applicable)

Log from conan-center-bot

Click to expand log Exporting package recipe minizip/2.10.0 exports: File 'conandata.yml' found. Exporting it... minizip/2.10.0 exports: Copied 1 '.yml' file: conandata.yml minizip/2.10.0 exports_sources: Copied 1 '.txt' file: CMakeLists.txt minizip/2.10.0 exports_sources: Copied 11 '.patch' files minizip/2.10.0: The stored package has not changed minizip/2.10.0: Exported revision: 93b5a56bf434e05c8252527bb5c35b0a Configuration: [settings] arch=x86_64 arch_build=x86_64 build_type=Release compiler=gcc compiler.libcxx=libstdc++ compiler.version=5 os=Linux os_build=Linux [options] minizip:shared=True [build_requires] [env] minizip/2.10.0: Forced build from source minizip/2.10.0 (test package): Installing package Requirements bzip2/1.0.8 from 'conan-center' - Cache libbsd/0.10.0 from 'conan-center' - Cache libiconv/1.16 from 'conan-center' - Cache minizip/2.10.0 from local cache - Cache zlib/1.2.11 from 'conan-center' - Cache zstd/1.4.5 from 'conan-center' - Cache Packages bzip2/1.0.8:3df6ebb8a308d309e882b21988fd9ea103560e16 - Cache libbsd/0.10.0:76f87539fc90ff313e0b3182641a9bb558a717d2 - Cache libiconv/1.16:76f87539fc90ff313e0b3182641a9bb558a717d2 - Cache minizip/2.10.0:b3b4316a0a2a981526ad689009cc6a98be68bbbb - Build zlib/1.2.11:76f87539fc90ff313e0b3182641a9bb558a717d2 - Cache zstd/1.4.5:76f87539fc90ff313e0b3182641a9bb558a717d2 - Cache Installing (downloading, building) binaries... bzip2/1.0.8: Already installed! libbsd/0.10.0: Already installed! libiconv/1.16: Already installed! libiconv/1.16: Appending PATH environment var: /home/florian/.conan/data/libiconv/1.16/_/_/package/76f87539fc90ff313e0b3182641a9bb558a717d2/bin zlib/1.2.11: Already installed! zstd/1.4.5: Already installed! minizip/2.10.0: Copying sources to build folder minizip/2.10.0: Building your package in /home/florian/.conan/data/minizip/2.10.0/_/_/build/b3b4316a0a2a981526ad689009cc6a98be68bbbb minizip/2.10.0: Generator cmake_find_package created FindZLIB.cmake minizip/2.10.0: Generator cmake_find_package created FindBZip2.cmake minizip/2.10.0: Generator cmake_find_package created Findzstd.cmake minizip/2.10.0: Generator cmake_find_package created Findlibbsd.cmake minizip/2.10.0: Generator cmake_find_package created FindIconv.cmake minizip/2.10.0: Generator cmake created conanbuildinfo.cmake minizip/2.10.0: Calling build() -- The C compiler identification is GNU 5.5.0 -- The CXX compiler identification is GNU 5.5.0 -- Check for working C compiler: /usr/bin/gcc-5 -- Check for working C compiler: /usr/bin/gcc-5 -- works -- Detecting C compiler ABI info -- Detecting C compiler ABI info - done -- Detecting C compile features -- Detecting C compile features - done -- Check for working CXX compiler: /usr/bin/g++-5 -- Check for working CXX compiler: /usr/bin/g++-5 -- works -- Detecting CXX compiler ABI info -- Detecting CXX compiler ABI info - done -- Detecting CXX compile features -- Detecting CXX compile features - done -- Conan: called by CMake conan helper -- Conan: called inside local cache -- Conan: Adjusting output directories -- Conan: Using cmake targets configuration -- Library z found /home/florian/.conan/data/zlib/1.2.11/_/_/package/76f87539fc90ff313e0b3182641a9bb558a717d2/lib/libz.a -- Library bz2 found /home/florian/.conan/data/bzip2/1.0.8/_/_/package/3df6ebb8a308d309e882b21988fd9ea103560e16/lib/libbz2.a -- Library zstd found /home/florian/.conan/data/zstd/1.4.5/_/_/package/76f87539fc90ff313e0b3182641a9bb558a717d2/lib/libzstd.a -- Library bsd found /home/florian/.conan/data/libbsd/0.10.0/_/_/package/76f87539fc90ff313e0b3182641a9bb558a717d2/lib/libbsd.a -- Library bsd-ctor found /home/florian/.conan/data/libbsd/0.10.0/_/_/package/76f87539fc90ff313e0b3182641a9bb558a717d2/lib/libbsd-ctor.a -- Library iconv found /home/florian/.conan/data/libiconv/1.16/_/_/package/76f87539fc90ff313e0b3182641a9bb558a717d2/lib/libiconv.a -- Library charset found /home/florian/.conan/data/libiconv/1.16/_/_/package/76f87539fc90ff313e0b3182641a9bb558a717d2/lib/libcharset.a -- Conan: Adjusting default RPATHs Conan policies -- Conan: Adjusting language standard -- Conan: Compiler GCC>=5, checking major version 5 -- Conan: Checking correct version: 5 -- Using CMake version 3.10.2 -- Conan: Using autogenerated FindZLIB.cmake -- Found ZLIB: 1.2.11 (found version "1.2.11") -- Library z found /home/florian/.conan/data/zlib/1.2.11/_/_/package/76f87539fc90ff313e0b3182641a9bb558a717d2/lib/libz.a -- Found: /home/florian/.conan/data/zlib/1.2.11/_/_/package/76f87539fc90ff313e0b3182641a9bb558a717d2/lib/libz.a -- Conan: Using autogenerated Findzstd.cmake -- Found zstd: 1.4.5 (found version "1.4.5") -- Library zstd found /home/florian/.conan/data/zstd/1.4.5/_/_/package/76f87539fc90ff313e0b3182641a9bb558a717d2/lib/libzstd.a -- Skipping already existing target: CONAN_LIB::zstd_zstd -- Found: /home/florian/.conan/data/zstd/1.4.5/_/_/package/76f87539fc90ff313e0b3182641a9bb558a717d2/lib/libzstd.a -- Library zstd found /home/florian/.conan/data/zstd/1.4.5/_/_/package/76f87539fc90ff313e0b3182641a9bb558a717d2/lib/libzstd.a -- Found: /home/florian/.conan/data/zstd/1.4.5/_/_/package/76f87539fc90ff313e0b3182641a9bb558a717d2/lib/libzstd.a -- Conan: Using autogenerated FindBZip2.cmake -- Found BZip2: 1.0.8 (found version "1.0.8") -- Library bz2 found /home/florian/.conan/data/bzip2/1.0.8/_/_/package/3df6ebb8a308d309e882b21988fd9ea103560e16/lib/libbz2.a -- Found: /home/florian/.conan/data/bzip2/1.0.8/_/_/package/3df6ebb8a308d309e882b21988fd9ea103560e16/lib/libbz2.a -- Looking for stdint.h -- Looking for stdint.h - found -- Looking for inttypes.h -- Looking for inttypes.h - found -- Looking for sys/types.h -- Looking for sys/types.h - found -- Looking for stddef.h -- Looking for stddef.h - found -- Check size of off64_t -- Check size of off64_t - failed -- Looking for fseeko -- Looking for fseeko - found -- Looking for getrandom -- Looking for getrandom - found -- Looking for arc4random_buf -- Looking for arc4random_buf - not found -- Looking for arc4random -- Looking for arc4random - not found -- Conan: Using autogenerated Findlibbsd.cmake -- Found libbsd: 0.10.0 (found version "0.10.0") -- Conan: Component 'bsd' found in package 'libbsd' -- Conan: Component 'libbsd-overlay' found in package 'libbsd' -- Conan: Component 'libbsd-ctor' found in package 'libbsd' -- Library bsd found /home/florian/.conan/data/libbsd/0.10.0/_/_/package/76f87539fc90ff313e0b3182641a9bb558a717d2/lib/libbsd.a -- Skipping already existing target: CONAN_LIB::libbsd_bsd -- Found: /home/florian/.conan/data/libbsd/0.10.0/_/_/package/76f87539fc90ff313e0b3182641a9bb558a717d2/lib/libbsd.a -- Library bsd-ctor found /home/florian/.conan/data/libbsd/0.10.0/_/_/package/76f87539fc90ff313e0b3182641a9bb558a717d2/lib/libbsd-ctor.a -- Skipping already existing target: CONAN_LIB::libbsd_bsd-ctor -- Found: /home/florian/.conan/data/libbsd/0.10.0/_/_/package/76f87539fc90ff313e0b3182641a9bb558a717d2/lib/libbsd-ctor.a -- Library bsd-ctor found /home/florian/.conan/data/libbsd/0.10.0/_/_/package/76f87539fc90ff313e0b3182641a9bb558a717d2/lib/libbsd-ctor.a -- Found: /home/florian/.conan/data/libbsd/0.10.0/_/_/package/76f87539fc90ff313e0b3182641a9bb558a717d2/lib/libbsd-ctor.a -- Library bsd found /home/florian/.conan/data/libbsd/0.10.0/_/_/package/76f87539fc90ff313e0b3182641a9bb558a717d2/lib/libbsd.a -- Found: /home/florian/.conan/data/libbsd/0.10.0/_/_/package/76f87539fc90ff313e0b3182641a9bb558a717d2/lib/libbsd.a -- Library bsd found /home/florian/.conan/data/libbsd/0.10.0/_/_/package/76f87539fc90ff313e0b3182641a9bb558a717d2/lib/libbsd.a -- Found: /home/florian/.conan/data/libbsd/0.10.0/_/_/package/76f87539fc90ff313e0b3182641a9bb558a717d2/lib/libbsd.a -- Looking for arc4random_buf in /home/florian/.conan/data/libbsd/0.10.0/_/_/package/76f87539fc90ff313e0b3182641a9bb558a717d2/lib/libbsd.a;/home/florian/.conan/data/libbsd/0.10.0/_/_/package/76f87539fc90ff313e0b3182641a9bb558a717d2/lib/libbsd-ctor.a; -- Looking for arc4random_buf in /home/florian/.conan/data/libbsd/0.10.0/_/_/package/76f87539fc90ff313e0b3182641a9bb558a717d2/lib/libbsd.a;/home/florian/.conan/data/libbsd/0.10.0/_/_/package/76f87539fc90ff313e0b3182641a9bb558a717d2/lib/libbsd-ctor.a; - found -- Conan: Using autogenerated FindIconv.cmake -- Found Iconv: 1.16 (found version "1.16") -- Library iconv found /home/florian/.conan/data/libiconv/1.16/_/_/package/76f87539fc90ff313e0b3182641a9bb558a717d2/lib/libiconv.a -- Found: /home/florian/.conan/data/libiconv/1.16/_/_/package/76f87539fc90ff313e0b3182641a9bb558a717d2/lib/libiconv.a -- Library charset found /home/florian/.conan/data/libiconv/1.16/_/_/package/76f87539fc90ff313e0b3182641a9bb558a717d2/lib/libcharset.a -- Found: /home/florian/.conan/data/libiconv/1.16/_/_/package/76f87539fc90ff313e0b3182641a9bb558a717d2/lib/libcharset.a -- Signing not supported with current configuration -- Looking for limits.h -- Looking for limits.h - found -- Looking for string.h -- Looking for string.h - found -- Looking for strings.h -- Looking for strings.h - found -- Looking for memory.h -- Looking for memory.h - found -- Looking for stdbool.h -- Looking for stdbool.h - found -- Looking for immintrin.h -- Looking for immintrin.h - found -- The following features have been enabled: * MZ_COMPAT, Enables compatibility layer * MZ_ZLIB, Enables ZLIB compression * MZ_BZIP2, Enables BZIP2 compression * MZ_LZMA, Enables LZMA compression * MZ_ZSTD, Enables ZSTD compression * MZ_PKCRYPT, Enables PKWARE traditional encryption * MZ_WZAES, Enables WinZIP AES encryption * MZ_LIBBSD, Build with libbsd for crypto random * MZ_BRG, Enables Brian Gladman's encryption library * MZ_DECOMPRESS, Support decompression * MZ_COMPRESS, Support compression -- The following features have been disabled: * MZ_LIBCOMP, Enables Apple compression * MZ_OPENSSL, Enables OpenSSL for encryption * MZ_SIGNING, Enables zip signing support * MZ_BUILD_TEST, Builds minizip test executable * MZ_BUILD_UNIT_TEST, Builds minizip unit test project * MZ_BUILD_FUZZ_TEST, Builds minizip fuzzer executables * MZ_CODE_COVERAGE, Builds with code coverage flags -- Configuring done -- Generating done CMake Warning: Manually-specified variables were not used by the project: CMAKE_EXPORT_NO_PACKAGE_REGISTRY -- Build files have been written to: /home/florian/.conan/data/minizip/2.10.0/_/_/build/b3b4316a0a2a981526ad689009cc6a98be68bbbb/build_subfolder Scanning dependencies of target minizip [ 2%] Building C object source_subfolder/CMakeFiles/minizip.dir/mz_crypt.c.o [ 4%] Building C object source_subfolder/CMakeFiles/minizip.dir/mz_os.c.o [ 7%] Building C object source_subfolder/CMakeFiles/minizip.dir/mz_strm.c.o [ 9%] Building C object source_subfolder/CMakeFiles/minizip.dir/mz_strm_buf.c.o [ 11%] Building C object source_subfolder/CMakeFiles/minizip.dir/mz_strm_mem.c.o [ 14%] Building C object source_subfolder/CMakeFiles/minizip.dir/mz_strm_split.c.o [ 16%] Building C object source_subfolder/CMakeFiles/minizip.dir/mz_zip.c.o [ 19%] Building C object source_subfolder/CMakeFiles/minizip.dir/mz_zip_rw.c.o [ 21%] Building C object source_subfolder/CMakeFiles/minizip.dir/mz_os_posix.c.o [ 23%] Building C object source_subfolder/CMakeFiles/minizip.dir/mz_strm_os_posix.c.o [ 26%] Building C object source_subfolder/CMakeFiles/minizip.dir/mz_compat.c.o [ 28%] Building C object source_subfolder/CMakeFiles/minizip.dir/mz_strm_pkcrypt.c.o [ 30%] Building C object source_subfolder/CMakeFiles/minizip.dir/mz_strm_wzaes.c.o [ 33%] Building C object source_subfolder/CMakeFiles/minizip.dir/mz_crypt_brg.c.o [ 35%] Building C object source_subfolder/CMakeFiles/minizip.dir/mz_strm_zlib.c.o [ 38%] Building C object source_subfolder/CMakeFiles/minizip.dir/mz_strm_zstd.c.o [ 40%] Building C object source_subfolder/CMakeFiles/minizip.dir/mz_strm_bzip.c.o [ 42%] Building C object source_subfolder/CMakeFiles/minizip.dir/mz_strm_lzma.c.o [ 45%] Building C object source_subfolder/CMakeFiles/minizip.dir/lib/brg/aescrypt.c.o [ 47%] Building C object source_subfolder/CMakeFiles/minizip.dir/lib/brg/aeskey.c.o [ 50%] Building C object source_subfolder/CMakeFiles/minizip.dir/lib/brg/aestab.c.o [ 52%] Building C object source_subfolder/CMakeFiles/minizip.dir/lib/brg/hmac.c.o [ 54%] Building C object source_subfolder/CMakeFiles/minizip.dir/lib/brg/sha1.c.o [ 57%] Building C object source_subfolder/CMakeFiles/minizip.dir/lib/brg/sha2.c.o [ 59%] Building C object source_subfolder/CMakeFiles/minizip.dir/lib/liblzma/check/check.c.o [ 61%] Building C object source_subfolder/CMakeFiles/minizip.dir/lib/liblzma/check/crc32_fast.c.o [ 64%] Building C object source_subfolder/CMakeFiles/minizip.dir/lib/liblzma/check/crc32_table.c.o [ 66%] Building C object source_subfolder/CMakeFiles/minizip.dir/lib/liblzma/common/alone_decoder.c.o [ 69%] Building C object source_subfolder/CMakeFiles/minizip.dir/lib/liblzma/common/alone_encoder.c.o [ 71%] Building C object source_subfolder/CMakeFiles/minizip.dir/lib/liblzma/common/common.c.o [ 73%] Building C object source_subfolder/CMakeFiles/minizip.dir/lib/liblzma/common/filter_encoder.c.o [ 76%] Building C object source_subfolder/CMakeFiles/minizip.dir/lib/liblzma/lz/lz_decoder.c.o [ 78%] Building C object source_subfolder/CMakeFiles/minizip.dir/lib/liblzma/lz/lz_encoder.c.o [ 80%] Building C object source_subfolder/CMakeFiles/minizip.dir/lib/liblzma/lz/lz_encoder_mf.c.o [ 83%] Building C object source_subfolder/CMakeFiles/minizip.dir/lib/liblzma/lzma/fastpos_table.c.o [ 85%] Building C object source_subfolder/CMakeFiles/minizip.dir/lib/liblzma/lzma/lzma_decoder.c.o [ 88%] Building C object source_subfolder/CMakeFiles/minizip.dir/lib/liblzma/lzma/lzma_encoder.c.o [ 90%] Building C object source_subfolder/CMakeFiles/minizip.dir/lib/liblzma/lzma/lzma_encoder_optimum_fast.c.o [ 92%] Building C object source_subfolder/CMakeFiles/minizip.dir/lib/liblzma/lzma/lzma_encoder_optimum_normal.c.o [ 95%] Building C object source_subfolder/CMakeFiles/minizip.dir/lib/liblzma/lzma/lzma_encoder_presets.c.o [ 97%] Building C object source_subfolder/CMakeFiles/minizip.dir/lib/liblzma/rangecoder/price_table.c.o [100%] Linking C shared library ../lib/libminizip.so /usr/bin/ld: ../lib/libminizip.so.2.10.0: version node not found for symbol setproctitle@LIBBSD_0.2 /usr/bin/ld: failed to set dynamic section sizes: Bad value collect2: error: ld returned 1 exit status source_subfolder/CMakeFiles/minizip.dir/build.make:1142: recipe for target 'lib/libminizip.so.2.10.0' failed make[2]: *** [lib/libminizip.so.2.10.0] Error 1 CMakeFiles/Makefile2:85: recipe for target 'source_subfolder/CMakeFiles/minizip.dir/all' failed make[1]: *** [source_subfolder/CMakeFiles/minizip.dir/all] Error 2 Makefile:129: recipe for target 'all' failed make: *** [all] Error 2 minizip/2.10.0:
madebr commented 4 years ago

The generated targets by the conan cmake generator do not respect the dependencies of components.

When verbose building the test_package of minizip, the link command contains:

/home/maarten/.conan/data/libbsd/0.10.0/_/_/package/6af9cc7cb931c5ad942174fd7838eb655717c709/lib/libbsd.a /home/maarten/.conan/data/libbsd/0.10.0/_/_/package/6af9cc7cb931c5ad942174fd7838eb655717c709/lib/libbsd-ctor.a

(libbsd.a before libbsd-ctor.a)

When switching to the target generated by cmake_find_package, the link command contains:

/home/maarten/.conan/data/libbsd/0.10.0/_/_/package/6af9cc7cb931c5ad942174fd7838eb655717c709/lib/libbsd-ctor.a /home/maarten/.conan/data/libbsd/0.10.0/_/_/package/6af9cc7cb931c5ad942174fd7838eb655717c709/lib/libbsd.a

(libbsd-ctor.a before libbsd.a)

So it seems the CONAN_PKG::* targets do not respect the internal component dependencies. Imho this is a conan bug.

To workaround this bug for the minizip test_package, add the cmake_find_package generator, inside the CMakeLists.txt do find_package(minizip REQUIRED), and link to minizip::minizip instead of CONAN_PKG::minizip.

But this is not a real fix!!

madebr commented 4 years ago

When I remove the libbsd-overlay component, the CONAN_PKG::* target works again. So the problem occurs because the bsd library is used twice in two components.

madebr commented 4 years ago

I think #2609 fixes the libbsd problem.

ItsBasi commented 4 years ago

I had a look at how i link to libbsd in minizip. Linking to libbsd with target_link_libraries(${PROJECT_NAME} libbsd::libbsd libbsd::libbsd-overlay libbsd::libbsd-ctor) might have been incorrect. I changed this to target_link_libraries(${PROJECT_NAME} libbsd::libbsd) in f7ed57e.

ItsBasi commented 4 years ago

2609 should prevent other users from making the mistake i made. Since minizip 2.10.0 compiles under linux now with the above fix, i would close this issue.

Regarding the inconsistent linking order for CONAN_PKG and find_package, i would also say that this should be fixed but in a new issue.