jgsogo / conan-apache-apr

[Archived] Recipe available in Conan Center
https://conan.io/center/apr/1.7.0
Apache License 2.0
0 stars 1 forks source link

Reproduce apple-clang error notified at #2 #3

Closed jgsogo closed 6 years ago

jgsogo commented 6 years ago

See #2. Try to reproduce error in CI. Is it related to shared option?

jgsogo commented 6 years ago

Activated shared/static builds in Travis, and it works fine :/

jgsogo commented 6 years ago

Copying issue from here as it is reported by @lasote

apache-apr/1.6.3@jgsogo/stable (test package) imports(): Copied 2 '.dylib' files: libapr-1.0.dylib, libapr-1.dylib
apache-apr/1.6.3@jgsogo/stable (test package): Running build()
-- The CXX compiler identification is AppleClang 9.0.0.9000039
-- Check for working CXX compiler: /usr/local/opt/ccache/libexec/c++
-- Check for working CXX compiler: /usr/local/opt/ccache/libexec/c++ -- 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: Using cmake global configuration
-- Conan: Adjusting default RPATHs Conan policies
-- Conan: Adjusting language standard
-- Conan: C++ stdlib: libc++
-- Configuring done
-- Generating done
-- Build files have been written to: /Users/luism/workspace/inclusions/storage/jgsogo/conan-packages/apache-apr__1.6.3__jgsogo__stable/git_clone/pkg/test_package/build/7dd9e1a83ffe63c45af7c671c6032d748dc83894
Scanning dependencies of target example
[ 50%] Building CXX object CMakeFiles/example.dir/example.cpp.o
[100%] Linking CXX executable bin/example
[100%] Built target example
apache-apr/1.6.3@jgsogo/stable (test package): Running test()
dyld: Library not loaded: /Users/travis/.conan/data/apache-apr/1.6.3/jgsogo/stable/package/389adbab17f57e67170eb9b6c367e3676bd95d7c/lib/libapr-1.0.dylib
Referenced from: /Users/luism/workspace/inclusions/storage/jgsogo/conan-packages/apache-apr__1.6.3__jgsogo__stable/git_clone/pkg/test_package/build/7dd9e1a83ffe63c45af7c671c6032d748dc83894/bin/./example
Reason: Incompatible library version: example requires version 7.0.0 or later, but libapr-1.0.dylib provides version 5.0.0
ERROR: PROJECT: Error in test() method, line 23
self.run(".%sexample" % os.sep)
ConanException: Error 6 while executing ./example

I'm not fully sure if it is related, but I noticed that you are packaging static and shared libraries, but the test package is always importing to the bin the dylibs, so, how do you know which library is being linked? I would suggest the usage of build_id instead of package_id to build once but package twice. I think it's safer to package only the shared or only the static.

jgsogo commented 6 years ago

@lasote at some point in time jobs for apple-clang were wrong, have you tried building from scratch? does the same issue appears?

lasote commented 6 years ago

Yes. Running a conan create.

jgsogo commented 6 years ago

...but I need to reproduce it using Travis, I haven't got a OSX at hand to test it :/

jgsogo commented 6 years ago

I've dump pkgconfig/apr-1.pc for apple-clang builds (here). All of them output the same file (as expected because all of them perform the same build: both shared and static):

prefix=/Users/travis/.conan/data/apache-apr/1.6.3/jgsogo/testing/package/389adbab17f57e67170eb9b6c367e3676bd95d7c
exec_prefix=${prefix}
libdir=${exec_prefix}/lib
APR_MAJOR_VERSION=1
includedir=${prefix}/include/apr-${APR_MAJOR_VERSION}

Name: APR
Description: The Apache Portable Runtime library
Version: 1.6.3

Libs: -L${libdir} -lapr-${APR_MAJOR_VERSION} -lpthread
Cflags:  -DDARWIN -DSIGPROCMASK_SETS_THREAD_MASK  -I${includedir}

And the available libraries to link are (listing package_folder/lib):

apr.exp
libapr-1.0.dylib
libapr-1.a
libapr-1.dylib
libapr-1.la

As you said, @lasote , I don't know how it is suppossed to distinguish between static and dynamic linking, how to choose one library over another. Any idea on this?

lasote commented 6 years ago

I think the ld will choose the shared always, so no idea how to manage it well. Probably it deserves to ask in the author repository.