Linking against LLVM and conflicting with system mesa

Hi all!

I’m stumped. I’m a contributor to an Open Source PS3 emulator. We use LLVM to pre-compile the code, instead of just interpreting it at runtime like most emulators do. Website here: https://github.com/RPCS3/rpcs3/

We currently have support for Windows, Linux and BSD. Currently, we only provide builds for Windows users, and are interested in providing builds for linux users via AppImages.

The problem is that we use OpenGL or Vulkan to render the graphics, and if the driver is using Mesa, Mesa tries to bring along LLVM, and then we get a nasty “CommandLine Error: Option ‘help-list’ registered more than once!”

We previously just linked LLVM statically, and to remedy the error mentioned above, we just switched to linking LLVM dynamically.

This starts getting messy when we start sending out binaries. Most distros ares still stuck on LLVM 3.x, and we’re using LLVM 4. If we just package the LLVM 4 libs with the binary, then mesa tries to load 3.x and llvm tries to load 4.x. Not good.

The only solution we’ve come up with is to provide a modified version of LLVM with the binary build that somehow hides itself. Can anyone show me what code I would need to modify in order to make this work?
If you do have a better solution, please mention it.

Thanks, Zion Nimchuk

What we do to avoid this problem is rename the lib to something else. No system conflict and problem averted. It should be a trivial cmake change.