Discussion:
[MacPorts] #57688: radare2 @3.1.0_0: fails to build on macOS 10.12 Xcode 9.2
MacPorts
2018-11-27 06:53:56 UTC
Permalink
#57688: radare2 @3.1.0_0: fails to build on macOS 10.12 Xcode 9.2
----------------------+---------------------
Reporter: mopihopi | Owner: (none)
Type: defect | Status: new
Priority: Normal | Milestone:
Component: ports | Version:
Keywords: | Port: radare2
----------------------+---------------------
radare2 @3.1.0_0 fails to build on macOS 10.12.6 16G1618, Xcode 9.2 9C40b:
{{{
$ port outdated
The following installed ports are outdated:
radare2 3.0.1_0 < 3.1.0_0
$ sudo port upgrade radare2
---> Computing dependencies for radare2
---> Fetching archive for radare2
---> Attempting to fetch radare2-3.1.0_0+openssl.darwin_16.x86_64.tbz2
from https://packages.macports.org/radare2
---> Attempting to fetch radare2-3.1.0_0+openssl.darwin_16.x86_64.tbz2
from http://sea.us.packages.macports.org/macports/packages/radare2
---> Attempting to fetch radare2-3.1.0_0+openssl.darwin_16.x86_64.tbz2
from http://ywg.ca.packages.macports.org/mirror/macports/packages/radare2
---> Fetching distfiles for radare2
---> Verifying checksums for radare2
---> Extracting radare2
---> Configuring radare2
---> Building radare2
Error: Failed to build radare2: command execution failed
Error: See
/opt/local/var/macports/logs/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_devel_radare2/radare2/main.log
for details.
Error: Follow https://guide.macports.org/#project.tickets to report a bug.
$
}}}
main.log:
{{{
...
:info:build clang: warning: argument unused during compilation: '-pie'
[-Wunused-command-line-argument]
:info:build Undefined symbols for architecture x86_64:
:info:build "_ht_pp_foreach", referenced from:
:info:build _print_assembly_output in rasm2.o
:info:build ld: symbol(s) not found for architecture x86_64
:info:build clang: error: linker command failed with exit code 1 (use -v
to see invocation)
:info:build make[2]: *** [rasm2] Error 1
...
}}}
--
Ticket URL: <https://trac.macports.org/ticket/57688>
MacPorts <https://www.macports.org/>
Ports system for macOS
MacPorts
2018-11-27 06:54:22 UTC
Permalink
#57688: radare2 @3.1.0_0: fails to build on macOS 10.12 Xcode 9.2
-----------------------+--------------------
Reporter: mopihopi | Owner: (none)
Type: defect | Status: new
Priority: Normal | Milestone:
Component: ports | Version:
Resolution: | Keywords:
Port: radare2 |
-----------------------+--------------------
Changes (by mopihopi):

* Attachment "radare2-3.1.0_0.log" added.

main.log
--
Ticket URL: <https://trac.macports.org/ticket/57688>
MacPorts <https://www.macports.org/>
Ports system for macOS
MacPorts
2018-11-27 07:33:20 UTC
Permalink
#57688: radare2 @3.1.0_0: fails to build on macOS 10.12 Xcode 9.2
-----------------------+--------------------
Reporter: mopihopi | Owner: (none)
Type: defect | Status: new
Priority: Normal | Milestone:
Component: ports | Version:
Resolution: | Keywords:
Port: radare2 |
-----------------------+--------------------

Comment (by stevecheckoway):

That should be provided by `libr_util.dylib` which is in your the link
line (`-lr_util`). I wonder if your system has a different
`libr_util.dylib` that's getting picked up.

Can you try building and when it fails, change to the `binr/rasm2/`
directory and run

{{{
/usr/bin/clang -pipe -Os -arch x86_64 -MD -fPIC -g -Wall -D__UNIX__=1
-pie
-I/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_devel_radare2/radare2/work/radare2-3.1.0/libr/..//libr/include
rasm2.o -L.. -o rasm2 -L/opt/local/lib -Wl,-headerpad_max_install_names
-arch x86_64 -lpthread -lm
-L/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_devel_radare2/radare2/work/radare2-3.1.0/libr/asm
-L/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_devel_radare2/radare2/work/radare2-3.1.0/libr/parse
-L/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_devel_radare2/radare2/work/radare2-3.1.0/libr/syscall
-L/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_devel_radare2/radare2/work/radare2-3.1.0/libr/anal
-L/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_devel_radare2/radare2/work/radare2-3.1.0/libr/reg
-L/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_devel_radare2/radare2/work/radare2-3.1.0/libr/hash
-L/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_devel_radare2/radare2/work/radare2-3.1.0/libr/flag
-L/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_devel_radare2/radare2/work/radare2-3.1.0/libr/cons
-L/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_devel_radare2/radare2/work/radare2-3.1.0/libr/lang
-L/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_devel_radare2/radare2/work/radare2-3.1.0/libr/util
-L/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_devel_radare2/radare2/work/radare2-3.1.0/libr/search
-L/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_devel_radare2/radare2/work/radare2-3.1.0/libr/crypto
-lr_asm -lr_parse -lr_syscall -lr_anal -lr_reg -lr_hash -lr_flag -lr_cons
-lr_lang -lr_util -lr_search -lr_crypto -fPIC -lz -lzip -Wl,-t|grep
libr_util.dylib
}}}

which is the link line causing the error with `-Wl,-t|grep
libr_util.dylib` appended to it. It should print out
{{{
/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_devel_radare2/radare2/work/radare2-3.1.0/libr/util/libr_util.dylib
}}}

If not, then it's linking to the wrong library.
--
Ticket URL: <https://trac.macports.org/ticket/57688#comment:1>
MacPorts <https://www.macports.org/>
Ports system for macOS
MacPorts
2018-11-27 08:15:42 UTC
Permalink
#57688: radare2 @3.1.0_0: fails to build on macOS 10.12 Xcode 9.2
-----------------------+--------------------
Reporter: mopihopi | Owner: (none)
Type: defect | Status: new
Priority: Normal | Milestone:
Component: ports | Version:
Resolution: | Keywords:
Port: radare2 |
-----------------------+--------------------

Comment (by mopihopi):

It looks like it is trying to link with the installed version in
/opt/local/lib/libr_util.dylib (from radare2 3.0.1_0):

{{{
$ /usr/bin/clang -pipe -Os -arch x86_64 -MD -fPIC -g -Wall -D__UNIX__=1
-pie
-I/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_devel_radare2/radare2/work/radare2-3.1.0/libr/..//libr/include
rasm2.o -L.. -o rasm2 -L/opt/local/lib -Wl,-headerpad_max_install_names
-arch x86_64 -lpthread -lm
-L/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_devel_radare2/radare2/work/radare2-3.1.0/libr/asm
-L/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_devel_radare2/radare2/work/radare2-3.1.0/libr/parse
-L/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_devel_radare2/radare2/work/radare2-3.1.0/libr/syscall
-L/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_devel_radare2/radare2/work/radare2-3.1.0/libr/anal
-L/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_devel_radare2/radare2/work/radare2-3.1.0/libr/reg
-L/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_devel_radare2/radare2/work/radare2-3.1.0/libr/hash
-L/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_devel_radare2/radare2/work/radare2-3.1.0/libr/flag
-L/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_devel_radare2/radare2/work/radare2-3.1.0/libr/cons
-L/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_devel_radare2/radare2/work/radare2-3.1.0/libr/lang
-L/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_devel_radare2/radare2/work/radare2-3.1.0/libr/util
-L/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_devel_radare2/radare2/work/radare2-3.1.0/libr/search
-L/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_devel_radare2/radare2/work/radare2-3.1.0/libr/crypto
-lr_asm -lr_parse -lr_syscall -lr_anal -lr_reg -lr_hash -lr_flag -lr_cons
-lr_lang -lr_util -lr_search -lr_crypto -fPIC -lz -lzip -Wl,-t|grep
libr_util.dylib
clang: warning: argument unused during compilation: '-pie' [-Wunused-
command-line-argument]
Undefined symbols for architecture x86_64:
"_ht_pp_foreach", referenced from:
_print_assembly_output in rasm2.o
ld: symbol(s) not found for architecture x86_64
/opt/local/lib/libr_util.dylib
}}}

