mysql Ruby Gem install Issues — solved!

I ran into an issue today installing the ruby mysql gem on a fresh Leopard system with 10.5.1 installed and the MySQL 5 package for Intel installed. This is based on Dan Benjamin’s great work.

To keep this easy, here is the low down. What was happening was an issue with it expecting headers for PPC. PPC? What the??? I’m on intel damn it!

Here’s how you can fix it. This is two lines. Enter your password (not root).

sudo su –

ARCHFLAGS=’-arch i386′ gem install mysql — –with-mysql-config=/usr/local/mysql/bin/mysql_config
Here was the original gem command and associated output

sudo gem install mysql — –with-mysql-config=/usr/local/mysql/bin/mysql_config
Select which gem to install for your platform (universal-darwin9.0)
1. mysql 2.7.3 (mswin32)
2. mysql 2.7.1 (mswin32)
3. mysql 2.7 (ruby)
4. mysql 2.6 (ruby)
5. Skip this gem
6. Cancel installation
> 3
Building native extensions. This could take a while…
ERROR: While executing gem … (Gem::Installer::ExtensionBuildError)
ERROR: Failed to build gem native extension.

ruby extconf.rb install mysql — –with-mysql-config=/usr/local/mysql/bin/mysql_config
checking for mysql_ssl_set()… no
checking for mysql.h… yes
creating Makefile

