[MacPorts] #49625: radare2 @0.9.9_0 build failure
MacPorts
noreply at macports.org
Sat Nov 14 14:15:10 PST 2015
#49625: radare2 @0.9.9_0 build failure
-------------------------+----------------------
Reporter: mopihopi@… | Owner: g5pw@…
Type: defect | Status: assigned
Priority: Normal | Milestone:
Component: ports | Version: 2.3.4
Resolution: | Keywords:
Port: radare2 |
-------------------------+----------------------
Comment (by mopihopi@…):
I tried deactivating pkgconfig, xz, and cctools. That required `-f`
(force deactivate) because I have other ports I need that require these,
but I just wanted to deactivate them temporarily.
Deactivating xz and cctools had no effect (same rev-upgrade issue as
before). With pkgconfig deactivated it was successful.
The radare2 Portfile uses the configure argument `--with-syscapstone`.
With this option, `pkg-config --libs capstone` is used to pick up the
system (MacPorts) capstone. When pkgconfig and capstone from MacPorts are
installed, this outputs `-L/opt/local/lib -lcapstone`. However this does
not work (see below). capstone is listed as a dependency but pkgconfig is
not; without pkgconfig installed, it appears that `--with-syscapstone` is
ignored and it builds its own copy of capstone and links it statically,
which does work. So apparently in the builds that work this option was
ignored.
With pkgconfig (broken):
{{{
...
DEBUG: Executing command line: cd
"/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_devel_radare2/radare2/work/radare2-0.9.9"
&& ./configure --prefix=/opt/local --with-sysmagic --with-syscapstone
--with-syszip --with-compiler=clang --with-openssl
...
checking build system type... x86_64-unknown-darwin
checking host system type... x86_64-unknown-darwin
checking target system type... x86_64-unknown-darwin
checking for working directories... current
using prefix '/opt/local'
checking for c compiler... /usr/bin/clang
checking for dynamic library... required
checking host endianness... little
checking for libmagic ... yes
Using PKGCONFIG: pkg-config
checking pkg-config flags for capstone... yes
checking for libz ... yes
checking for libzip ... yes
checking for libssl ... yes
Using PKGCONFIG: pkg-config
checking pkg-config flags for openssl... yes
checking for liblua5.1 ... no
creating ./config-user.mk
...
clang -dynamiclib -o libr_asm.dylib ... -arch x86_64 -L/opt/local/lib
-lcapstone
...
$ radare2
dyld: Library not loaded: libcapstone.3.dylib
Referenced from: /opt/local/lib/libr_asm.dylib
Reason: image not found
Trace/BPT trap: 5
$ otool -L /opt/local/lib/libr_asm.dylib
/opt/local/lib/libr_asm.dylib:
/opt/local/lib/libr_asm.dylib (compatibility version 0.0.0,
current version 0.0.0)
/opt/local/lib/libr_util.dylib (compatibility version 0.0.0,
current version 0.0.0)
/opt/local/lib/libr_parse.dylib (compatibility version 0.0.0,
current version 0.0.0)
/opt/local/lib/libr_db.dylib (compatibility version 0.0.0, current
version 0.0.0)
/opt/local/lib/libr_syscall.dylib (compatibility version 0.0.0,
current version 0.0.0)
/opt/local/lib/libr_lang.dylib (compatibility version 0.0.0,
current version 0.0.0)
libcapstone.3.dylib (compatibility version 3.0.0, current version
3.0.4)
/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current
version 1213.0.0)
$ DYLD_LIBRARY_PATH=/opt/local/lib radare2
Usage: r2 [-dDwntLqv] [-P patch] [-p prj] [-a arch] [-b bits] [-i file]
[-s addr] [-B blocksize] [-c cmd] [-e k=v] file|pid|-|--|=
$
}}}
Note that libcapstone is linked dynamically, but it has no directory path
in the `otool -L` output. Since it is not present in the directories that
are searched by default, it is not found at run time. However it is found
if `DYLD_LIBRARY_PATH` is set manually.
Without pkgconfig (works):
{{{
...
DEBUG: Executing command line: cd
"/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_devel_radare2/radare2/work/radare2-0.9.9"
&& ./configure --prefix=/opt/local --with-sysmagic --with-syscapstone
--with-syszip --with-compiler=clang --with-openssl
...
checking build system type... x86_64-unknown-darwin
checking host system type... x86_64-unknown-darwin
checking target system type... x86_64-unknown-darwin
checking for working directories... current
using prefix '/opt/local'
checking for c compiler... /usr/bin/clang
checking for dynamic library... required
checking host endianness... little
checking for libmagic ... yes
Using PKGCONFIG: pkg-config
checking pkg-config flags for capstone... no
checking for libz ... yes
checking for libzip ... yes
checking for libssl ... yes
Using PKGCONFIG: pkg-config
checking pkg-config flags for openssl... no
checking for liblua5.1 ... no
creating ./config-user.mk
...
if [ ! -d capstone ]; then \
git clone https://www.github.com/aquynh/capstone.git ; \
fi
Cloning into 'capstone'...
...
clang -dynamiclib -o libr_asm.dylib ... -arch x86_64
/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_devel_radare2/radare2/work/radare2-0.9.9/libr/../shlr/capstone/libcapstone.a
...
$ radare2
Usage: r2 [-dDwntLqv] [-P patch] [-p prj] [-a arch] [-b bits] [-i file]
[-s addr] [-B blocksize] [-c cmd] [-e k=v] file|pid|-|--|=
$ otool -L /opt/local/lib/libr_asm.dylib
/opt/local/lib/libr_asm.dylib:
/opt/local/lib/libr_asm.dylib (compatibility version 0.0.0,
current version 0.0.0)
/opt/local/lib/libr_util.dylib (compatibility version 0.0.0,
current version 0.0.0)
/opt/local/lib/libr_parse.dylib (compatibility version 0.0.0,
current version 0.0.0)
/opt/local/lib/libr_db.dylib (compatibility version 0.0.0, current
version 0.0.0)
/opt/local/lib/libr_syscall.dylib (compatibility version 0.0.0,
current version 0.0.0)
/opt/local/lib/libr_lang.dylib (compatibility version 0.0.0,
current version 0.0.0)
/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current
version 1213.0.0)
$
}}}
Note that capstone is obtained from git, and built and linked statically
(despite `--with-syscapstone`).
--
Ticket URL: <https://trac.macports.org/ticket/49625#comment:12>
MacPorts <https://www.macports.org/>
Ports system for OS X
More information about the macports-tickets
mailing list