Installing ruby but getting error "linker command failed with exit code 1" - ruby

I'm building a GitHub Pages site and trying to install Ruby for my Mac as described here. When I run ruby-install ruby , I get the following:
linking shared-object -test-/arith_seq/extract.bundle
Undefined symbols for architecture arm64:
"_rb_arithmetic_sequence_extract", referenced from:
_arith_seq_s_extract in extract.o
"_rb_ary_new_capa", referenced from:
_arith_seq_s_extract in extract.o
"_rb_ary_store", referenced from:
_arith_seq_s_extract in extract.o
"_rb_define_singleton_method", referenced from:
_Init_extract in extract.o
"_rb_path2class", referenced from:
_Init_extract in extract.o
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[2]: *** [../../../../.ext/arm64-darwin22/-test-/arith_seq/extract.bundle] Error 1
make[1]: *** [ext/-test-/arith_seq/extract/all] Error 2
make: *** [build-ext] Error 2
!!! Compiling ruby 3.1.2 failed!
I'm totally unfamiliar with Ruby and don't know how to make any sense of this. Any ideas? Thanks

I was running into same issue as you after following the Jekyll guide.
Christian from your comments supplied a very detailed solution and explanation as to what's caused it.
After updating to macOS 12.6 or 13.0, you might still be able to install 2.7.x and 3.x versions of Ruby with rbenv or asdf. With ruby-install, you’ll need to add the --enable-shared flag. Once 2.7.7 and 3.1.3 are released, you should no longer need to add any flags.
Install for me on Mac OS 12.6 worked with ruby-install 3.1.2 -- --enable-shared

Related

sqlite3 install issues on mac os sierra

Hi I am very new at what im doing here. I have tried following a couple different install guides for installing ruby on rails and seem to get stuck at the same point each time and it has to do with sqlite3 it gives me an error message that looks like this. I don't know how to uninstall it so I can try to start over and do it again. Error message is below
An error occurred while installing sqlite3 (1.3.5), and Bundler cannot continue.
Make sure that gem install sqlite3 -v '1.3.5' succeeds before bundling
I encountered the same error. In opening the mkmf.log file There were lines like these:
ld: warning: ignoring file /usr/local/opt/sqlite/lib/libsqlite3.dylib, file was built for x86_64 which is not the architecture being linked (i386): /usr/local/opt/sqlite/lib/libsqlite3.dylib
Undefined symbols for architecture i386:
"_sqlite3_libversion_number", referenced from:
_t in conftest-265d8e.o
ld: symbol(s) not found for architecture i386
ld: warning: ignoring file /usr/local/opt/sqlite/lib/libsqlite3.a, file was built for x86_64 which is not the architecture being linked (i386): /usr/local/opt/sqlite/lib/libsqlite3.a
Undefined symbols for architecture i386:
"_sqlite3_libversion_number", referenced from:
_t in conftest-265d8e.o
ld: symbol(s) not found for architecture i386
I just removed the two files to solve the problem.
rm /usr/local/opt/sqlite/lib/libsqlite3.a
rm /usr/local/opt/sqlite/lib/libsqlite3.dylib

Failed to add Firebase Database.framework without Cocoapods

I'm trying to add firebase's Database.framework without Cocoapods, but have compilation error
Undefined symbols for architecture arm64:
"_kFIRDefaultAppName", referenced from:
+[FIRDatabase databaseForApp:] in FirebaseDatabase(FIRDatabase.o)
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
error
Does anyone know which framework I should add too? Thanks
So from this question Use of unresolved identifier 'FIRDatabase' when using Firebase , I can see that FirebaseDatabase depends on FirebaseAnalytics. After add all FirebaseAnalytics framework into the project, everthing works as expected. Hope this helps others too

"Undefined symbols for architecture x86_64:"

