Bug 1109645 - gem install mysql failed when ruby scalable app with mysql-5.5
Summary: gem install mysql failed when ruby scalable app with mysql-5.5
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: OpenShift Online
Classification: Red Hat
Component: Image
Version: 2.x
Hardware: Unspecified
OS: Unspecified
medium
medium
Target Milestone: ---
: ---
Assignee: Jakub Hadvig
QA Contact: libra bugs
URL:
Whiteboard:
Depends On:
Blocks: 1112139
TreeView+ depends on / blocked
 
Reported: 2014-06-16 03:24 UTC by weiwei jiang
Modified: 2016-10-30 22:54 UTC (History)
7 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
: 1112139 (view as bug list)
Environment:
Last Closed: 2014-07-15 10:30:42 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)

Description weiwei jiang 2014-06-16 03:24:19 UTC
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:

Comment 1 Guolei Sun 2014-06-16 10:34:10 UTC
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.

Comment 2 weiwei jiang 2014-06-19 08:39:10 UTC
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.

Comment 4 openshift-github-bot 2014-06-19 20:52:58 UTC
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

Comment 5 weiwei jiang 2014-06-20 10:13:14 UTC
Checked on both devenv_4897 and devenv-stage_890, still can be reproduced, so assign back.

Comment 6 weiwei jiang 2014-06-20 10:15:29 UTC
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

Comment 7 Ben Parees 2014-06-20 21:38:38 UTC
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.

Comment 8 Michal Fojtik 2014-06-21 07:45:39 UTC
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.

Comment 9 Michal Fojtik 2014-06-21 07:47:14 UTC
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.

Comment 10 weiwei jiang 2014-06-23 03:44:46 UTC
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.

Comment 12 weiwei jiang 2014-06-23 08:29:55 UTC
Checked on devenv-stage_893, and can not reproduce this issue for scalable redmine quickstart with mysql-5.5, so move this to verified.

Comment 13 weiwei jiang 2014-06-23 08:55:45 UTC
(In reply to Michal Fojtik from comment #11)
> https://github.com/openshift/origin-server/pull/5541

(In reply to weiwei jiang from comment #12)
> Checked on devenv-stage_893, and can not reproduce this issue for scalable
> redmine quickstart with mysql-5.5, so move this to verified.

For now, the latest devenv(devenv_4899) can reproduce this issue, but devenv-stage_893 can not reproduce this, and I am confused with this.

Comment 14 Michal Fojtik 2014-06-23 09:23:43 UTC
Weiwei Jiang: The changes are not yet merged to stage and to master... For stage you will have to wait for a new stage cut...

Can you please test this by applying the update manually? Just open this file:

/var/lib/.openshift/cartridge_repository/redhat-ruby/../bin/control

and add this line: https://github.com/openshift/origin-server/pull/5541

You can try on both stage/master. The redmine should work fine.

Comment 15 weiwei jiang 2014-06-23 10:35:48 UTC
Checked on devenv_4899 again, and the bug can not be reproduced after apply the fix code, will try again and verify this after the PR has been merged.

[root@ip-10-183-59-165 bin]# rhc app create r851s ruby-1.8 mysql-5.5 --from-code=https://github.com/openshift/openshift-redmine-quickstart.git -s --no-git 
Application Options
-------------------
Domain:      wjiangf
Cartridges:  ruby-1.8, mysql-5.5
Source Code: https://github.com/openshift/openshift-redmine-quickstart.git
Gear Size:   default
Scaling:     yes

Creating application 'r851s' ... 
The initial build for the application failed: Shell command '/sbin/runuser -s /bin/sh 53a837ab0061c5545c000061 -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/53a837ab0061c5545c000061/app-root/runtime/repo/vendor/bundle/ruby/1.8/gems/mysql-2.8.1 for inspection.
Results logged to /var/lib/openshift/53a837ab0061c5545c000061/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/53a837ab0061c5545c000061/ruby

For more details about the problem, try running the command again with the '--trace' option.

# sed -n '145,158p' /var/lib/openshift/.cartridge_repository/redhat-ruby/0.0.20/bin/control
      fi
      pushd ${OPENSHIFT_REPO_DIR} 1> /dev/null
      SAVED_GIT_DIR=$GIT_DIR
      unset GIT_DIR
      export BUNDLE_BUILD__MYSQL2="--with-mysql-config=/usr/bin/mysql_config"
      export BUNDLE_BUILD__MYSQL="--with-mysql-config=/usr/bin/mysql_config"
      # You can tell bundler to skip installing certain gem group by using
      # $ rhc env set BUNDLE_WITHOUT="group1 group2 ..."
      #
      if [ -z "${BUNDLE_WITHOUT}" ]; then
        echo "bundle install --deployment --path ./app-root/repo/vendor/bundle"
        if groups_in_gemfile ${OPENSHIFT_REPO_DIR}/Gemfile; then
          echo "NOTE: You can prevent installing certain Gemfile group using: rhc env set BUNDLE_WITHOUT=groupname"
        fi

# rhc app create r85s ruby-1.8 mysql-5.5 --from-code=https://github.com/openshift/openshift-redmine-quickstart.git -s --no-git 
Application Options
-------------------
Domain:      wjiangf
Cartridges:  ruby-1.8, mysql-5.5
Source Code: https://github.com/openshift/openshift-redmine-quickstart.git
Gear Size:   default
Scaling:     yes

Creating application 'r85s' ... 


done

  MySQL 5.5 database added.  Please make note of these credentials:

       Root User: adminxXcbec6
   Root Password: nBBPF5LA-Fxu
   Database Name: r85s

Connection URL: mysql://$OPENSHIFT_MYSQL_DB_HOST:$OPENSHIFT_MYSQL_DB_PORT/

You can manage your new MySQL database by also embedding phpmyadmin.
The phpmyadmin username and password will be the same as the MySQL credentials above.

Waiting for your DNS name to be available ... done

Your application 'r85s' is now available.

  URL:        http://r85s-wjiangf.dev.rhcloud.com/
  SSH to:     53a8366b0061c5545c000001.rhcloud.com
  Git remote: ssh://53a8366b0061c5545c000001.rhcloud.com/~/git/r85s.git/

Run 'rhc show-app r85s' for more details about your app.

Comment 16 openshift-github-bot 2014-06-23 14:07:53 UTC
Commit pushed to master at https://github.com/openshift/origin-server

https://github.com/openshift/origin-server/commit/2068d7d9af300b933c7cb05373bce3dcd0c895cd
Bug 1109645 - Fix the wrong path of libmysqlclient for Ruby 1.8

Comment 17 weiwei jiang 2014-06-24 06:45:53 UTC
Checked on devenv-stage_894, and can not reproduce this issue, so verify this.


Note You need to log in before you can comment on or make changes to this bug.