+++ This bug was initially created as a clone of Bug #1109645 +++ Description of problem: When create redmine quickstart(https://github.com/openshift/openshift-redmine-quickstart.git) with mysql-5.5 for a scaling app, will fail due to "/usr/bin/ld: cannot find -lmysqlclient " when gem install mysql(ruby-1.8) or mysql2(ruby-1.9). Version-Release number of selected component (if applicable): devenv_4869 How reproducible: always Steps to Reproduce: 1.Create a redmine quickstart scaling app with mysql-5.5 2. 3. Actual results: =======for ruby-1.9 ========= Installing mysql2 (0.3.14) .... ............... Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension. /opt/rh/ruby193/root/usr/bin/ruby extconf.rb checking for ruby/thread.h... no checking for rb_thread_blocking_region()... yes checking for rb_wait_for_single_fd()... yes checking for rb_hash_dup()... yes checking for rb_intern3()... yes ----- Using mysql_config at /opt/rh/mysql55/root/usr/bin/mysql_config ----- checking for mysql.h... yes checking for errmsg.h... yes checking for mysqld_error.h... yes ----- Don't know how to set rpath on your system, if MySQL libraries are not in path mysql2 may not load ----- ----- Setting libpath to /opt/rh/mysql55/root/usr/lib64/mysql ----- creating Makefile make gcc -I. -I/opt/rh/ruby193/root/usr/include/x86_64-linux -I/opt/rh/ruby193/root/usr/include/ruby/backward -I/opt/rh/ruby193/root/usr/include -I. -I/opt/rh/mysql55/root/usr/include/mysql -DHAVE_RB_THREAD_BLOCKING_REGION -DHAVE_RB_WAIT_FOR_SINGLE_FD -DHAVE_RB_HASH_DUP -DHAVE_RB_INTERN3 -DHAVE_MYSQL_H -DHAVE_ERRMSG_H -DHAVE_MYSQLD_ERROR_H -fPIC -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -mtune=generic -fPIC -m64 -o client.o -c client.c gcc -I. -I/opt/rh/ruby193/root/usr/include/x86_64-linux -I/opt/rh/ruby193/root/usr/include/ruby/backward -I/opt/rh/ruby193/root/usr/include -I. -I/opt/rh/mysql55/root/usr/include/mysql -DHAVE_RB_THREAD_BLOCKING_REGION -DHAVE_RB_WAIT_FOR_SINGLE_FD -DHAVE_RB_HASH_DUP -DHAVE_RB_INTERN3 -DHAVE_MYSQL_H -DHAVE_ERRMSG_H -DHAVE_MYSQLD_ERROR_H -fPIC -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -mtune=generic -fPIC -m64 -o mysql2_ext.o -c mysql2_ext.c gcc -I. -I/opt/rh/ruby193/root/usr/include/x86_64-linux -I/opt/rh/ruby193/root/usr/include/ruby/backward -I/opt/rh/ruby193/root/usr/include -I. -I/opt/rh/mysql55/root/usr/include/mysql -DHAVE_RB_THREAD_BLOCKING_REGION -DHAVE_RB_WAIT_FOR_SINGLE_FD -DHAVE_RB_HASH_DUP -DHAVE_RB_INTERN3 -DHAVE_MYSQL_H -DHAVE_ERRMSG_H -DHAVE_MYSQLD_ERROR_H -fPIC -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -mtune=generic -fPIC -m64 -o result.o -c result.c rm -f mysql2.so gcc -shared -o mysql2.so client.o mysql2_ext.o result.o -L. -L/opt/rh/ruby193/root/usr/lib64 -L/opt/rh/mysql55/root/usr/lib64/mysql -L. -rdynamic -Wl,-export-dynamic -m64 -lruby -L/opt/rh/mysql55/root/usr/lib64/mysql -lmysqlclient -lpthread -lz -lm -lrt -lssl -lcrypto -ldl -lpthread -lrt -ldl -lcrypt -lm -lc /usr/bin/ld: cannot find -lmysqlclient collect2: ld returned 1 exit status make: *** [mysql2.so] Error 1 ===== for ruby-1.8 ===== Installing mysql (2.8.1) Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension. /usr/bin/ruby extconf.rb checking for mysql_ssl_set()... no checking for rb_str_set_len()... no checking for rb_thread_start_timer()... no checking for mysql.h... yes creating Makefile make gcc -I. -I. -I/usr/lib64/ruby/1.8/x86_64-linux -I. -DHAVE_MYSQL_H -I/opt/rh/mysql55/root/usr/include/mysql -g -pipe -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -fno-strict-aliasing -fwrapv -fPIC -fPIC -g -static-libgcc -fno-omit-frame-pointer -fno-strict-aliasing -DMY_PTHREAD_FASTMUTEX=1 -fPIC -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -fno-strict-aliasing -fPIC -c mysql.c mysql.c: In function 'time_inspect': mysql.c:1797: warning: format '%04d' expects type 'int', but argument 3 has type 'long int' mysql.c:1797: warning: format '%02d' expects type 'int', but argument 4 has type 'long int' mysql.c:1797: warning: format '%02d' expects type 'int', but argument 5 has type 'long int' mysql.c:1797: warning: format '%02d' expects type 'int', but argument 6 has type 'long int' mysql.c:1797: warning: format '%02d' expects type 'int', but argument 7 has type 'long int' mysql.c:1797: warning: format '%02d' expects type 'int', but argument 8 has type 'long int' mysql.c: In function 'time_to_s': mysql.c:1810: warning: format '%04d' expects type 'int', but argument 3 has type 'long int' mysql.c:1810: warning: format '%02d' expects type 'int', but argument 4 has type 'long int' mysql.c:1810: warning: format '%02d' expects type 'int', but argument 5 has type 'long int' mysql.c:1810: warning: format '%02d' expects type 'int', but argument 6 has type 'long int' mysql.c:1810: warning: format '%02d' expects type 'int', but argument 7 has type 'long int' mysql.c:1810: warning: format '%02d' expects type 'int', but argument 8 has type 'long int' gcc -shared -o mysql_api.so mysql.o -L. -L/usr/lib64 -L. -rdynamic -Wl,-export-dynamic -lruby -L/opt/rh/mysql55/root/usr/lib64/mysql -lmysqlclient -lpthread -lz -lm -lrt -lssl -lcrypto -ldl -lpthread -lrt -ldl -lcrypt -lm -lc /usr/bin/ld: cannot find -lmysqlclient collect2: ld returned 1 exit status make: *** [mysql_api.so] Error 1 Expected results: Additional info: --- Additional comment from Guolei Sun on 2014-06-16 06:34:10 EDT --- Summary: gem install mysql failed when it's the SCALABLE ruby app with mysql-5.5 Cartridge - mysql-5.5 P: M S: M Description of problem: The gem install mysql is failed when the app is SCALABLE and has mysql-5.5 added Version-Release number of selected component (if applicable): INT devenv_4867(devenv_4869) How reproducible: always Steps to Reproduce: 1. create one scalable ruby app with cartridge mysql-5.5 rhc app create r19smy55 ruby-1.9 mysql-5.5 -s 2. add Gemfile and Gemfile.lock as below to app repo $ cat Gemfile source 'http://rubygems.org' gem 'sinatra' gem 'mysql' $ cat Gemfile.lock GEM remote: http://rubygems.org/ specs: mysql (2.9.1) rack (1.5.2) rack-protection (1.5.3) rack sinatra (1.4.5) rack (~> 1.4) rack-protection (~> 1.4) tilt (~> 1.3, >= 1.3.4) tilt (1.4.1) PLATFORMS ruby DEPENDENCIES mysql sinatra 3. git push git add .; git commit -am "test"; git push Actual results: git push failed, and below error pops up. -------------------------------- [master 8c5b9e4] p 2 files changed, 23 insertions(+) create mode 100644 Gemfile create mode 100644 Gemfile.lock Counting objects: 5, done. Delta compression using up to 4 threads. Compressing objects: 100% (4/4), done. Writing objects: 100% (4/4), 518 bytes, done. Total 4 (delta 1), reused 0 (delta 0) remote: Stopping Ruby cartridge remote: Waiting for stop to finish remote: Waiting for stop to finish remote: Waiting for stop to finish remote: Waiting for stop to finish remote: Waiting for stop to finish remote: Waiting for stop to finish remote: Waiting for stop to finish remote: Waiting for stop to finish remote: Waiting for stop to finish remote: Waiting for stop to finish remote: Syncing git content to other proxy gears remote: Building git ref 'master', commit 8c5b9e4 remote: Building Ruby cartridge remote: bundle install --deployment --path ./app-root/repo/vendor/bundle remote: Fetching gem metadata from http://rubygems.org/.......... remote: Fetching gem metadata from http://rubygems.org/.. remote: Installing mysql (2.9.1) ............. remote: remote: Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension. remote: remote: /opt/rh/ruby193/root/usr/bin/ruby extconf.rb remote: checking for mysql_ssl_set()... *** extconf.rb failed *** remote: Could not create Makefile due to some reason, probably lack of remote: necessary libraries and/or headers. Check the mkmf.log file for more remote: details. You may need configuration options. remote: remote: Provided configuration options: remote: --with-opt-dir remote: --without-opt-dir remote: --with-opt-include remote: --without-opt-include=${opt-dir}/include remote: --with-opt-lib remote: --without-opt-lib=${opt-dir}/ remote: --with-make-prog remote: --without-make-prog remote: --srcdir=. remote: --curdir remote: --ruby=/opt/rh/ruby193/root/usr/bin/ruby remote: --with-mysql-config remote: --without-mysql-config remote: /opt/rh/ruby193/root/usr/share/ruby/mkmf.rb:381:in `try_do': The compiler failed to generate an executable file. (RuntimeError) remote: You have to install development tools first. remote: from /opt/rh/ruby193/root/usr/share/ruby/mkmf.rb:461:in `try_link0' remote: from /opt/rh/ruby193/root/usr/share/ruby/mkmf.rb:476:in `try_link' remote: from /opt/rh/ruby193/root/usr/share/ruby/mkmf.rb:619:in `try_func' remote: from /opt/rh/ruby193/root/usr/share/ruby/mkmf.rb:894:in `block in have_func' remote: from /opt/rh/ruby193/root/usr/share/ruby/mkmf.rb:790:in `block in checking_for' remote: from /opt/rh/ruby193/root/usr/share/ruby/mkmf.rb:284:in `block (2 levels) in postpone' remote: from /opt/rh/ruby193/root/usr/share/ruby/mkmf.rb:254:in `open' remote: from /opt/rh/ruby193/root/usr/share/ruby/mkmf.rb:284:in `block in postpone' remote: from /opt/rh/ruby193/root/usr/share/ruby/mkmf.rb:254:in `open' remote: from /opt/rh/ruby193/root/usr/share/ruby/mkmf.rb:280:in `postpone' remote: from /opt/rh/ruby193/root/usr/share/ruby/mkmf.rb:789:in `checking_for' remote: from /opt/rh/ruby193/root/usr/share/ruby/mkmf.rb:893:in `have_func' remote: from extconf.rb:45:in `<main>' remote: remote: remote: Gem files will remain installed in /var/lib/openshift/539ef47f6feb46986c0004b9/app-root/runtime/repo/vendor/bundle/ruby/1.9.1/gems/mysql-2.9.1 for inspection. remote: Results logged to /var/lib/openshift/539ef47f6feb46986c0004b9/app-root/runtime/repo/vendor/bundle/ruby/1.9.1/gems/mysql-2.9.1/ext/mysql_api/gem_make.out remote: An error occurred while installing mysql (2.9.1), and Bundler cannot continue. remote: Make sure that `gem install mysql -v '2.9.1'` succeeds before bundling. remote: An error occurred executing 'gear postreceive' (exit code: 5) remote: Error message: CLIENT_ERROR: Failed to execute: 'control build' for /var/lib/openshift/539ef47f6feb46986c0004b9/ruby remote: remote: For more details about the problem, try running the command again with the '--trace' option. To ssh://539ef47f6feb46986c0004b9.rhcloud.com/~/git/r19.git/ 5f38a46..8c5b9e4 master -> master Expected results: git push should be successful without errors. Additional info: Both ruby-1.8 and ruby-1.9. It's OK when the scalable ruby app without mysql-5.5. --- Additional comment from weiwei jiang on 2014-06-19 04:39:10 EDT --- Still can be reproduced on devenv_4890: ========================= rhc app create redmine85s ruby-1.8 mysql-5.5 --from-code=https://github.com/openshift/openshift-redmine-quickstart.git --no-git --no-dns -s ======================= Application Options ------------------- Domain: quickstart Cartridges: ruby-1.8, mysql-5.5 Source Code: https://github.com/openshift/openshift-redmine-quickstart.git Gear Size: default Scaling: yes Creating application 'redmine85s' ... The initial build for the application failed: Shell command '/sbin/runuser -s /bin/sh 53a2d5b8f1da18b84c0000b3 -c "exec /usr/bin/runcon 'unconfined_u:system_r:openshift_t:s0:c0,c1014' /bin/sh -c \"gear postreceive --init >> /tmp/initial-build.log 2>&1\""' returned an error. rc=255 .Last 10 kB of build output: Stopping Ruby cartridge Repairing links for 1 deployments Building git ref 'master', commit f1e38fb Building Ruby cartridge bundle install --deployment --path ./app-root/repo/vendor/bundle NOTE: You can prevent installing certain Gemfile group using: rhc env set BUNDLE_WITHOUT=groupname Fetching gem metadata from https://rubygems.org/......... Fetching gem metadata from https://rubygems.org/.. Installing rake (10.1.1) <----skip----> Installing mysql (2.8.1) Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension. /usr/bin/ruby extconf.rb checking for mysql_ssl_set()... no checking for rb_str_set_len()... no checking for rb_thread_start_timer()... no checking for mysql.h... yes creating Makefile make gcc -I. -I. -I/usr/lib64/ruby/1.8/x86_64-linux -I. -DHAVE_MYSQL_H -I/opt/rh/mysql55/root/usr/include/mysql -g -pipe -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -fno-strict-aliasing -fwrapv -fPIC -fPIC -g -static-libgcc -fno-omit-frame-pointer -fno-strict-aliasing -DMY_PTHREAD_FASTMUTEX=1 -fPIC -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -fno-strict-aliasing -fPIC -c mysql.c mysql.c: In function 'time_inspect': mysql.c:1797: warning: format '%04d' expects type 'int', but argument 3 has type 'long int' mysql.c:1797: warning: format '%02d' expects type 'int', but argument 4 has type 'long int' mysql.c:1797: warning: format '%02d' expects type 'int', but argument 5 has type 'long int' mysql.c:1797: warning: format '%02d' expects type 'int', but argument 6 has type 'long int' mysql.c:1797: warning: format '%02d' expects type 'int', but argument 7 has type 'long int' mysql.c:1797: warning: format '%02d' expects type 'int', but argument 8 has type 'long int' mysql.c: In function 'time_to_s': mysql.c:1810: warning: format '%04d' expects type 'int', but argument 3 has type 'long int' mysql.c:1810: warning: format '%02d' expects type 'int', but argument 4 has type 'long int' mysql.c:1810: warning: format '%02d' expects type 'int', but argument 5 has type 'long int' mysql.c:1810: warning: format '%02d' expects type 'int', but argument 6 has type 'long int' mysql.c:1810: warning: format '%02d' expects type 'int', but argument 7 has type 'long int' mysql.c:1810: warning: format '%02d' expects type 'int', but argument 8 has type 'long int' gcc -shared -o mysql_api.so mysql.o -L. -L/usr/lib64 -L. -rdynamic -Wl,-export-dynamic -lruby -L/opt/rh/mysql55/root/usr/lib64/mysql -lmysqlclient -lpthread -lz -lm -lrt -lssl -lcrypto -ldl -lpthread -lrt -ldl -lcrypt -lm -lc /usr/bin/ld: cannot find -lmysqlclient collect2: ld returned 1 exit status make: *** [mysql_api.so] Error 1 Gem files will remain installed in /var/lib/openshift/53a2d5b8f1da18b84c0000b3/app-root/runtime/repo/vendor/bundle/ruby/1.8/gems/mysql-2.8.1 for inspection. Results logged to /var/lib/openshift/53a2d5b8f1da18b84c0000b3/app-root/runtime/repo/vendor/bundle/ruby/1.8/gems/mysql-2.8.1/ext/mysql_api/gem_make.out An error occurred while installing mysql (2.8.1), and Bundler cannot continue. Make sure that `gem install mysql -v '2.8.1'` succeeds before bundling. An error occurred executing 'gear postreceive' (exit code: 5) Error message: CLIENT_ERROR: Failed to execute: 'control build' for /var/lib/openshift/53a2d5b8f1da18b84c0000b3/ruby For more details about the problem, try running the command again with the '--trace' option. ========================= rhc app create redmine95s ruby-1.9 mysql-5.5 --from-code=https://github.com/openshift/openshift-redmine-quickstart.git --no-git --no-dns -s ======================= Application Options ------------------- Domain: quickstart Cartridges: ruby-1.9, mysql-5.5 Source Code: https://github.com/openshift/openshift-redmine-quickstart.git Gear Size: default Scaling: yes Creating application 'redmine95s' ... The initial build for the application failed: Shell command '/sbin/runuser -s /bin/sh 53a2d85ef1da189deb0001f6 -c "exec /usr/bin/runcon 'unconfined_u:system_r:openshift_t:s0:c0,c1014' /bin/sh -c \"gear postreceive --init >> /tmp/initial-build.log 2>&1\""' returned an error. rc=255 .Last 10 kB of build output: Stopping Ruby cartridge Repairing links for 1 deployments Building git ref 'master', commit f1e38fb Building Ruby cartridge bundle install --deployment --path ./app-root/repo/vendor/bundle NOTE: You can prevent installing certain Gemfile group using: rhc env set BUNDLE_WITHOUT=groupname Fetching gem metadata from https://rubygems.org/......... Fetching gem metadata from https://rubygems.org/.. Installing rake (10.1.1) <------skip------> Installing mysql2 (0.3.14) .... ............... Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension. /opt/rh/ruby193/root/usr/bin/ruby extconf.rb checking for ruby/thread.h... no checking for rb_thread_blocking_region()... yes checking for rb_wait_for_single_fd()... yes checking for rb_hash_dup()... yes checking for rb_intern3()... yes ----- Using mysql_config at /opt/rh/mysql55/root/usr/bin/mysql_config ----- checking for mysql.h... yes checking for errmsg.h... yes checking for mysqld_error.h... yes ----- Don't know how to set rpath on your system, if MySQL libraries are not in path mysql2 may not load ----- ----- Setting libpath to /opt/rh/mysql55/root/usr/lib64/mysql ----- creating Makefile make gcc -I. -I/opt/rh/ruby193/root/usr/include/x86_64-linux -I/opt/rh/ruby193/root/usr/include/ruby/backward -I/opt/rh/ruby193/root/usr/include -I. -I/opt/rh/mysql55/root/usr/include/mysql -DHAVE_RB_THREAD_BLOCKING_REGION -DHAVE_RB_WAIT_FOR_SINGLE_FD -DHAVE_RB_HASH_DUP -DHAVE_RB_INTERN3 -DHAVE_MYSQL_H -DHAVE_ERRMSG_H -DHAVE_MYSQLD_ERROR_H -fPIC -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -mtune=generic -fPIC -m64 -o client.o -c client.c gcc -I. -I/opt/rh/ruby193/root/usr/include/x86_64-linux -I/opt/rh/ruby193/root/usr/include/ruby/backward -I/opt/rh/ruby193/root/usr/include -I. -I/opt/rh/mysql55/root/usr/include/mysql -DHAVE_RB_THREAD_BLOCKING_REGION -DHAVE_RB_WAIT_FOR_SINGLE_FD -DHAVE_RB_HASH_DUP -DHAVE_RB_INTERN3 -DHAVE_MYSQL_H -DHAVE_ERRMSG_H -DHAVE_MYSQLD_ERROR_H -fPIC -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -mtune=generic -fPIC -m64 -o mysql2_ext.o -c mysql2_ext.c gcc -I. -I/opt/rh/ruby193/root/usr/include/x86_64-linux -I/opt/rh/ruby193/root/usr/include/ruby/backward -I/opt/rh/ruby193/root/usr/include -I. -I/opt/rh/mysql55/root/usr/include/mysql -DHAVE_RB_THREAD_BLOCKING_REGION -DHAVE_RB_WAIT_FOR_SINGLE_FD -DHAVE_RB_HASH_DUP -DHAVE_RB_INTERN3 -DHAVE_MYSQL_H -DHAVE_ERRMSG_H -DHAVE_MYSQLD_ERROR_H -fPIC -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -mtune=generic -fPIC -m64 -o result.o -c result.c rm -f mysql2.so gcc -shared -o mysql2.so client.o mysql2_ext.o result.o -L. -L/opt/rh/ruby193/root/usr/lib64 -L/opt/rh/mysql55/root/usr/lib64/mysql -L. -rdynamic -Wl,-export-dynamic -m64 -lruby -L/opt/rh/mysql55/root/usr/lib64/mysql -lmysqlclient -lpthread -lz -lm -lrt -lssl -lcrypto -ldl -lpthread -lrt -ldl -lcrypt -lm -lc /usr/bin/ld: cannot find -lmysqlclient collect2: ld returned 1 exit status make: *** [mysql2.so] Error 1 Gem files will remain installed in /var/lib/openshift/53a2d85ef1da189deb0001f6/app-root/runtime/repo/vendor/bundle/ruby/1.9.1/gems/mysql2-0.3.14 for inspection. Results logged to /var/lib/openshift/53a2d85ef1da189deb0001f6/app-root/runtime/repo/vendor/bundle/ruby/1.9.1/gems/mysql2-0.3.14/ext/mysql2/gem_make.out An error occurred while installing mysql2 (0.3.14), and Bundler cannot continue. Make sure that `gem install mysql2 -v '0.3.14'` succeeds before bundling. An error occurred executing 'gear postreceive' (exit code: 5) Error message: CLIENT_ERROR: Failed to execute: 'control build' for /var/lib/openshift/53a2d85ef1da189deb0001f6/ruby For more details about the problem, try running the command again with the '--trace' option. --- Additional comment from Ben Parees on 2014-06-19 13:01:20 EDT --- https://github.com/openshift/origin-server/pull/5526 --- Additional comment from openshift-github-bot on 2014-06-19 16:52:58 EDT --- Commit pushed to master at https://github.com/openshift/origin-server https://github.com/openshift/origin-server/commit/fb5d46ad01ab9d698404f42fd7f2099dd79a704b Bug 1109645: Setting mysql2 variable for bundler --- Additional comment from weiwei jiang on 2014-06-20 06:13:14 EDT --- Checked on both devenv_4897 and devenv-stage_890, still can be reproduced, so assign back. --- Additional comment from weiwei jiang on 2014-06-20 06:15:29 EDT --- And still failed with rhc app create redmine85s ruby-1.8 mysql-5.5 --from-code=https://github.com/openshift/openshift-redmine-quickstart.git --no-git --no-dns -s But success with rhc app create redmine95s ruby-1.9 mysql-5.5 --from-code=https://github.com/openshift/openshift-redmine-quickstart.git --no-git --no-dns -s --- Additional comment from Ben Parees on 2014-06-20 17:38:38 EDT --- It looks like the issue here is that with a scalable app, mysql55 is added to the PATH which in turn puts it into the gcc statement used to build the gem. Trying to determine if the mysql 2.9.1 gem is simply not compatible with mysql55 or what. The fact that this used to work was an artifact of us not properly putting mysql55 into the web framework gear's $PATH, near as I can tell. --- Additional comment from Michal Fojtik on 2014-06-21 03:45:39 EDT --- Ben: The problem here is, that MySQL 5.5 (SCL) sets the PATH to /opt/rh and then the 'mysql-config' script is executed from that location. Problem with that script is, that it points wrong location of the 'libmysqlclient' library. This library is *not* shipped with SCL and developers must use the one provided by non-SCL system one (/usr/lib). This is exactly what Jakub patch fixed, it forces bundler to override the wrong location and sets it to system one. Now I dunno what is the problem with Ruby 1.8, my guess would be that it fails because 'mysql2' gem is not compatible with Ruby 1.8 OR the ruby 1.8 bundler is not able to pick up the environment variable for some reason. QA: Can you please provide us more informations about the 1.8 failure? Is it the same as Ruby 1.9? Jakub: Can you please try to reproduce this bug in latest devenv (ruby18 + mysql55) Ben: We have to speak with SCL team to fix this finally... The 'mysql-config' in SCL distro is clearly doing wrong thing and all we are doing here are hacks to workaround this bug. --- Additional comment from Michal Fojtik on 2014-06-21 03:47:14 EDT --- Note to Jakub: Check for the '-L/opt/rh/mysql55/root/usr/lib64/mysql' in the gem install mysql2 under 1.8, this is wrong... it should point to /usr/lib. --- Additional comment from weiwei jiang on 2014-06-22 23:44:46 EDT --- Checked with devenv_4899, and result as below: # rhc app create redmine85s ruby-1.8 mysql-5.5 --from-code=https://github.com/openshift/openshift-redmine-quickstart.git --no-git -s Application Options ------------------- Domain: wjiang Cartridges: ruby-1.8, mysql-5.5 Source Code: https://github.com/openshift/openshift-redmine-quickstart.git Gear Size: default Scaling: yes Creating application 'redmine85s' ... The initial build for the application failed: Shell command '/sbin/runuser -s /bin/sh 53a7d8bcd14d1533f9000025 -c "exec /usr/bin/runcon 'unconfined_u:system_r:openshift_t:s0:c0,c1001' /bin/sh -c \"gear postreceive --init >> /tmp/initial-build.log 2>&1\""' returned an error. rc=255 .Last 10 kB of build output: Stopping Ruby cartridge Repairing links for 1 deployments Building git ref 'master', commit f1e38fb Building Ruby cartridge bundle install --deployment --path ./app-root/repo/vendor/bundle NOTE: You can prevent installing certain Gemfile group using: rhc env set BUNDLE_WITHOUT=groupname Fetching gem metadata from https://rubygems.org/......... Fetching gem metadata from https://rubygems.org/.. Installing rake (10.1.1) Installing i18n (0.6.9) Installing multi_json (1.9.0) Installing activesupport (3.2.16) Installing builder (3.0.0) Installing activemodel (3.2.16) Installing erubis (2.7.0) Installing journey (1.0.4) Installing rack (1.4.5) Installing rack-cache (1.2) Installing rack-test (0.6.2) Installing hike (1.2.3) Installing tilt (1.4.1) Installing sprockets (2.2.2) Installing actionpack (3.2.16) Installing mime-types (1.25.1) Installing polyglot (0.3.4) Installing treetop (1.4.15) Installing mail (2.5.4) Installing actionmailer (3.2.16) Installing arel (3.0.3) Installing tzinfo (0.3.39) Installing activerecord (3.2.16) Installing activeresource (3.2.16) Installing coderay (1.1.0) Installing fastercsv (1.5.5) Installing rack-ssl (1.3.3) Installing json (1.8.1) Installing rdoc (3.12.2) Installing thor (0.14.6) Installing railties (3.2.16) Installing jquery-rails (2.0.3) Installing mysql (2.8.1) Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension. /usr/bin/ruby extconf.rb checking for mysql_ssl_set()... no checking for rb_str_set_len()... no checking for rb_thread_start_timer()... no checking for mysql.h... yes creating Makefile make gcc -I. -I. -I/usr/lib64/ruby/1.8/x86_64-linux -I. -DHAVE_MYSQL_H -I/opt/rh/mysql55/root/usr/include/mysql -g -pipe -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -fno-strict-aliasing -fwrapv -fPIC -fPIC -g -static-libgcc -fno-omit-frame-pointer -fno-strict-aliasing -DMY_PTHREAD_FASTMUTEX=1 -fPIC -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -fno-strict-aliasing -fPIC -c mysql.c mysql.c: In function 'time_inspect': mysql.c:1797: warning: format '%04d' expects type 'int', but argument 3 has type 'long int' mysql.c:1797: warning: format '%02d' expects type 'int', but argument 4 has type 'long int' mysql.c:1797: warning: format '%02d' expects type 'int', but argument 5 has type 'long int' mysql.c:1797: warning: format '%02d' expects type 'int', but argument 6 has type 'long int' mysql.c:1797: warning: format '%02d' expects type 'int', but argument 7 has type 'long int' mysql.c:1797: warning: format '%02d' expects type 'int', but argument 8 has type 'long int' mysql.c: In function 'time_to_s': mysql.c:1810: warning: format '%04d' expects type 'int', but argument 3 has type 'long int' mysql.c:1810: warning: format '%02d' expects type 'int', but argument 4 has type 'long int' mysql.c:1810: warning: format '%02d' expects type 'int', but argument 5 has type 'long int' mysql.c:1810: warning: format '%02d' expects type 'int', but argument 6 has type 'long int' mysql.c:1810: warning: format '%02d' expects type 'int', but argument 7 has type 'long int' mysql.c:1810: warning: format '%02d' expects type 'int', but argument 8 has type 'long int' gcc -shared -o mysql_api.so mysql.o -L. -L/usr/lib64 -L. -rdynamic -Wl,-export-dynamic -lruby -L/opt/rh/mysql55/root/usr/lib64/mysql -lmysqlclient -lpthread -lz -lm -lrt -lssl -lcrypto -ldl -lpthread -lrt -ldl -lcrypt -lm -lc /usr/bin/ld: cannot find -lmysqlclient collect2: ld returned 1 exit status make: *** [mysql_api.so] Error 1 Gem files will remain installed in /var/lib/openshift/53a7d8bcd14d1533f9000025/app-root/runtime/repo/vendor/bundle/ruby/1.8/gems/mysql-2.8.1 for inspection. Results logged to /var/lib/openshift/53a7d8bcd14d1533f9000025/app-root/runtime/repo/vendor/bundle/ruby/1.8/gems/mysql-2.8.1/ext/mysql_api/gem_make.out An error occurred while installing mysql (2.8.1), and Bundler cannot continue. Make sure that `gem install mysql -v '2.8.1'` succeeds before bundling. An error occurred executing 'gear postreceive' (exit code: 5) Error message: CLIENT_ERROR: Failed to execute: 'control build' for /var/lib/openshift/53a7d8bcd14d1533f9000025/ruby For more details about the problem, try running the command again with the '--trace' option. --- Additional comment from Michal Fojtik on 2014-06-23 04:20:14 EDT --- https://github.com/openshift/origin-server/pull/5541
The bug exsits on OpenShiftEnterpriseErrata/2.1.z/2014-08-13.1. When in a scalable ruby app with mysql-5.5 added, do gem install mysql, will have the same error: [srb19-domtest.ose21z-new.com 53edb797029dac9ba6000032]\> gem install mysql -v '2.9.1' Fetching: mysql-2.9.1.gem (100%) Building native extensions. This could take a while... ERROR: Error installing mysql: ERROR: Failed to build gem native extension. /opt/rh/ruby193/root/usr/bin/ruby extconf.rb checking for mysql_ssl_set()... *** extconf.rb failed *** Could not create Makefile due to some reason, probably lack of necessary libraries and/or headers. Check the mkmf.log file for more details. You may need configuration options. …… <--snip--> Check log in file .gem/gems/mysql-2.9.1/ext/mysql_api/mkmf.log : "gcc -o conftest -I/opt/rh/ruby193/root/usr/include/x86_64-linux -I/opt/rh/ruby193/root/usr/include/ruby/backward -I/opt/rh/ruby193/root/usr/include -I. -I/opt/rh/mysql55/root/usr/include/mysql -g -pipe -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -fno-strict-aliasing -fwrapv -fPIC -fPIC -g -static-libgcc -fno-omit-frame-pointer -fno-strict-aliasing -DMY_PTHREAD_FASTMUTEX=1 -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -mtune=generic -fPIC conftest.c -L. -L/opt/rh/ruby193/root/usr/lib64 -L. -rdynamic -Wl,-export-dynamic -m64 -L/opt/rh/mysql55/root/usr/lib64/mysql -lmysqlclient -lpthread -lz -lm -lrt -lssl -lcrypto -ldl -lruby -lpthread -lrt -ldl -lcrypt -lm -lc" /usr/bin/ld: cannot find -lmysqlclient
Hi Brenton, Could you merge this fix into enterprise from upstream ASAP?
Upstream commits: commit fb5d46ad01ab9d698404f42fd7f2099dd79a704b Author: jhadvig <jhadvig> Date: Thu Jun 19 09:59:44 2014 +0200 Bug 1109645: Setting mysql2 variable for bundler commit 2068d7d9af300b933c7cb05373bce3dcd0c895cd Author: Michal Fojtik <mfojtik> Date: Mon Jun 23 10:01:13 2014 +0200 Bug 1109645 - Fix the wrong path of libmysqlclient for Ruby 1.8
Verify this bug with openshift-origin-cartridge-ruby-1.23.3.7-1.el6op.noarch on puddle 2.1.z/2014-09-12.1 gem install mysql could work well with both scalable ruby-1.8 and ruby-1.9 cartridge. 1. create one scalable ruby app with cartridge mysql-5.5 rhc app create r19smy55 ruby-1.9 mysql-5.5 -s 2. add Gemfile and Gemfile.lock as below to app repo $ cat Gemfile source 'http://rubygems.org' gem 'sinatra' gem 'mysql' $ cat Gemfile.lock GEM remote: http://rubygems.org/ specs: mysql (2.9.1) rack (1.5.2) rack-protection (1.5.3) rack sinatra (1.4.5) rack (~> 1.4) rack-protection (~> 1.4) tilt (~> 1.3, >= 1.3.4) tilt (1.4.1) PLATFORMS ruby DEPENDENCIES mysql sinatra 3. git push git add .; git commit -am "test"; git push ... remote: Fetching gem metadata from http://rubygems.org/.......... remote: Installing mysql (2.9.1) remote: Installing rack (1.5.2) remote: Installing rack-protection (1.5.3) remote: Installing tilt (1.4.1) remote: Installing sinatra (1.4.5) remote: Using bundler (1.3.5) remote: Cannot write a changed lockfile while frozen. remote: Your bundle is complete! ...
Since the problem described in this bug report should be resolved in a recent advisory, it has been closed with a resolution of ERRATA. For information on the advisory, and where to find the updated files, follow the link below. If the solution does not work for you, open a new bug report. http://rhn.redhat.com/errata/RHBA-2014-1353.html