make
gcc -I. -I. -I/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/universal-darwin9.0 -I. -DHAVE_MYSQL_H -I/usr/local/mysql/include -Os -arch i386 -fno-common -fno-common -arch ppc -arch i386 -Os -pipe -fno-common -c mysql.c
cc -arch ppc -arch i386 -pipe -bundle -o mysql.bundle mysql.o -L”.” -L”/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib” -L. -arch ppc -arch i386 -lruby -L/usr/local/mysql/lib -lmysqlclient -lz -lm -lpthread -ldl -lm
ld: warning in /usr/local/mysql/lib/libmysqlclient.dylib, file is not of required architecture
Undefined symbols for architecture ppc:
“_mysql_store_result”, referenced from:
_store_result in mysql.o
_query in mysql.o
“_mysql_stmt_errno”, referenced from:
_mysql_stmt_raise in mysql.o
_stmt_prepare in mysql.o
_stmt_result_metadata in mysql.o
“_mysql_stmt_error”, referenced from:
_mysql_stmt_raise in mysql.o
“_mysql_options”, referenced from:
_options in mysql.o
“_mysql_refresh”, referenced from:
_refresh in mysql.o
_reload in mysql.o
“_mysql_get_client_version”, referenced from:
_client_version in mysql.o
“_mysql_stmt_bind_result”, referenced from:
_stmt_bind_result in mysql.o
_stmt_execute in mysql.o
“_mysql_fetch_lengths”, referenced from:
_fetch_hash2 in mysql.o
_fetch_lengths in mysql.o
_fetch_row in mysql.o
“_mysql_character_set_name”, referenced from:
_character_set_name in mysql.o
“_mysql_set_server_option”, referenced from:
_query in mysql.o
_set_server_option in mysql.o
“_mysql_real_query”, referenced from:
_query in mysql.o
_query in mysql.o
“_mysql_num_fields”, referenced from:
_fetch_hash2 in mysql.o
_fetch_fields in mysql.o
_fetch_field_direct in mysql.o
_fetch_lengths in mysql.o
_fetch_row in mysql.o
_num_fields in mysql.o
_stmt_prepare in mysql.o
“_mysql_ping”, referenced from:
_ping in mysql.o
“_mysql_free_result”, referenced from:
_free_mysqlres in mysql.o
_free_mysqlstmt_memory in mysql.o
_free_mysqlstmt in mysql.o
_list_dbs in mysql.o
_list_tables in mysql.o
_res_free in mysql.o
_stmt_free_result in mysql.o
“_mysql_rollback”, referenced from:
_rollback in mysql.o
“_mysql_next_result”, referenced from:
_query in mysql.o
_next_result in mysql.o
“_mysql_data_seek”, referenced from:
_data_seek in mysql.o
“_mysql_autocommit”, referenced from:
_autocommit in mysql.o
“_mysql_debug”, referenced from:
_my_debug in mysql.o
“_mysql_stmt_affected_rows”, referenced from:
_stmt_affected_rows in mysql.o
“_mysql_stmt_insert_id”, referenced from:
_stmt_insert_id in mysql.o
“_mysql_use_result”, referenced from:
_use_result in mysql.o
“_mysql_stmt_fetch”, referenced from:
_stmt_fetch in mysql.o
“_mysql_stmt_free_result”, referenced from:
_stmt_free_result in mysql.o
“_mysql_field_seek”, referenced from:
_field_seek in mysql.o
“_mysql_stmt_param_count”, referenced from:
_stmt_param_count in mysql.o
_stmt_prepare in mysql.o
“_mysql_fetch_row”, referenced from:
_list_dbs in mysql.o
_list_tables in mysql.o
_fetch_hash2 in mysql.o
_fetch_row in mysql.o
“_mysql_sqlstate”, referenced from:
_mysql_raise in mysql.o
_sqlstate in mysql.o
“_mysql_stmt_sqlstate”, referenced from:
_mysql_stmt_raise in mysql.o
_stmt_sqlstate in mysql.o
“_mysql_list_processes”, referenced from:
_list_processes in mysql.o
“_mysql_real_escape_string”, referenced from:
_real_escape_string in mysql.o
“_mysql_stmt_bind_param”, referenced from:
_stmt_execute in mysql.o
“_mysql_field_count”, referenced from:
_field_count in mysql.o
_query in mysql.o
_query in mysql.o
“_mysql_field_tell”, referenced from:
_field_tell in mysql.o
“_mysql_stmt_result_metadata”, referenced from:
_stmt_prepare in mysql.o
_stmt_result_metadata in mysql.o
“_mysql_list_tables”, referenced from:
_list_tables in mysql.o
“_mysql_stmt_prepare”, referenced from:
_stmt_prepare in mysql.o
“_mysql_get_client_info”, referenced from:
_client_info in mysql.o
“_mysql_thread_id”, referenced from:
_thread_id in mysql.o
“_mysql_stmt_execute”, referenced from:
_stmt_execute in mysql.o
“_mysql_stmt_init”, referenced from:
_stmt_init in mysql.o
“_mysql_stat”, referenced from:
_my_stat in mysql.o
“_mysql_stmt_field_count”, referenced from:
_stmt_field_count in mysql.o
“_mysql_close”, referenced from:
_free_mysql in mysql.o
_my_close in mysql.o
“_mysql_stmt_data_seek”, referenced from:
_stmt_data_seek in mysql.o
“_mysql_fetch_fields”, referenced from:
_fetch_hash2 in mysql.o
_fetch_fields in mysql.o
_stmt_bind_result in mysql.o
_stmt_execute in mysql.o
_stmt_prepare in mysql.o
“_mysql_list_fields”, referenced from:
_list_fields in mysql.o
“_mysql_row_seek”, referenced from:
_row_seek in mysql.o
“_mysql_change_user”, referenced from:
_change_user in mysql.o
“_mysql_stmt_row_seek”, referenced from:
_stmt_row_seek in mysql.o
“_mysql_stmt_close”, referenced from:
_free_mysqlstmt in mysql.o
_stmt_close in mysql.o
“_mysql_info”, referenced from:
_info in mysql.o
“_mysql_init”, referenced from:
_init in mysql.o
_real_connect in mysql.o
“_mysql_get_server_info”, referenced from:
_server_info in mysql.o
“_mysql_fetch_field_direct”, referenced from:
_fetch_field_direct in mysql.o
“_mysql_dump_debug_info”, referenced from:
_dump_debug_info in mysql.o
“_mysql_row_tell”, referenced from:
_row_tell in mysql.o
“_mysql_real_connect”, referenced from:
_real_connect in mysql.o
_real_connect2 in mysql.o
“_mysql_stmt_row_tell”, referenced from:
_stmt_row_tell in mysql.o
“_mysql_kill”, referenced from:
_my_kill in mysql.o
“_mysql_num_rows”, referenced from:
_list_dbs in mysql.o
_list_tables in mysql.o
_num_rows in mysql.o
“_mysql_warning_count”, referenced from:
_warning_count in mysql.o
“_mysql_stmt_num_rows”, referenced from:
_stmt_num_rows in mysql.o
“_mysql_stmt_attr_set”, referenced from:
_stmt_init in mysql.o
“_mysql_get_server_version”, referenced from:
_query in mysql.o
_server_version in mysql.o
“_mysql_more_results”, referenced from:
_more_results in mysql.o
“_mysql_select_db”, referenced from:
_select_db in mysql.o
“_mysql_stmt_store_result”, referenced from:
_stmt_execute in mysql.o
“_mysql_get_host_info”, referenced from:
_host_info in mysql.o
“_mysql_commit”, referenced from:
_commit in mysql.o
“_mysql_shutdown”, referenced from:
_my_shutdown in mysql.o
“_mysql_list_dbs”, referenced from:
_list_dbs in mysql.o
“_mysql_affected_rows”, referenced from:
_affected_rows in mysql.o
“_mysql_insert_id”, referenced from:
_insert_id in mysql.o
“_mysql_fetch_field”, referenced from:
_fetch_field in mysql.o
“_mysql_get_proto_info”, referenced from:
_proto_info in mysql.o
“_mysql_errno”, referenced from:
_mysql_raise in mysql.o
_my_close in mysql.o
_my_errno in mysql.o
“_mysql_error”, referenced from:
_mysql_raise in mysql.o
_my_error in mysql.o
“_mysql_escape_string”, referenced from:
_escape_string in mysql.o
ld: symbol(s) not found for architecture ppc
collect2: ld returned 1 exit status
lipo: can’t open input file: /var/tmp//ccKOmYXs.out (No such file or directory)
make: *** [mysql.bundle] Error 1

