Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Phashion v1.2.0 build failing on MacOS Ventura 13.3.1 #97

Open
dajabe opened this issue May 17, 2023 · 4 comments
Open

Phashion v1.2.0 build failing on MacOS Ventura 13.3.1 #97

dajabe opened this issue May 17, 2023 · 4 comments

Comments

@dajabe
Copy link

dajabe commented May 17, 2023

I'm setting up a intel based project and so I'm doing all this from a x86 shell and installed dependencies using the x86 version of homebrew.

I've done brew install imagemagick along with brew install libpng and brew install libjpeg

libpng was installed as dependancy of imagemagick along with turbo-jpeg which conflicts with libjpeg

It gave me these options during installation of libjpeg to work around this. which I have tried using but no dice.

Output from `brew install -v libjpeg`
i386 ❯ brew reinstall -v libjpeg
==> Fetching jpeg
==> Downloading https://ghcr.io/v2/homebrew/core/jpeg/manifests/9e
Already downloaded: /Users/djb/Library/Caches/Homebrew/downloads/2b2f8b288d01e487869928818a6967fa52e710e5480dcc149e6d5da6721ffb5e--jpeg-9e.bottle_manifest.json
==> Downloading https://ghcr.io/v2/homebrew/core/jpeg/blobs/sha256:60e8af1b1b966df8aa970865dd17930b67edd23e10d3c96495879030a3b6f5ee
Already downloaded: /Users/djb/Library/Caches/Homebrew/downloads/ccaa14808a5897831d431578327fe25a82a3a1adc16bbaaef06ccbe5bbc0a6ec--jpeg--9e.ventura.bottle.tar.gz
==> Verifying checksum for 'ccaa14808a5897831d431578327fe25a82a3a1adc16bbaaef06ccbe5bbc0a6ec--jpeg--9e.ventura.bottle.tar.gz'
==> Reinstalling jpeg
==> Pouring jpeg--9e.ventura.bottle.tar.gz
/usr/bin/env tar --extract --no-same-owner --file /Users/djb/Library/Caches/Homebrew/downloads/ccaa14808a5897831d431578327fe25a82a3a1adc16bbaaef06ccbe5bbc0a6ec--jpeg--9e.ventura.bottle.tar.gz --directory /private/tmp/d20230517-23546-11ogyu2
/usr/bin/env cp -pR /private/tmp/d20230517-23546-11ogyu2/jpeg/. /usr/local/Homebrew/Cellar/jpeg
==> Finishing up
==> Caveats
jpeg is keg-only, which means it was not symlinked into /usr/local/homebrew,
because it conflicts with `jpeg-turbo`.

If you need to have jpeg first in your PATH, run:
fish_add_path /usr/local/homebrew/opt/jpeg/bin

For compilers to find jpeg you may need to set:
set -gx LDFLAGS "-L/usr/local/homebrew/opt/jpeg/lib"
set -gx CPPFLAGS "-I/usr/local/homebrew/opt/jpeg/include"

For pkg-config to find jpeg you may need to set:
set -gx PKG_CONFIG_PATH "/usr/local/homebrew/opt/jpeg/lib/pkgconfig"
==> Summary
🍺  /usr/local/homebrew/Cellar/jpeg/9e: 21 files, 867.4KB
==> Running `brew cleanup jpeg`...
Disable this behaviour by setting HOMEBREW_NO_INSTALL_CLEANUP.
Hide these hints with HOMEBREW_NO_ENV_HINTS (see `man brew`).

I've tried forcing the linking of the library with these two commands but they didn't make any difference

> brew unlink libpng && brew link libpng
> brew link --overwrite libpng --force

When trying to compile the gem (CLI ouput here) I get the following mkmf.log.

mkmf.log output
  "xcrun clang -o conftest -I/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/include/ruby-2.6.0/universal-darwin22 -I/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/include/ruby-2.6.0/ruby/backward -I/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/include/ruby-2.6.0 -I. -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -D_DARWIN_UNLIMITED_SELECT -D_REENTRANT    -I/Library/Ruby/Gems/2.6.0/gems/phashion-1.2.0/ext/phashion_ext/include  -L/Library/Ruby/Gems/2.6.0/gems/phashion-1.2.0/ext/phashion_ext/lib -L/usr/local/lib  -x c++  conftest.c  -L. -L/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib -L/Library/Ruby/Gems/2.6.0/gems/phashion-1.2.0/ext/phashion_ext/lib  -L/Library/Ruby/Gems/2.6.0/gems/phashion-1.2.0/ext/phashion_ext/lib -L/usr/local/lib -L. -L/AppleInternal/Library/BuildRoots/97f6331a-ba75-11ed-a4bc-863efbbaf80d/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.3.Internal.sdk/usr/local/lib     -lruby.2.6   -lpthread -lpHash_gem -lstdc++ -ljpeg -lpng"