I am attempting to compile this library on mac os x Mavericks 10.9.3 64-bit: http://www.openfec.org/downloads.html
I followed the README exactly, and got this error:
Linking C shared library ../../bin/Release/libopenfec.dylib
Undefined symbols for architecture x86_64:
"_of_add_from_multiple_symbols", referenced from:
_of_linear_binary_code_backward_substitution in of_ml_tool.c.o
"_of_add_to_symbol", referenced from:
_of_linear_binary_code_decode_with_new_symbol in of_it_decoding.c.o
_of_linear_binary_code_simplify_linear_system in of_ml_decoding.c.o
_of_linear_binary_code_col_forward_elimination_pivot_reordering in of_ml_tool.c.o
_of_linear_binary_code_apply_gauss_pivoting in of_ml_tool_2.c.o
_of_linear_binary_code_inject_symbol_in_triangular_system in of_ml_tool_2.c.o
_of_linear_binary_code_solve_triangular_system in of_ml_tool_2.c.o
_of_linear_binary_code_invert_dense_system in of_ml_tool_2.c.o
...
"_of_calloc", referenced from...:
...
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[2]: * [../bin/Release/libopenfec.dylib] Error 1
make[1]: * [src/CMakeFiles/openfec.dir/all] Error 2
make: *** [all] Error 2
I simply followed the README for OpenFEC's distro (found at http://www.openfec.org/downloads.html). When attempting to make, this error arises.
I have no idea what the problem is.
This is what I did after untarring the distribution:
(1.): mkdir build
(2.): cd build
(3.): cmake .. -DDEBUG:STRING=OFF
(4.): make
Any ideas?
Edit: Attempted to force cmake to use 64-bit, still didn't work.
(Tried to force it into 32-bit just for kicks, also didn't work)
FYI, if this wasn't resolved. Check that you're linking to your libraries properly.
FIND_LIBRARY(LIB_NAME_LIB lib)
TARGET_LINK_LIBRARIES(my_executable ${LIB_NAME_LIB})
In your CMakeLists.txt file.

error installing libgd in mac 10.9

I'm trying to install libgd on my mac OSX 10.9 following the instructions here (https://mikewest.org/2007/04/installing-libgd-from-source-on-os-x) and peaking on some more info here (Installing GD library for perl on MacOSX 10.6).
the main goal is to be able to install and use Circos.
i followed all the steps to install the various libraries libpgn, pibjpeg and freetype using mainly ./configure && make && make sudo install...however
1) the ./congigure command from libgd does not find the libraries that I just installed and what I get is the following:
** Configuration summary for libgd 2.1.0:
Support for Zlib: yes
Support for PNG library: no
Support for JPEG library: no
Support for VPX library: no
Support for TIFF library: no
Support for Freetype 2.x library: no
Support for Fontconfig library: no
Support for Xpm library: no
Support for pthreads: yes
i read the README file (yeeee) suggesting to use --with-png=myDirectory --with-freetype=myDir etc..i did that (not sure if it made a difference) but when I get to the make command I get the following error
Undefined symbols for architecture x86_64:
"___sincos_stret", referenced from:
_gdImageCopyRotated in gd.o
_gdAffineRotate in gd_matrix.o
_gdImageRotateNearestNeighbour in gd_interpolation.o
_gdImageRotateGeneric in gd_interpolation.o
_gdImageRotateBilinear in gd_interpolation.o
_gdImageRotateBicubicFixed in gd_interpolation.o
_filter_bessel in gd_interpolation.o
...
"_iconv", referenced from:
_do_convert in gdkanji.o
"_iconv_close", referenced from:
_do_convert in gdkanji.o
"_iconv_open", referenced from:
_do_convert in gdkanji.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[2]: *** [libgd.la] Error 1
make[1]: *** [all] Error 2
make: *** [all-recursive] Error 1
...more extensive in pastie: http://pastebin.com/BuvskMPe
so I'm stuck, I'm reading online and it looks like it has to do with Xcode and gcc but I can't find out how to troubleshoot this.
any help would be awesome!!
I successfully installed it using homebrew. It was as simple as:
brew install gd
This installed lib-gd version 2.1.0_1.

Mountain Lion error when installing ruby, libbz2.1.0.dylib wrong architecture

I updated my mac to mountain lion. Now when i try to install ruby rvm install 1.9.3 i am getting this error
linking shared-object tcltklib.bundle
ld: in /usr/local/lib/libbz2.1.0.dylib, file was built for unsupported file format which is not the architecture being linked (x86_64) for architecture x86_64
collect2: ld returned 1 exit status
make[2]: *** [../../.ext/x86_64-darwin12.0.0/tcltklib.bundle] Error 1
make[1]: *** [ext/tk/all] Error 2
make: *** [build-ext] Error 2
How I cane update libbz2 to correct architecture?
Update Xcode (to 4.4). Once done, install Command Line Tools from Xcode => Preferences => Downloads => Command Line Tools. Then try installing ruby and you'll be good.

Resources