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

Installation fails on Mac OS 13.1 with Ruby 3.1.3 and 3.2.0 #92

Open
rinconchris opened this issue Jan 26, 2023 · 13 comments
Open

Installation fails on Mac OS 13.1 with Ruby 3.1.3 and 3.2.0 #92

rinconchris opened this issue Jan 26, 2023 · 13 comments

Comments

@rinconchris
Copy link

rinconchris commented Jan 26, 2023

Rails 6.1 / Ruby 3.2 application using bundler to install Phashion. Note - This is an Intel based Mac
Also unable to install with Ruby 3.1.3.

Installed successfully a few weeks ago for a ruby 3.0 update (but was probably on Mac OS 12 then).

libjpeg version - stable 9d
libpng version - stable 1.6.37
imagemagick version - stable 7.0.11-14

Console output was 100's of lines long due to all the 'sprintf' deprecation warnings. Hopefully relevant info -

current directory: /Users/chris/.rvm/gems/ruby-3.2.0@apm-server/gems/phashion-1.2.0/ext/phashion_ext
/Users/chris/.rvm/rubies/ruby-3.2.0/bin/ruby -I /Users/chris/.rvm/rubies/ruby-3.2.0/lib/ruby/3.2.0 extconf.rb
tar xzf /Users/chris/.rvm/gems/ruby-3.2.0@apm-server/gems/phashion-1.2.0/ext/phashion_ext/pHash-0.9.6.tar.gz 2>&1
env CXXFLAGS=' -pthread' CFLAGS=' -I/Users/chris/.rvm/gems/ruby-3.2.0@apm-server/gems/phashion-1.2.0/ext/phashion_ext/include  -L/Users/chris/.rvm/gems/ruby-3.2.0@apm-server/gems/phashion-1.2.0/ext/phashion_ext/lib -L/usr/local/lib  -x c++ ' LDFLAGS=' -L/Users/chris/.rvm/gems/ruby-3.2.0@apm-server/gems/phashion-1.2.0/ext/phashion_ext/lib -L/usr/local/lib -L. -L/usr/local/opt/libyaml/lib -L/usr/local/opt/libksba/lib -L/usr/local/opt/readline/lib -L/usr/local/opt/zlib/lib -L/usr/local/opt/[email protected]/lib -fstack-protector-strong' ./configure --prefix=/Users/chris/.rvm/gems/ruby-3.2.0@apm-server/gems/phashion-1.2.0/ext/phashion_ext --disable-audio-hash --disable-video-hash --disable-shared --with-pic 2>&1
checking for a BSD-compatible install... /usr/local/bin/ginstall -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... /usr/local/bin/gmkdir -p
checking for gawk... no
checking for mawk... no
checking for nawk... no
checking for awk... awk
checking whether make sets $(MAKE)... yes
checking for g++... g++
checking whether the C++ compiler works... yes
checking for C++ compiler default output file name... a.out
checking for suffix of executables... 
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C++ compiler... yes
checking whether g++ accepts -g... yes
checking for style of include used by make... GNU
checking dependency style of g++... gcc3
checking for gcc... gcc
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... unsupported
checking dependency style of gcc... gcc3
checking for /etc/gentoo-release... no
checking for /etc/redhat-release... no
checking for /etc/slackware-version... no
checking for /etc/debian_version... no
checking for /etc/SuSErelease... no
checking build system type... i386-apple-darwin22.2.0
checking host system type... i386-apple-darwin22.2.0
checking for the pthreads library -lpthreads... no
checking whether pthreads work without any flags... yes
checking for joinable pthread attribute... PTHREAD_CREATE_JOINABLE
checking if more special flags are required for pthreads... -D_THREAD_SAFE
checking how to run the C preprocessor... gcc -E
checking for grep that handles long lines and -e... /usr/bin/grep
checking for egrep... /usr/bin/grep -E
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking whether ln -s works... yes
checking how to print strings... printf
checking for a sed that does not truncate output... /usr/bin/sed
checking for fgrep... /usr/bin/grep -F
checking for ld used by gcc... /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld
checking if the linker (/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld) is GNU ld... no
checking for BSD- or MS-compatible name lister (nm)... /usr/bin/nm -B
checking the name lister (/usr/bin/nm -B) interface... BSD nm
checking the maximum length of command line arguments... 786432
checking whether the shell understands some XSI constructs... yes
checking whether the shell understands "+="... yes
checking how to convert i386-apple-darwin22.2.0 file names to i386-apple-darwin22.2.0 format... func_convert_file_noop
checking how to convert i386-apple-darwin22.2.0 file names to toolchain format... func_convert_file_noop
checking for /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld option to reload object files... -r
checking for objdump... objdump
checking how to recognize dependent libraries... pass_all
checking for dlltool... no
checking how to associate runtime and link libraries... printf %s\n
checking for ar... ar
checking for archiver @FILE support... no
checking for strip... strip
checking for ranlib... ranlib
checking command to parse /usr/bin/nm -B output from gcc object... ok
checking for sysroot... no
checking for mt... no
checking if : is a manifest tool... no
checking for dsymutil... dsymutil
checking for nmedit... nmedit
checking for lipo... lipo
checking for otool... otool
checking for otool64... no
checking for -single_module linker flag... yes
checking for -exported_symbols_list linker flag... yes
checking for -force_load linker flag... yes
checking for dlfcn.h... yes
checking for objdir... .libs
checking if gcc supports -fno-rtti -fno-exceptions... yes
checking for gcc option to produce PIC... -fno-common -DPIC
checking if gcc PIC flag -fno-common -DPIC works... yes
checking if gcc static flag -static works... no
checking if gcc supports -c -o file.o... yes
checking if gcc supports -c -o file.o... (cached) yes
checking whether the gcc linker (/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld) supports shared libraries... yes
checking dynamic linker characteristics... darwin22.2.0 dyld
checking how to hardcode library paths into programs... immediate
checking whether stripping libraries is possible... yes
checking if libtool supports shared libraries... yes
checking whether to build shared libraries... no
checking whether to build static libraries... yes
checking how to run the C++ preprocessor... g++ -E
checking for ld used by g++... /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld
checking if the linker (/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld) is GNU ld... no
checking whether the g++ linker (/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld) supports shared libraries... yes
checking for g++ option to produce PIC... -fno-common -DPIC
checking if g++ PIC flag -fno-common -DPIC works... yes
checking if g++ static flag -static works... no
checking if g++ supports -c -o file.o... yes
checking if g++ supports -c -o file.o... (cached) yes
checking whether the g++ linker (/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld) supports shared libraries... yes
checking dynamic linker characteristics... darwin22.2.0 dyld
checking how to hardcode library paths into programs... immediate

