BinaryAnalysisPlatform / bap

Binary Analysis Platform
MIT License
2.04k stars 271 forks source link

Compatibility for /lib64 suffix #1594

Open redin0s opened 11 months ago

redin0s commented 11 months ago

I was trying to build bap from source and I encountered an error when building. Specifically in tools/rewrite.ml there is an issue when the ocaml library is present in the path /usr/lib64/ocaml and the following instruction raises an error.

String.chop_suffix_exn stdlib "/lib/ocaml"

I have attempted a naive fix by modifying the code.

let prefix =
  let stdlib = Cfg.ocaml_config_var_exn self "standard_library" in
  (
  try
      String.chop_suffix_exn stdlib "/lib/ocaml"
  with
  | exn ->
      String.chop_suffix_exn stdlib "/lib64/ocaml"
  ) in

I have not submitted a pull request since I don't really know if this is the standard way of dealing with this things in ocaml as it is my first time using.

ivg commented 6 months ago

Support for dune is still in the experimental stage. And indeed, I didn't consider that there could be another suffix. I think a better option here would be to chop two last path elements. A PR would be welcome, otherwise I will try to find some time to fix it. Thanks for reporting!