BinaryAnalysisPlatform/bap

Failed BAP installation

Closed this issue · 3 comments

Hi, fellows. I was trying to install BAP on a MAC device. But I encountered such a problem when using opam to install the bap tool. The error infos are as follows:

warning: object file (/Users/guest/.opam/bap-installation/lib/ocaml/stdlib.a(stdlib__random.o)) was built for newer macOS version (10.17) than being linked (10.15.6)
# ld: warning: object file (/Users/guest/.opam/bap-installation/lib/ocaml/stdlib.a(stdlib__scanf.o)) was built for newer macOS version (10.17) than being linked (10.15.6)
# ld: warning: object file (/Users/guest/.opam/bap-installation/lib/ocaml/stdlib.a(stdlib__seq.o)) was built for newer macOS version (10.17) than being linked (10.15.6)
# ld: warning: object file (/Users/guest/.opam/bap-installation/lib/ocaml/unix.a(unix.o)) was built for newer macOS version (10.17) than being linked (10.15.6)
# make: *** [build] Error 1

<><> Error report <><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><>
+- The following actions failed
| - build bap-std 2.4.0
+- 
- No changes have been performed

So when I first encountered the warning, I thought it was because the MacOS version of my local machine. So I updated the OS to the latest version. But still the error happens. How can I solve this kind of problem? Looking forward to your guidance. Really appreciate for any constructive advice.

ivg commented

TL;DR; reinstall bap from a fresh new switch,

opam switch create bap --comp=4.12.1 # where bap is a name for the fresh new opam switch
opam install bap

Longer story. It looks like you first installed OCaml, then updated your macOS, and the installed bap. And during the update macOS broke ABI so you have to rebuild any files built with the older version. Upgrading macOS made things even worse so that old build artifacts became even older, since upgrading macOS will not rebuild any files in your opam installation.

ivg commented

@Troy-Cao, feel free to re-open the issue or drop by Gitter if you still have any problems.

[ERROR] The compilation of bap-std.2.4.0 failed at "make".

#=== ERROR while compiling bap-std.2.4.0 ======================================#

context 2.1.2 | macos/x86_64 | ocaml-base-compiler.4.12.1 | https://opam.ocaml.org#146d34e8

path ~/.opam/bap/.opam-switch/build/bap-std.2.4.0

command ~/.opam/opam-init/hooks/sandbox.sh build make

exit-code 2

env-file ~/.opam/log/bap-std-29512-ab7118.env

output-file ~/.opam/log/bap-std-29512-ab7118.out

output

[...]

ld: warning: object file (/Users/yannangao/.opam/bap/lib/ocaml/stdlib.a(stdlib__random.o)) was built for newer macOS version (10.17) than being linked (10.15.6)

ld: warning: object file (/Users/yannangao/.opam/bap/lib/ocaml/stdlib.a(stdlib__scanf.o)) was built for newer macOS version (10.17) than being linked (10.15.6)

ld: warning: object file (/Users/user_1/.opam/bap/lib/ocaml/stdlib.a(stdlib__seq.o)) was built for newer macOS version (10.17) than being linked (10.15.6)

ld: warning: object file (/Users/user_1/.opam/bap/lib/ocaml/stdlib.a(stdlib__set.o)) was built for newer macOS version (10.17) than being linked (10.15.6)

ld: warning: object file (/Users/user_1/.opam/bap/lib/ocaml/stdlib.a(stdlib__stack.o)) was built for newer macOS version (10.17) than being linked (10.15.6)

ld: warning: object file (/Users/user_1/.opam/bap/lib/ocaml/stdlib.a(stdlib__stream.o)) was built for newer macOS version (10.17) than being linked (10.15.6)

ld: warning: object file (/Users/user_1/.opam/bap/lib/ocaml/stdlib.a(stdlib__string.o)) was built for newer macOS version (10.17) than being linked (10.15.6)

ld: warning: object file (/Users/user_1/.opam/bap/lib/ocaml/stdlib.a(stdlib__sys.o)) was built for newer macOS version (10.17) than being linked (10.15.6)

ld: warning: object file (/Users/user_1/.opam/bap/lib/ocaml/stdlib.a(stdlib__uchar.o)) was built for newer macOS version (10.17) than being linked (10.15.6)

ld: warning: object file (/Users/user_1/.opam/bap/lib/ocaml/unix.a(unixLabels.o)) was built for newer macOS version (10.17) than being linked (10.15.6)

ld: warning: object file (/Users/user_1/.opam/bap/lib/ocaml/unix.a(unix.o)) was built for newer macOS version (10.17) than being linked (10.15.6)

make: *** [build] Error 1

<><> Error report <><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><>
+- The following actions failed
| - build bap-std 2.4.0
+-

Hi, Ivg @ivg. Same problem when I created a new switch and tried to install bap in that switch.