Gem files will remain installed in /Library/Ruby/Gems/1.8/gems/mysql-2.7 for inspection.
Results logged to /Library/Ruby/Gems/1.8/gems/mysql-2.7/gem_make.out

5 thoughts on “mysql Ruby Gem install Issues — solved!”

  1. Thanks

    > sudo env ARCHFLAGS=”-arch i386″ gem install mysql — –with-mysql-config=/usr/local/mysql/bin/mysql_configPassword:
    Building native extensions. This could take a while…
    Successfully installed mysql-2.7
    1 gem installed
    Installing ri documentation for mysql-2.7…
    Installing RDoc documentation for mysql-2.7…

  2. Thank you, this helped me after searching for an option for a very long time.
    Here is the error i have got….

    santhosh:~ santhosh$ sudo gem install mysql -v=2.7 — –with-mysql-lib=/usr/local/mysql/lib/ –with-mysql-include=/usr/local/mysql/include/ –with-mysql-config=/usr/local/mysql/bin/mysql_config
    Building native extensions. This could take a while…
    ERROR: Error installing mysql:
    ERROR: Failed to build gem native extension.

    /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby extconf.rb –with-mysql-lib=/usr/local/mysql/lib/ –with-mysql-include=/usr/local/mysql/include/ –with-mysql-config=/usr/local/mysql/bin/mysql_config
    checking for mysql_ssl_set()… no
    checking for mysql.h… yes
    creating Makefile

    make
    gcc -I. -I. -I/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/universal-darwin9.0 -I. -DHAVE_MYSQL_H -I/usr/local/mysql/include -Os -arch i386 -fno-common -fno-common -arch ppc -arch i386 -Os -pipe -fno-common -c mysql.c
    cc -arch ppc -arch i386 -pipe -bundle -o mysql.bundle mysql.o -L”.” -L”/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib” -L. -arch ppc -arch i386 -lruby -L/usr/local/mysql/lib -lmysqlclient -lz -lm -lpthread -ldl -lm
    ld: warning in /usr/local/mysql/lib/libmysqlclient.dylib, file is not of required architecture
    Undefined symbols for architecture ppc:
    “_mysql_store_result”, referenced from:
    _store_result in mysql.o
    _query in mysql.o
    “_mysql_stmt_errno”, referenced from:
    _mysql_stmt_raise in mysql.o
    _stmt_prepare in mysql.o
    _stmt_result_metadata in mysql.o
    “_mysql_stmt_error”, referenced from:
    _mysql_stmt_raise in mysql.o
    “_mysql_options”, referenced from:
    _options in mysql.o
    “_mysql_refresh”, referenced from:
    _refresh in mysql.o
    _reload in mysql.o
    “_mysql_get_client_version”, referenced from:
    _client_version in mysql.o
    “_mysql_stmt_bind_result”, referenced from:
    _stmt_bind_result in mysql.o
    _stmt_execute in mysql.o
    “_mysql_fetch_lengths”, referenced from:
    _fetch_hash2 in mysql.o
    _fetch_lengths in mysql.o
    _fetch_row in mysql.o
    “_mysql_character_set_name”, referenced from:
    _character_set_name in mysql.o
    “_mysql_set_server_option”, referenced from:
    _query in mysql.o
    _set_server_option in mysql.o
    “_mysql_real_query”, referenced from:
    _query in mysql.o
    _query in mysql.o
    “_mysql_num_fields”, referenced from:
    _fetch_hash2 in mysql.o
    _fetch_fields in mysql.o
    _fetch_field_direct in mysql.o
    _fetch_lengths in mysql.o
    _fetch_row in mysql.o
    _num_fields in mysql.o
    _stmt_prepare in mysql.o
    “_mysql_ping”, referenced from:
    _ping in mysql.o
    “_mysql_free_result”, referenced from:
    _free_mysqlres in mysql.o
    _free_mysqlstmt_memory in mysql.o
    _free_mysqlstmt in mysql.o
    _list_dbs in mysql.o
    _list_tables in mysql.o
    _res_free in mysql.o
    _stmt_free_result in mysql.o
    “_mysql_rollback”, referenced from:
    _rollback in mysql.o
    “_mysql_next_result”, referenced from:
    _query in mysql.o
    _next_result in mysql.o
    “_mysql_data_seek”, referenced from:
    _data_seek in mysql.o
    “_mysql_autocommit”, referenced from:
    _autocommit in mysql.o
    “_mysql_debug”, referenced from:
    _my_debug in mysql.o
    “_mysql_stmt_affected_rows”, referenced from:
    _stmt_affected_rows in mysql.o
    “_mysql_stmt_insert_id”, referenced from:
    _stmt_insert_id in mysql.o
    “_mysql_use_result”, referenced from:
    _use_result in mysql.o
    “_mysql_stmt_fetch”, referenced from:
    _stmt_fetch in mysql.o
    “_mysql_stmt_free_result”, referenced from:
    _stmt_free_result in mysql.o
    “_mysql_field_seek”, referenced from:
    _field_seek in mysql.o
    “_mysql_stmt_param_count”, referenced from:
    _stmt_param_count in mysql.o
    _stmt_prepare in mysql.o
    “_mysql_fetch_row”, referenced from:
    _list_dbs in mysql.o
    _list_tables in mysql.o
    _fetch_hash2 in mysql.o
    _fetch_row in mysql.o
    “_mysql_sqlstate”, referenced from:
    _mysql_raise in mysql.o
    _sqlstate in mysql.o
    “_mysql_stmt_sqlstate”, referenced from:
    _mysql_stmt_raise in mysql.o
    _stmt_sqlstate in mysql.o
    “_mysql_list_processes”, referenced from:
    _list_processes in mysql.o
    “_mysql_real_escape_string”, referenced from:
    _real_escape_string in mysql.o
    “_mysql_stmt_bind_param”, referenced from:
    _stmt_execute in mysql.o
    “_mysql_field_count”, referenced from:
    _field_count in mysql.o
    _query in mysql.o
    _query in mysql.o
    “_mysql_field_tell”, referenced from:
    _field_tell in mysql.o
    “_mysql_stmt_result_metadata”, referenced from:
    _stmt_prepare in mysql.o
    _stmt_result_metadata in mysql.o
    “_mysql_list_tables”, referenced from:
    _list_tables in mysql.o
    “_mysql_stmt_prepare”, referenced from:
    _stmt_prepare in mysql.o
    “_mysql_get_client_info”, referenced from:
    _client_info in mysql.o
    “_mysql_thread_id”, referenced from:
    _thread_id in mysql.o
    “_mysql_stmt_execute”, referenced from:
    _stmt_execute in mysql.o
    “_mysql_stmt_init”, referenced from:
    _stmt_init in mysql.o
    “_mysql_stat”, referenced from:
    _my_stat in mysql.o
    “_mysql_stmt_field_count”, referenced from:
    _stmt_field_count in mysql.o
    “_mysql_close”, referenced from:
    _free_mysql in mysql.o
    _my_close in mysql.o
    “_mysql_stmt_data_seek”, referenced from:
    _stmt_data_seek in mysql.o
    “_mysql_fetch_fields”, referenced from:
    _fetch_hash2 in mysql.o
    _fetch_fields in mysql.o
    _stmt_bind_result in mysql.o
    _stmt_execute in mysql.o
    _stmt_prepare in mysql.o
    “_mysql_list_fields”, referenced from:
    _list_fields in mysql.o
    “_mysql_row_seek”, referenced from:
    _row_seek in mysql.o
    “_mysql_change_user”, referenced from:
    _change_user in mysql.o
    “_mysql_stmt_row_seek”, referenced from:
    _stmt_row_seek in mysql.o
    “_mysql_stmt_close”, referenced from:
    _free_mysqlstmt in mysql.o
    _stmt_close in mysql.o
    “_mysql_info”, referenced from:
    _info in mysql.o
    “_mysql_init”, referenced from:
    _init in mysql.o
    _real_connect in mysql.o
    “_mysql_get_server_info”, referenced from:
    _server_info in mysql.o
    “_mysql_fetch_field_direct”, referenced from:
    _fetch_field_direct in mysql.o
    “_mysql_dump_debug_info”, referenced from:
    _dump_debug_info in mysql.o
    “_mysql_row_tell”, referenced from:
    _row_tell in mysql.o
    “_mysql_real_connect”, referenced from:
    _real_connect in mysql.o
    _real_connect2 in mysql.o
    “_mysql_stmt_row_tell”, referenced from:
    _stmt_row_tell in mysql.o
    “_mysql_kill”, referenced from:
    _my_kill in mysql.o
    “_mysql_num_rows”, referenced from:
    _list_dbs in mysql.o
    _list_tables in mysql.o
    _num_rows in mysql.o
    “_mysql_warning_count”, referenced from:
    _warning_count in mysql.o
    “_mysql_stmt_num_rows”, referenced from:
    _stmt_num_rows in mysql.o
    “_mysql_stmt_attr_set”, referenced from:
    _stmt_init in mysql.o
    “_mysql_get_server_version”, referenced from:
    _query in mysql.o
    _server_version in mysql.o
    “_mysql_more_results”, referenced from:
    _more_results in mysql.o
    “_mysql_select_db”, referenced from:
    _select_db in mysql.o
    “_mysql_stmt_store_result”, referenced from:
    _stmt_execute in mysql.o
    “_mysql_get_host_info”, referenced from:
    _host_info in mysql.o
    “_mysql_commit”, referenced from:
    _commit in mysql.o
    “_mysql_shutdown”, referenced from:
    _my_shutdown in mysql.o
    “_mysql_list_dbs”, referenced from:
    _list_dbs in mysql.o
    “_mysql_affected_rows”, referenced from:
    _affected_rows in mysql.o
    “_mysql_insert_id”, referenced from:
    _insert_id in mysql.o
    “_mysql_fetch_field”, referenced from:
    _fetch_field in mysql.o
    “_mysql_get_proto_info”, referenced from:
    _proto_info in mysql.o
    “_mysql_errno”, referenced from:
    _mysql_raise in mysql.o
    _my_close in mysql.o
    _my_errno in mysql.o
    “_mysql_error”, referenced from:
    _mysql_raise in mysql.o
    _my_error in mysql.o
    “_mysql_escape_string”, referenced from:
    _escape_string in mysql.o
    ld: symbol(s) not found for architecture ppc
    collect2: ld returned 1 exit status
    lipo: can’t open input file: /var/tmp//ccbJqM1W.out (No such file or directory)
    make: *** [mysql.bundle] Error 1

    I used “sudo env ARCHFLAGS=’-arch i386′ gem install mysql -v=2.7 — –with-mysql-config=/usr/local/mysql/bin/mysql_config” and it worked perfectly…..

    Thanks a lot…

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.