FiloSottile / homebrew-musl-cross

Homebrew Formula for static-friendly musl-based GCC macOS-to-Linux cross-compilers
https://blog.filippo.io/easy-windows-and-linux-cross-compilers-for-macos/
ISC License
547 stars 45 forks source link

Bottled version doesn't work because of libisl #8

Closed rasky closed 5 years ago

rasky commented 6 years ago

Running the bottled version, I get:

dyld: Library not loaded: @@HOMEBREW_PREFIX@@/opt/isl/lib/libisl.15.dylib
  Referenced from: /usr/local/Cellar/musl-cross/0.9.7/libexec/bin/../libexec/gcc/x86_64-linux-musl/6.3.0/cc1
  Reason: image not found
x86_64-linux-musl-gcc: internal compiler error: Abort trap: 6 (program cc1)

It looks like cc1 has a dependency on libisl:

otool -L ../libexec/libexec/gcc/x86_64-linux-musl/6.3.0/cc1
../libexec/libexec/gcc/x86_64-linux-musl/6.3.0/cc1:
    /usr/lib/libiconv.2.dylib (compatibility version 7.0.0, current version 7.0.0)
    @@HOMEBREW_PREFIX@@/opt/isl/lib/libisl.15.dylib (compatibility version 19.0.0, current version 19.0.0)
    /usr/lib/libc++.1.dylib (compatibility version 1.0.0, current version 400.9.0)
    /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1252.0.0)

libisl wasn't installed automatically because its not declared as a dependency. Also, Hombrew now has libisl.19, not .15, so it doesn't work even if I try to install it.

stek29 commented 6 years ago
brew install isl
install_name_tool -change '@@HOMEBREW_PREFIX@@/opt/isl/lib/libisl.15.dylib' /usr/local/opt/isl/lib/libisl.dylib /usr/local/opt/musl-cross/libexec/libexec/gcc/x86_64-linux-musl/6.3.0/cc1
install_name_tool -change '@@HOMEBREW_PREFIX@@/opt/isl/lib/libisl.15.dylib' /usr/local/opt/isl/lib/libisl.dylib /usr/local/opt/musl-cross/libexec/libexec/gcc/x86_64-linux-musl/6.3.0/cc1plus
install_name_tool -change '@@HOMEBREW_PREFIX@@/opt/isl/lib/libisl.15.dylib' /usr/local/opt/isl/lib/libisl.dylib /usr/local/opt/musl-cross/libexec/libexec/gcc/x86_64-linux-musl/6.3.0/lto1
jackdoerner commented 5 years ago

There seems to be a similar/identical issue preventing compilation of the non-bottled version on the current release of high sierra. Using the bottle plus the previous comment is a workaround, but so far as I can tell it doesn't help if you need ARM support.

FiloSottile commented 5 years ago

Apparently, this issue is handled in upstream Homebrew by bumping the formula revision when the dependency bumps the dylib major version. See Homebrew/legacy-homebrew#12190 (unless something changed since).

However, linking the system ISL is suspect when all other libraries are linked from the musl-cross-make tree. Turns out that ISL is the only thing that by default is linked opportunistically.

https://github.com/richfelker/musl-cross-make/blob/5dd1a49567567c1eada595dbceff7672a1855792/config.mak.dist#L28-L31

I'll just make the ISL version explicit and link in tree.

FiloSottile commented 5 years ago

Should be fixed if you brew upgrade musl-cross!