VUEngine / VUEngine-Studio

Full-featured Nintendo Virtual Boy game development application.
https://www.vuengine.dev
MIT License
33 stars 4 forks source link

[macOS] Library not loaded: /usr/local/gcc-8.2/lib/libmpc.3.dylib #86

Closed agg23 closed 1 month ago

agg23 commented 1 month ago

Fresh install of VUEngine Studio on macOS results in the following error when attempting to build. brew install libmpc does not fix the issue

dyld[78710]: Library not loaded: /usr/local/gcc-8.2/lib/libmpc.3.dylib
Referenced from: <3F3AE7BB-AD6A-328B-9DE0-81DEFD80F863> /Applications/VUEngine.app/Contents/Resources/app/binaries/vuengine-studio-tools/osx/gcc/libexec/gcc/v810/4.7.4/cc1
Reason: tried: '/usr/local/gcc-8.2/lib/libmpc.3.dylib' (no such file), '/System/Volumes/Preboot/Cryptexes/OS/usr/local/gcc-8.2/lib/libmpc.3.dylib' (no such file), '/usr/local/gcc-8.2/lib/libmpc.3.dylib' (no such file), '/usr/local/lib/libmpc.3.dylib' (no such file), '/usr/lib/libmpc.3.dylib' (no such file, not in dyld cache)

This is building a libgccvb project.

agg23 commented 1 month ago

As a quick workaround, I attempted to symlink to the homebrew installed version of libmpc

sudo ln -s /opt/homebrew/lib/libmpc.3.dylib /usr/local/lib/libmpc.3.dylib

but that results in an arch compatibility error, as gcc was compiled for x86-64 only, and I am running on a aarch64 machine.

'/usr/local/lib/libmpc.3.dylib' (mach-o file, but is an incompatible architecture (have 'arm64', need 'x86_64')
KR155E commented 1 month ago

Hey @agg23! Have you tried installing the x86_64 version of libmpc according to https://www.vuengine.dev/documentation/setup/installation/#apple-silicon-arm?

agg23 commented 1 month ago

That worked, thank you. Sorry, I didn't realize there was a separate installation page; it's a bit unexpected due to the "Download" buttons on the main page and the tendency for macOS apps to not need installation (though obviously you do provide an Installer package).

Is there a reason a x86 version of libmpc isn't included in the distribution? You're already distributing gcc.

KR155E commented 1 month ago

Good to hear that it's working now!

It is a bit unfortunate, indeed, that libmpc is not included in our gcc build. But, from my understanding, it would have to have been bundled at build time and can not be included after the fact. While it would be amazing to have a build of the latest version of https://github.com/jbrandwood/v810-gcc, with bundled libs, building gcc is quite the nightmare, and we are not keen on going through that again right now. 🥴

agg23 commented 1 month ago

I don't know if this is the right thing to do, but I believe you can augment the envvar LD_LIBRARY_PATH used in your GCC command to contain your directory with your bundled libmpc. It doesn't have to be in the system path.

KR155E commented 1 month ago

Thought so, too, so I tried this and a ton of other different things last night, from messing with various env vars to gcc parameters to even hex editing the "/usr/local/gcc-8.2/lib/libmpc.3.dylib" path in cc1. Unfortunately, nothing worked.