*** Configuring image hash ***

checking CImg.h usability... no
checking CImg.h presence... no
checking for CImg.h... no
checking whether CImg.h is in the current or src directory.... yes
checking for png_create_read_struct in -lpng... yes
checking for jpeg_read_header in -ljpeg... yes
checking for fftw_plan_dft_r2c_1d in -lfftw3... no
checking for size_t... yes
checking for uint32_t... yes
checking for uint8_t... yes
checking for uint64_t... yes
checking that generated files are newer than configure... done
configure: creating ./config.status
config.status: creating Makefile
config.status: creating src/Makefile
config.status: creating examples/Makefile
config.status: creating pHash.pc
config.status: creating bindings/Makefile
config.status: creating bindings/java/Makefile
config.status: creating config.h
config.status: creating pHash-config.h
config.status: executing depfiles commands
config.status: executing libtool commands
make || true 2>&1
/Applications/Xcode.app/Contents/Developer/usr/bin/make  all-recursive
Making all in src
/bin/sh ../libtool --tag=CXX   --mode=compile g++ -DHAVE_CONFIG_H -I. -I..   -D_THREAD_SAFE -I/usr/local/include -Dcimg_use_png -Dcimg_use_jpeg  -pthread -ffast-math -O3 -MT pHash.lo -MD -MP -MF .deps/pHash.Tpo -c -o pHash.lo pHash.cpp
libtool: compile:  g++ -DHAVE_CONFIG_H -I. -I.. -D_THREAD_SAFE -I/usr/local/include -Dcimg_use_png -Dcimg_use_jpeg -pthread -ffast-math -O3 -MT pHash.lo -MD -MP -MF .deps/pHash.Tpo -c pHash.cpp  -fno-common -DPIC -o pHash.o
In file included from pHash.cpp:25:
In file included from ./pHash.h:50:
../CImg.h:2160:44: warning: shifting a negative signed value is undefined [-Wshift-negative-value]
      static char min() { return (char)(-1L<<(8*sizeof(char)-1)); }
                                        ~~~^
../CImg.h:2161:46: warning: shifting a negative signed value is undefined [-Wshift-negative-value]
      static char max() { return ~((char)(-1L<<(8*sizeof(char)-1))); }
                                          ~~~^
../CImg.h:2171:58: warning: shifting a negative signed value is undefined [-Wshift-negative-value]
      static signed char min() { return (signed char)(-1L<<(8*sizeof(signed char)-1)); }
                                                      ~~~^
../CImg.h:2172:60: warning: shifting a negative signed value is undefined [-Wshift-negative-value]
      static signed char max() { return ~((signed char)(-1L<<(8*sizeof(signed char)-1))); }
                                                        ~~~^