This is apparently because the command uses `-L/opt/local/lib` before
`-L/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_devel_radare2/radare2/work/radare2-3.1.0/libr/util`.
--
Ticket URL: <https://trac.macports.org/ticket/57688#comment:2>
MacPorts <https://www.macports.org/>
Ports system for macOS
MacPorts
2018-11-27 09:08:16 UTC
Permalink
#57688: radare2 @3.1.0_0: fails to build on macOS 10.12 Xcode 9.2
-----------------------+--------------------
Reporter: mopihopi | Owner: (none)
Type: defect | Status: new
Priority: Normal | Milestone:
Component: ports | Version:
Resolution: | Keywords:
Port: radare2 |
-----------------------+--------------------

Comment (by stevecheckoway):

I think this is a problem with radare2's build system. It's inserting
`LDFLAGS` too early into the link command. It's pretty easy to demonstrate
this.

{{{
#!/bin/sh
set -e

log() {
printf "\e[32;1m%s\e[0m\n" "$1"
}

log 'Cloning radare2'
git clone 'https://github.com/radare/radare2.git'

log 'Checking out 3.0.1'
cd radare2
git checkout 3.0.1

log 'Building 3.0.1'
./configure --prefix=/tmp/local
make

log 'Installing 3.0.1'
make install

log 'Cleaning and checking out 3.1.0'
make clean
git checkout 3.1.0

log 'Building 3.1.0 with LDFLAGS set'
LDFLAGS=-L/tmp/local/lib ./configure --prefix=/tmp/local
LDFLAGS=-L/tmp/local/lib make
}}}

I'll file a bug upstream but I'm not sure what the right workaround for
MacPorts is.
--
Ticket URL: <https://trac.macports.org/ticket/57688#comment:3>
MacPorts <https://www.macports.org/>
Ports system for macOS
MacPorts
2018-11-27 09:20:04 UTC
Permalink
#57688: radare2 @3.1.0_0: fails to build on macOS 10.12 Xcode 9.2
-----------------------+--------------------
Reporter: mopihopi | Owner: (none)
Type: defect | Status: new
Priority: Normal | Milestone:
Component: ports | Version:
Resolution: | Keywords:
Port: radare2 |
-----------------------+--------------------

Comment (by stevecheckoway):

Upstream bug filed. https://github.com/radare/radare2/issues/12335
--
Ticket URL: <https://trac.macports.org/ticket/57688#comment:4>
MacPorts <https://www.macports.org/>
Ports system for macOS
MacPorts
2018-11-27 14:42:35 UTC
Permalink
#57688: radare2 @3.1.0_0: fails to build on macOS 10.12 Xcode 9.2
-----------------------+----------------------
Reporter: mopihopi | Owner: g5pw
Type: defect | Status: assigned
Priority: Normal | Milestone:
Component: ports | Version:
Resolution: | Keywords:
Port: radare2 |
-----------------------+----------------------
Changes (by mf2k):

* cc: g5pw (removed)
* status: new => assigned
* owner: (none) => g5pw
--
Ticket URL: <https://trac.macports.org/ticket/57688#comment:5>
MacPorts <https://www.macports.org/>
Ports system for macOS
MacPorts
2018-12-01 03:23:19 UTC
Permalink
#57688: radare2 @3.1.0_0: fails to build if older version active
-----------------------+----------------------
Reporter: mopihopi | Owner: g5pw
Type: defect | Status: assigned
Priority: Normal | Milestone:
Component: ports | Version:
Resolution: | Keywords:
Port: radare2 |
-----------------------+----------------------

Comment (by mopihopi):

I was able to work around the error by cleaning and deactivating the old
version first.
--
Ticket URL: <https://trac.macports.org/ticket/57688#comment:6>
MacPorts <https://www.macports.org/>
Ports system for macOS
Loading...