Opened 6 years ago

Last modified 6 years ago

#57688 assigned defect

radare2 @3.1.0_0: fails to build if older version active

Reported by: mopihopi Owned by: g5pw (Aljaž Srebrnič)
Priority: Normal Milestone:
Component: ports Version:
Keywords: Cc: stevecheckoway (Stephen Checkoway)
Port: radare2

Description

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
...

Attachments (1)

radare2-3.1.0_0.log (851.6 KB) - added by mopihopi 6 years ago.
main.log

Download all attachments as: .zip

Change History (8)

Changed 6 years ago by mopihopi

Attachment: radare2-3.1.0_0.log added

main.log

comment:1 Changed 6 years ago by stevecheckoway (Stephen Checkoway)

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.

comment:2 Changed 6 years ago 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.

comment:3 Changed 6 years ago by stevecheckoway (Stephen Checkoway)

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.

comment:4 Changed 6 years ago by stevecheckoway (Stephen Checkoway)

comment:5 Changed 6 years ago by mf2k (Frank Schima)

Cc: g5pw removed
Owner: set to g5pw
Status: newassigned

comment:6 Changed 6 years ago by mopihopi

Summary: radare2 @3.1.0_0: fails to build on macOS 10.12 Xcode 9.2radare2 @3.1.0_0: fails to build if older version active

I was able to work around the error by cleaning and deactivating the old version first.

comment:7 Changed 6 years ago by stevecheckoway (Stephen Checkoway)

I just noticed that poppler refuses to build if one is currently active. I think

conflicts_build ${name}

is what causes MacPorts to print the error message. I don't have time right now to test this, but this may be a reasonable work around until upstream fixes their bug.

Note: See TracTickets for help on using tickets.