../CImg.h:2193:46: warning: shifting a negative signed value is undefined [-Wshift-negative-value]
      static short min() { return (short)(-1L<<(8*sizeof(short)-1)); }
                                          ~~~^
../CImg.h:2194:48: warning: shifting a negative signed value is undefined [-Wshift-negative-value]
      static short max() { return ~((short)(-1L<<(8*sizeof(short)-1))); }
                                            ~~~^
../CImg.h:2215:42: warning: shifting a negative signed value is undefined [-Wshift-negative-value]
      static int min() { return (int)(-1L<<(8*sizeof(int)-1)); }
                                      ~~~^
../CImg.h:2216:44: warning: shifting a negative signed value is undefined [-Wshift-negative-value]
      static int max() { return ~((int)(-1L<<(8*sizeof(int)-1))); }
                                        ~~~^
../CImg.h:2237:44: warning: shifting a negative signed value is undefined [-Wshift-negative-value]
      static long min() { return (long)(-1L<<(8*sizeof(long)-1)); }
                                        ~~~^
../CImg.h:2238:46: warning: shifting a negative signed value is undefined [-Wshift-negative-value]
      static long max() { return ~((long)(-1L<<(8*sizeof(long)-1))); }
                                          ~~~^
../CImg.h:4982:12: warning: 'sprintf' is deprecated: This function is provided for compatibility reasons only.  Due to security concerns inherent in the design of sprintf(3), it is highly recommended that you use snprintf(3) instead. [-Wdeprecated-declarations]
      std::sprintf(string,format,number);


…….and then about 1000 lines about how sprintf is deprecated……

                                                      ^
54 warnings generated.
linking shared-object phashion_ext.bundle
Undefined symbols for architecture x86_64:
  "_sqlite3_create_function", referenced from:
      _sqlite3_extension_init in phashion_ext.o
  "_sqlite3_result_int", referenced from:
      hamming_distance(sqlite3_context*, int, sqlite3_value**) in phashion_ext.o
  "_sqlite3_value_int64", referenced from:
      hamming_distance(sqlite3_context*, int, sqlite3_value**) in phashion_ext.o
  "_sqlite3_value_type", referenced from:
      hamming_distance(sqlite3_context*, int, sqlite3_value**) in phashion_ext.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [phashion_ext.bundle] Error 1

make failed, exit code 2

Any suggestions appreciated!

@rinconchris rinconchris changed the title Installation fails on Mac OS 13.1 Installation fails on Mac OS 13.1 with Ruby 3.1.3 and 3.2.0 Jan 27, 2023
@miguel-heredia
Copy link

Did you fix this? I'm having the same problem and didn't find a way to solve it yet.

@Borjarguez
Copy link

I'm having the same problem but on Mac OS 13.1 with Ruby 2.7.3

@rinconchris
Copy link
Author

Haven't done much more since posting this issue. This pull request 6b7ca56 makes me believe some updates are needed within the gem itself.

@westonplatter
Copy link
Owner

@rinconchris I saw your installed libpng and libjpeg. Did you also install sqlite3?

@rinconchris
Copy link
Author

@westonplatter yes I have sqlite3 installed

@ilnurnasyrov-st
Copy link

having the same problem with Mac OS 13.2.1, ruby 2.7.6p219

@Sarasatory
Copy link

Hello.

I have the same problem, with Ruby 2.7.3 and macOS 13.2.1.
Do you know if there is a solution or will there be soon?

Thank you!

@westonplatter
Copy link
Owner

I don't know what's causing the core issue.

I would guess the sqlite3 logic introduced in 98f22a4 is no longer compatible with sqlite3 apis, but that might be a decoy lurking problem that's yet to be identified.

Any help from the community to resolve this would be greatly appreciated!

@viglesias
Copy link

We have resolved the issue by making the following change:
master...viglesias:phashion:master
So if you let us, we can do a PR with this change.

@viglesias
Copy link

viglesias commented Jun 8, 2023

We removed /opt/homebrew
After that we installed with Rosseta
libjpeg -> brew install jpeg
imagemagick -> brew install imagemagick

The problems were solved.

@rinconchris
Copy link
Author

I came back to this and was able to build successfully on Mac OS 14.0 + ruby 3.1.4.

@jslag
Copy link

jslag commented Jan 3, 2024

I am also seeing the error linking sqlite3. Macos 14.2.1, ruby 3.1.4. All relevant brew code reinstalled.

@jslag
Copy link

jslag commented Jan 5, 2024

I don't know what's causing the core issue.

I would guess the sqlite3 logic introduced in 98f22a4 is no longer compatible with sqlite3 apis, but that might be a decoy lurking problem that's yet to be identified.

Any help from the community to resolve this would be greatly appreciated!

I did confirm that the gem builds if the have_header line from that commit is commented out: jslag@33b75ae

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

8 participants