facebookresearch / CompilerGym

Reinforcement learning environments for compiler and program optimization tasks
https://compilergym.ai/
MIT License
896 stars 125 forks source link

macOS: Homebrew packages can interfere with C++ compilation #31

Open ChrisCummins opened 3 years ago

ChrisCummins commented 3 years ago

🐛 Bug

When boost or protobuf packages are installed via homebrew they can interfere with the CompilerGym build, causing compile-time or load-time errors.

To Reproduce

Steps to reproduce the behavior:

  1. brew install boost
  2. make distclean
  3. bazel run //compiler_gym/envs/llvm/service

Error message along the lines of:

dyld: lazy symbol binding failed: Symbol not found: __ZN5boost10filesystem6detail38recursive_directory_iterator_constructERNS0_28recursive_directory_iteratorERKNS0_4pathEjPNS_6system10error_codeE
  Referenced from: /private/var/tmp/_bazel_user/path/to/CompilerGym/compiler_gym/envs/llvm/service/service
  Expected in: flat namespace

Workaround

Uninstall boost prior to building CompilerGym:

  1. brew uninstall --ignore-dependencies protobuf boost
  2. make distclean
  3. Run your build command, e.g. make install

This package conflict only matters at build time. Once you are done building CompilerGym, you can now reinstall the brew packages:

brew install protobuf boost

Environment

ChrisCummins commented 3 years ago

This issue has been replicated using the homebrew protobuf package, although with different symptoms. The workaround is the same:

brew uninstall protobuf
make distclean
make test  # or whatever build command failed