ld: warning: directory not found for option '-L/AppleInternal/Library/BuildRoots/97f6331a-ba75-11ed-a4bc-863efbbaf80d/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.3.Internal.sdk/usr/local/lib'
ld: library not found for -ljpeg
clang: error: linker command failed with exit code 1 (use -v to see invocation)
checked program was:
/* begin */
1: #include "ruby.h"
2:
3: int main(int argc, char **argv)
4: {
5:   return 0;
6: }
/* end */

This gives the main error I think is the problem here ld: library not found for -ljpeg

As far as I can see I've given the system this library and the information on how to find it so I'm a little stuck on what to do next. What am I missing here?

@dajabe
Copy link
Author

dajabe commented May 17, 2023

Just noted that there is a PR for M1 compatibility https://github.com/westonplatter/phashion/pull/85/files

Looking at the changes though I don't think this would affect my use case as my homebrew installation for this is located at /usr/local/Homebrew/ which is where it is put for the x86 install version. I also have an install of it located at /opt/homebrew/ which is my native ARM based version

just some extra context in case that's helpful.

@psyipm
Copy link

psyipm commented May 24, 2023

Hi! I'm having the same issue on M1 Mac (MacOS Monterey 12.5). I'm using gem "phashion", git: "https://github.com/westonplatter/phashion", branch: "master" 6a316ea.
Here is my mkmf.log:

DYLD_FALLBACK_LIBRARY_PATH=.:/Users/ipm/.rbenv/versions/3.1.2/lib "clang -o conftest -I/Users/ipm/.rbenv/versions/3.1.2/include/ruby-3.1.0/arm64-darwin21 -I/Users/ipm/.rbenv/versions/3.1.2/include/ruby-3.1.0/ruby/backward -I/Users/ipm/.rbenv/versions/3.1.2/include/ruby-3.1.0 -I. -I/Users/ipm/.rbenv/versions/3.1.2/include -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -D_DARWIN_UNLIMITED_SELECT -D_REENTRANT -I/Users/ipm/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/bundler/gems/phashion-6a316ea715d6/ext/phashion_ext/include -L/Users/ipm/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/bundler/gems/phashion-6a316ea715d6/ext/phashion_ext/lib -L/usr/local/lib -x c++ -fdeclspec conftest.c -L. -L/Users/ipm/.rbenv/versions/3.1.2/lib -L/Users/ipm/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/bundler/gems/phashion-6a316ea715d6/ext/phashion_ext/lib -L/Users/ipm/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/bundler/gems/phashion-6a316ea715d6/ext/phashion_ext/lib -L/usr/local/lib -L. -L/Users/ipm/.rbenv/versions/3.1.2/lib -fstack-protector-strong -lruby.3.1 -lpthread -lpHash_gem -lstdc++ -ljpeg -lpng -lm" ld: library not found for -ljpeg clang: error: linker command failed with exit code 1 (use -v to see invocation) checked program was: /* begin */ 1: #include "ruby.h" 2: 3: int main(int argc, char **argv) 4: { 5: return !!argv[argc]; 6: } /* end */

I've also tried adding

export PATH="/opt/homebrew/opt/jpeg/bin:$PATH"
export LDFLAGS="-L/opt/homebrew/opt/jpeg/lib"
export CPPFLAGS="-I/opt/homebrew/opt/jpeg/include"
export PKG_CONFIG_PATH="/opt/homebrew/opt/jpeg/lib/pkgconfig"

to my zshrc.
Am I missing something?

@hoangnguyenWP
Copy link

I'm still facing the same issue, any updates on this ? I can't reset my macbook and reinstall the whole homebrew in rosetta mode because I have multiple projects there

@dajabe
Copy link
Author

dajabe commented Sep 1, 2023

I found that I didn't need to use the rosetta version in the end and just needed to make the adjustments in this PR:

#99

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants