Error installing mysql2 gem on Ubuntu Server 11.10: /usr/bin/ld: cannot find -lmysqlclient_r - ruby

I got the same error on Ubuntu Server 11.10 x64 mentioned in some other posts:
Post #1
Post #2
The mysql2 gem cannot be compiled due "cannot find -lmysqlclient_r "
I'm using:
Ruby v1.8.7
MySQL v5.5.25-1
Rails 3.2.3
Gem 1.8.24
I installed the package libmysqlclient-dev and it still doesn't work.
The files
- libmysqlclient_r.a
- libmysqlclient_r.so
- libmysqlclient_r.so.18
- libmysqlclient_r.so.18.0.0
are located at /usr/lib/x86_64-linux-gnu/
So I created symlinks in /usr/lib/
Ii still doesn't work :(
Any idea??
$ sudo gem install mysql2
Building native extensions. This could take a while...
ERROR: Error installing mysql2:
ERROR: Failed to build gem native extension.
/usr/bin/ruby1.8 extconf.rb
checking for rb_thread_blocking_region()... no
checking for rb_wait_for_single_fd()... no
checking for mysql.h... yes
checking for errmsg.h... yes
checking for mysqld_error.h... yes
creating Makefile
make
gcc -I. -I. -I/usr/lib/ruby/1.8/x86_64-linux -I. -DHAVE_MYSQL_H -DHAVE_ERRMSG_H -DHAVE_MYSQLD_ERROR_H -I/usr/include/mysql -DBIG_JOINS=1 -fno-strict-aliasing -g -fPIC -fno-strict-aliasing -g -g -O2 -fPIC -Wall -funroll-loops -c mysql2_ext.c
./client.h:16:1: warning: ârb_thread_blocking_regionâ defined but not used [-Wunused-function]
gcc -I. -I. -I/usr/lib/ruby/1.8/x86_64-linux -I. -DHAVE_MYSQL_H -DHAVE_ERRMSG_H -DHAVE_MYSQLD_ERROR_H -I/usr/include/mysql -DBIG_JOINS=1 -fno-strict-aliasing -g -fPIC -fno-strict-aliasing -g -g -O2 -fPIC -Wall -funroll-loops -c result.c
result.c: In function ârb_mysql_result_fetch_rowâ:
result.c:258:31: warning: variable âtokensâ set but not used [-Wunused-but-set-variable]
result.c:272:58: warning: variable âtokensâ set but not used [-Wunused-but-set-variable]
result.c:315:33: warning: variable âtokensâ set but not used [-Wunused-but-set-variable]
gcc -I. -I. -I/usr/lib/ruby/1.8/x86_64-linux -I. -DHAVE_MYSQL_H -DHAVE_ERRMSG_H -DHAVE_MYSQLD_ERROR_H -I/usr/include/mysql -DBIG_JOINS=1 -fno-strict-aliasing -g -fPIC -fno-strict-aliasing -g -g -O2 -fPIC -Wall -funroll-loops -c client.c
client.c: In function ârb_mysql_client_infoâ:
client.c:539:3: warning: variable âwrapperâ set but not used [-Wunused-but-set-variable]
gcc -shared -o mysql2.so mysql2_ext.o result.o client.o -L. -L/usr/lib -L. -Wl,-Bsymbolic-functions -rdynamic -Wl,-export-dynamic -Wl,-rpath,/usr/lib/x86_64-linux-gnu -lruby1.8 -L/usr/lib/x86_64-linux-gnu -lmysqlclient_r -lpthread -lz -lm -lrt -ldl -lpthread -lrt -ldl -lcrypt -lm -lc
/usr/bin/ld: cannot find -lmysqlclient_r
collect2: ld returned 1 exit status
make: *** [mysql2.so] Error 1

Related

"ld: library not found for -lc" in mac big sur

I try to writed a redis module by clone the git project https://github.com/RedisLabs/RedisModulesSDK.git
and type the "Make" command in my mac with big sur version, below message display in the console.
But there is a error "ld: library not found for -lc".
How to fix it. I try the same command in a linux os, it works find.
gcc -g -fPIC -O3 -std=gnu99 -Wall -Wno-unused-function -I../ -c -o util.o util.c
gcc -g -fPIC -O3 -std=gnu99 -Wall -Wno-unused-function -I../ -c -o strings.o strings.c
gcc -g -fPIC -O3 -std=gnu99 -Wall -Wno-unused-function -I../ -c -o sds.o sds.c
gcc -g -fPIC -O3 -std=gnu99 -Wall -Wno-unused-function -I../ -c -o vector.o vector.c
gcc -g -fPIC -O3 -std=gnu99 -Wall -Wno-unused-function -I../ -c -o alloc.o alloc.c
gcc -g -fPIC -O3 -std=gnu99 -Wall -Wno-unused-function -I../ -c -o periodic.o periodic.c
ar rcs librmutil.a util.o strings.o sds.o vector.o alloc.o periodic.o
gcc -I../ -Wall -g -fPIC -lc -lm -std=gnu99 -c -o module.o module.c
clang: warning: -lc: 'linker' input unused [-Wunused-command-line-argument]
clang: warning: -lm: 'linker' input unused [-Wunused-command-line-argument]
ld -o module.so module.o -bundle -undefined dynamic_lookup -v -L../rmutil -lrmutil -lc
#(#)PROGRAM:ld PROJECT:ld64-609.8
BUILD 15:07:46 Dec 18 2020
configured to support archs: armv6 armv7 armv7s arm64 arm64e arm64_32 i386 x86_64 x86_64h armv6m armv7k armv7m armv7em
Library search paths:
../rmutil
/usr/lib
/usr/local/lib
Framework search paths:
/Library/Frameworks/
/System/Library/Frameworks/
ld: library not found for -lc
make[1]: *** [module.so] Error 1
make: *** [module.so] Error 2
To prevent this error on 11.x+: ld: library not found for -lc
the path /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/lib needs to be added with -L
https://github.com/macports/macports-ports/commit/0a780d32e0ae3997ed2f2d611cee604d1476cdb5

Problems compiling Qt with OCI sql plugin on Linux

I am having serious trouble compiling Qt with the OCI plugin.
The Qt version is 5.6.1, and the Oracle instant client version is 12.1.0.2.0. I have installed both the basic and SDK versions, as the Qt online manual asks.
I then try to run the following command:
./configure -I /usr/include/oracle/12.1/client64/ -L /usr/lib/oracle/12.1/client64/lib -prefix /online/daq/antonin/qt_build -plugin-sql-oci -qt-xcb -v
Which produces this output:
+ cd qtbase
+ /online/daq/antonin/qt_source/5.6/Src/qtbase/configure -top-level -I /usr/include/oracle/12.1/client64/ -L /usr/lib/oracle/12.1/client64/lib -prefix /online/daq/antonin/qt_build -plugin-sql-oci -qt-xcb -v
Which edition of Qt do you want to use ?
Type 'c' if you want to use the Commercial Edition.
Type 'o' if you want to use the Open Source Edition.
o
This is the Qt Open Source Edition.
You are licensed to use this software under the terms of
the Lesser GNU General Public License (LGPL) versions 2.1.
You are also licensed to use this software under the terms of
the GNU Lesser General Public License (LGPL) versions 3.
Type '3' to view the GNU Lesser General Public License version 3.
Type 'L' to view the Lesser GNU General Public License version 2.1.
Type 'yes' to accept this license offer.
Type 'no' to decline this license offer.
Do you accept the terms of either license? yes
Running configuration tests (phase 1)...
Precompiled-headers support enabled.
g++ -c -fvisibility=hidden fvisibility.c
Symbol visibility control enabled.
cc1plus: error: unrecognized command line option "-fuse-ld=gold"
g++ -o libtest.so -shared -Wl,-Bsymbolic-functions -fPIC bsymbolic_functions.c
Symbolic function binding enabled.
DEFAULT_INCDIRS="/usr/include/c++/4.4.7
/usr/include/c++/4.4.7/x86_64-redhat-linux
/usr/include/c++/4.4.7/backward
/usr/local/include
/usr/lib/gcc/x86_64-redhat-linux/4.4.7/include
/usr/include
"
DEFAULT_LIBDIRS="/lib64
/usr/lib64
/online/daq/lib
/usr/lib
/lib
/usr/lib/gcc/x86_64-redhat-linux/4.4.7
"
Done running configuration tests.
Creating qmake...
gmake: Nothing to be done for `first'.
Running configuration tests (phase 2)...
Found pkg-config from $PATH: /usr/bin/pkg-config
Determining architecture... ()
g++ -c -pipe -g -std=gnu++0x -Wall -W -fPIC -I. -isystem /usr/include/oracle/12.1/client64 -I../../mkspecs/linux-g++ -o arch.o arch.cpp
g++ -o arch arch.o -L/usr/lib/oracle/12.1/client64/lib
Found architecture in binary
CFG_ARCH="x86_64"
CFG_CPUFEATURES=" mmx sse sse2"
System architecture: 'x86_64'
Host architecture: 'x86_64'
C++11 auto-detection... ()
g++ -c -pipe -O2 -std=gnu++0x -Wall -W -fPIC -I. -isystem /usr/include/oracle/12.1/client64 -I../../../mkspecs/linux-g++ -o c++11.o c++11.cpp
g++ -Wl,-O1 -o c++11 c++11.o -L/usr/lib/oracle/12.1/client64/lib
C++11 enabled.
C++14 auto-detection... ()
g++ -c -pipe -O2 -std=gnu++1y -Wall -W -fPIC -I. -isystem /usr/include/oracle/12.1/client64 -I../../../mkspecs/linux-g++ -o c++14.o c++14.cpp
cc1plus: error: unrecognized command line option "-std=gnu++1y"
gmake: *** [c++14.o] Error 1
C++14 disabled.
default C++ standard edition auto-detection... ()
g++ -pipe -O2 -Wall -W -fPIC -I. -isystem /usr/include/oracle/12.1/client64 -I../../../mkspecs/linux-g++ -o c++default.ii -E c++default.cpp
default C++ standard edition enabled.
64-bit std::atomic auto-detection... ()
g++ -c -pipe -O2 -std=gnu++0x -Wall -W -fPIC -I. -isystem /usr/include/oracle/12.1/client64 -I../../../mkspecs/linux-g++ -o atomic64.o atomic64.cpp
atomic64.cpp:34:18: error: atomic: No such file or directory
atomic64.cpp:37: error: expected unqualified-id before '<' token
atomic64.cpp:37: error: expected ')' before '<' token
atomic64.cpp:37: error: expected initializer before '<' token
gmake: *** [atomic64.o] Error 1
64-bit std::atomic disabled.
64-bit std::atomic in -latomic auto-detection... ()
g++ -c -pipe -O2 -std=gnu++0x -Wall -W -fPIC -I. -isystem /usr/include/oracle/12.1/client64 -I../../../mkspecs/linux-g++ -o atomic64.o atomic64.cpp
atomic64.cpp:34:18: error: atomic: No such file or directory
atomic64.cpp:37: error: expected unqualified-id before '<' token
atomic64.cpp:37: error: expected ')' before '<' token
atomic64.cpp:37: error: expected initializer before '<' token
gmake: *** [atomic64.o] Error 1
64-bit std::atomic in -latomic disabled.
sse2 auto-detection... ()
g++ -c -pipe -msse2 -g -std=gnu++0x -Wall -W -fPIC -I. -isystem /usr/include/oracle/12.1/client64 -I../../../mkspecs/linux-g++ -o sse2.o sse2.cpp
g++ -o sse2 sse2.o -L/usr/lib/oracle/12.1/client64/lib
sse2 enabled.
sse3 auto-detection... ()
g++ -c -pipe -msse3 -g -std=gnu++0x -Wall -W -fPIC -I. -isystem /usr/include/oracle/12.1/client64 -I../../../mkspecs/linux-g++ -o sse3.o sse3.cpp
g++ -o sse3 sse3.o -L/usr/lib/oracle/12.1/client64/lib
sse3 enabled.
ssse3 auto-detection... ()
g++ -c -pipe -mssse3 -g -std=gnu++0x -Wall -W -fPIC -I. -isystem /usr/include/oracle/12.1/client64 -I../../../mkspecs/linux-g++ -o ssse3.o ssse3.cpp
g++ -o ssse3 ssse3.o -L/usr/lib/oracle/12.1/client64/lib
ssse3 enabled.
sse4_1 auto-detection... ()
g++ -c -pipe -msse4.1 -g -std=gnu++0x -Wall -W -fPIC -I. -isystem /usr/include/oracle/12.1/client64 -I../../../mkspecs/linux-g++ -o sse4_1.o sse4_1.cpp
g++ -o sse4_1 sse4_1.o -L/usr/lib/oracle/12.1/client64/lib
sse4_1 enabled.
sse4_2 auto-detection... ()
g++ -c -pipe -msse4.2 -g -std=gnu++0x -Wall -W -fPIC -I. -isystem /usr/include/oracle/12.1/client64 -I../../../mkspecs/linux-g++ -o sse4_2.o sse4_2.cpp
g++ -o sse4_2 sse4_2.o -L/usr/lib/oracle/12.1/client64/lib
sse4_2 enabled.
avx auto-detection... ()
g++ -c -pipe -mavx -g -std=gnu++0x -Wall -W -fPIC -I. -isystem /usr/include/oracle/12.1/client64 -I../../../mkspecs/linux-g++ -o avx.o avx.cpp
g++ -o avx avx.o -L/usr/lib/oracle/12.1/client64/lib
avx enabled.
avx2 auto-detection... ()
g++ -c -pipe -mavx2 -g -std=gnu++0x -Wall -W -fPIC -I. -isystem /usr/include/oracle/12.1/client64 -I../../../mkspecs/linux-g++ -o avx2.o avx2.cpp
cc1plus: error: unrecognized command line option "-mavx2"
gmake: *** [avx2.o] Error 1
avx2 disabled.
ipc_sysv auto-detection... ()
g++ -c -pipe -O2 -std=gnu++0x -Wall -W -fPIC -I. -isystem /usr/include/oracle/12.1/client64 -I../../../mkspecs/linux-g++ -o ipc.o ipc.cpp
g++ -Wl,-O1 -o ipc_sysv ipc.o -L/usr/lib/oracle/12.1/client64/lib
ipc_sysv enabled.
zlib auto-detection... ()
g++ -c -pipe -O2 -std=gnu++0x -Wall -W -fPIC -I. -isystem /usr/include/oracle/12.1/client64 -I../../../mkspecs/linux-g++ -o zlib.o zlib.cpp
g++ -Wl,-O1 -o zlib zlib.o -L/usr/lib/oracle/12.1/client64/lib -lz
zlib enabled.
mtdev auto-detection... ()
Project ERROR: mtdev development package not found
mtdev disabled.
libjpeg auto-detection... ()
g++ -c -pipe -O2 -std=gnu++0x -Wall -W -fPIC -I. -isystem /usr/include/oracle/12.1/client64 -I../../../mkspecs/linux-g++ -o libjpeg.o libjpeg.cpp
libjpeg.cpp: In function 'int main(int, char**)':
libjpeg.cpp:43: warning: 'cinfo' is used uninitialized in this function
g++ -Wl,-O1 -o libjpeg libjpeg.o -L/usr/lib/oracle/12.1/client64/lib -ljpeg
libjpeg enabled.
libpng auto-detection... ()
g++ -c -pipe -O2 -std=gnu++0x -Wall -W -fPIC -I. -isystem /usr/include/oracle/12.1/client64 -I../../../mkspecs/linux-g++ -o libpng.o libpng.cpp
g++ -Wl,-O1 -o libpng libpng.o -L/usr/lib/oracle/12.1/client64/lib -lpng
libpng enabled.
libdl auto-detection... ()
g++ -c -pipe -O2 -std=gnu++0x -Wall -W -fPIC -I. -isystem /usr/include/oracle/12.1/client64 -I../../../mkspecs/linux-g++ -o libdl.o libdl.cpp
g++ -Wl,-O1 -o libdl libdl.o -L/usr/lib/oracle/12.1/client64/lib -ldl
libdl enabled.
DB2 auto-detection... ()
g++ -c -pipe -O2 -std=gnu++0x -Wall -W -fPIC -I. -isystem /usr/include/oracle/12.1/client64 -I../../../mkspecs/linux-g++ -o db2.o db2.cpp
db2.cpp:34:20: error: sqlcli.h: No such file or directory
db2.cpp:35:21: error: sqlcli1.h: No such file or directory
gmake: *** [db2.o] Error 1
DB2 disabled.
InterBase auto-detection... ()
g++ -c -pipe -O2 -std=gnu++0x -Wall -W -fPIC -I. -isystem /usr/include/oracle/12.1/client64 -I../../../mkspecs/linux-g++ -o ibase.o ibase.cpp
ibase.cpp:34:19: error: ibase.h: No such file or directory
gmake: *** [ibase.o] Error 1
InterBase disabled.
MySQL (thread-safe) auto-detection... ()
g++ -c -pipe -O2 -std=gnu++0x -Wall -W -fPIC -I. -isystem /usr/include/oracle/12.1/client64 -isystem /usr/include/mysql -I../../../mkspecs/linux-g++ -o mysql.o ../mysql/mysql.cpp
g++ -Wl,-O1 -o mysql_r mysql.o -L/usr/lib/oracle/12.1/client64/lib -L/usr/lib64/mysql -lz -lcrypt -lnsl -lm -lpthread -lssl -lcrypto -lmysqlclient_r
MySQL (thread-safe) enabled.
OCI auto-detection... ()
g++ -c -pipe -O2 -std=gnu++0x -Wall -W -fPIC -I. -isystem /usr/include/oracle/12.1/client64 -I../../../mkspecs/linux-g++ -o oci.o oci.cpp
g++ -Wl,-O1 -o oci oci.o -L/usr/lib/oracle/12.1/client64/lib -lclntsh
/usr/lib/oracle/12.1/client64/lib/libclntsh.so: undefined reference to `lxXmlCvEsc0'
/usr/lib/oracle/12.1/client64/lib/libclntsh.so: undefined reference to `lxXmlGEntEscImpl'
/usr/lib/oracle/12.1/client64/lib/libclntsh.so: undefined reference to `slnxmul'
/usr/lib/oracle/12.1/client64/lib/libclntsh.so: undefined reference to `zt_init'
/usr/lib/oracle/12.1/client64/lib/libclntsh.so: undefined reference to `slnxadd'
/usr/lib/oracle/12.1/client64/lib/libclntsh.so: undefined reference to `slnxsub'
collect2: ld returned 1 exit status
gmake: *** [oci] Error 1
OCI disabled.
Oracle (OCI) support cannot be enabled due to functionality tests!
Turn on verbose messaging (-v) to /online/daq/antonin/qt_source/5.6/Src/qtbase/configure to see the final report.
If you believe this message is in error you may use the continue
switch (-continue) to /online/daq/antonin/qt_source/5.6/Src/qtbase/configure to continue.
As you can see, there are several undefined references for one of the the OCI .so files. I have tried checking online, but I have found barely any references to these symbols.
Any idea what could be causing this? A missing .so file? Wrong version of the library?

R package installation is successful on all machines but one

We are a team working on an R package containing C/C++ code. The package can successfully be installed on all the machines but one. These all run the same version of Mac OS X. I have provided the log files for the installation of the package on my computer (success) and a colleague's computer (error). The package depends on the Rcpp package and the GSL library, both of which were successfully installed on both machines.
My Computer
WARNING: ignoring environment value of R_HOME
* installing to library '/Users/dejayn/R/x86_64-apple-darwin10.8.0-library/2.15'
* installing *source* package 'mrenci' ...
** libs
*** arch - x86_64
/opt/local/bin/g++-mp-4.5 -I/opt/local/lib/R/include -I/opt/local/lib/R/include/x86_64 -DNDEBUG -fopenmp -fopenmp -I/opt/local/include -I"/Users/dejayn/R/x86_64-apple-darwin10.8.0-library/2.15/Rcpp/include" -fPIC -pipe -O2 -m64 -c MRMRTree.cc -o MRMRTree.o
/opt/local/bin/g++-mp-4.5 -I/opt/local/lib/R/include -I/opt/local/lib/R/include/x86_64 -DNDEBUG -fopenmp -fopenmp -I/opt/local/include -I"/Users/dejayn/R/x86_64-apple-darwin10.8.0-library/2.15/Rcpp/include" -fPIC -pipe -O2 -m64 -c Matrix.cc -o Matrix.o
/opt/local/bin/g++-mp-4.5 -I/opt/local/lib/R/include -I/opt/local/lib/R/include/x86_64 -DNDEBUG -fopenmp -fopenmp -I/opt/local/include -I"/Users/dejayn/R/x86_64-apple-darwin10.8.0-library/2.15/Rcpp/include" -fPIC -pipe -O2 -m64 -c MiMBuilder.cc -o MiMBuilder.o
/opt/local/bin/g++-mp-4.5 -I/opt/local/lib/R/include -I/opt/local/lib/R/include/x86_64 -DNDEBUG -fopenmp -fopenmp -I/opt/local/include -I"/Users/dejayn/R/x86_64-apple-darwin10.8.0-library/2.15/Rcpp/include" -fPIC -pipe -O2 -m64 -c SymmetricMatrix.cc -o SymmetricMatrix.o
/opt/local/bin/g++-mp-4.5 -I/opt/local/lib/R/include -I/opt/local/lib/R/include/x86_64 -DNDEBUG -fopenmp -fopenmp -I/opt/local/include -I"/Users/dejayn/R/x86_64-apple-darwin10.8.0-library/2.15/Rcpp/include" -fPIC -pipe -O2 -m64 -c adaptor.cc -o adaptor.o
/opt/local/bin/g++-mp-4.5 -I/opt/local/lib/R/include -I/opt/local/lib/R/include/x86_64 -DNDEBUG -fopenmp -fopenmp -I/opt/local/include -I"/Users/dejayn/R/x86_64-apple-darwin10.8.0-library/2.15/Rcpp/include" -fPIC -pipe -O2 -m64 -c memory.cc -o memory.o
/opt/local/bin/g++-mp-4.5 -I/opt/local/lib/R/include -I/opt/local/lib/R/include/x86_64 -DNDEBUG -fopenmp -fopenmp -I/opt/local/include -I"/Users/dejayn/R/x86_64-apple-darwin10.8.0-library/2.15/Rcpp/include" -fPIC -pipe -O2 -m64 -c tools.cc -o tools.o
/opt/local/bin/g++-mp-4.5 -dynamiclib -Wl,-headerpad_max_install_names -undefined dynamic_lookup -single_module -multiply_defined suppress -L/opt/local/lib -o mrenci.so MRMRTree.o Matrix.o MiMBuilder.o SymmetricMatrix.o adaptor.o memory.o tools.o /Users/dejayn/R/x86_64-apple-darwin10.8.0-library/2.15/Rcpp/lib/x86_64/libRcpp.a -fopenmp -fopenmp -L/opt/local/lib/R/lib/x86_64 -lR
installing to /Users/dejayn/R/x86_64-apple-darwin10.8.0-library/2.15/mrenci/libs/x86_64
** R
** preparing package for lazy loading
** testing if installed package can be loaded
* DONE (mrenci)
Colleague's Computer
WARNING: ignoring environment value of R_HOME
* installing to library '/Library/Frameworks/R.framework/Versions/2.15/Resources/library'
* installing *source* package 'mrenci' ...
** libs
*** arch - x86_64
g++ -arch x86_64 -I/Library/Frameworks/R.framework/Resources/include -I/Library/Frameworks/R.framework/Resources/include/x86_64 -DNDEBUG  -fopenmp -I/usr/local/include -I"/Library/Frameworks/R.framework/Versions/2.15/Resources/library/Rcpp/include"   -fPIC  -g -O2  -c MRMRTree.cc -o MRMRTree.o
MRMRTree.cc: In member function 'double* const MRMRTree::bootstrap(unsigned int)':
MRMRTree.cc:73: warning: iteration variable 'i' is unsigned
g++ -arch x86_64 -I/Library/Frameworks/R.framework/Resources/include -I/Library/Frameworks/R.framework/Resources/include/x86_64 -DNDEBUG  -fopenmp -I/usr/local/include -I"/Library/Frameworks/R.framework/Versions/2.15/Resources/library/Rcpp/include"   -fPIC  -g -O2  -c Matrix.cc -o Matrix.o
g++ -arch x86_64 -I/Library/Frameworks/R.framework/Resources/include -I/Library/Frameworks/R.framework/Resources/include/x86_64 -DNDEBUG  -fopenmp -I/usr/local/include -I"/Library/Frameworks/R.framework/Versions/2.15/Resources/library/Rcpp/include"   -fPIC  -g -O2  -c MiMBuilder.cc -o MiMBuilder.o
MiMBuilder.cc: In member function 'Matrix* const MiMBuilder::createMiM(unsigned int*, unsigned int, unsigned int*, unsigned int)':
MiMBuilder.cc:102: warning: iteration variable 'i' is unsigned
g++ -arch x86_64 -I/Library/Frameworks/R.framework/Resources/include -I/Library/Frameworks/R.framework/Resources/include/x86_64 -DNDEBUG  -fopenmp -I/usr/local/include -I"/Library/Frameworks/R.framework/Versions/2.15/Resources/library/Rcpp/include"   -fPIC  -g -O2  -c SymmetricMatrix.cc -o SymmetricMatrix.o
g++ -arch x86_64 -I/Library/Frameworks/R.framework/Resources/include -I/Library/Frameworks/R.framework/Resources/include/x86_64 -DNDEBUG  -fopenmp -I/usr/local/include -I"/Library/Frameworks/R.framework/Versions/2.15/Resources/library/Rcpp/include"   -fPIC  -g -O2  -c adaptor.cc -o adaptor.o
g++ -arch x86_64 -I/Library/Frameworks/R.framework/Resources/include -I/Library/Frameworks/R.framework/Resources/include/x86_64 -DNDEBUG  -fopenmp -I/usr/local/include -I"/Library/Frameworks/R.framework/Versions/2.15/Resources/library/Rcpp/include"   -fPIC  -g -O2  -c memory.cc -o memory.o
g++ -arch x86_64 -I/Library/Frameworks/R.framework/Resources/include -I/Library/Frameworks/R.framework/Resources/include/x86_64 -DNDEBUG  -fopenmp -I/usr/local/include -I"/Library/Frameworks/R.framework/Versions/2.15/Resources/library/Rcpp/include"   -fPIC  -g -O2  -c tools.cc -o tools.o
g++ -arch x86_64 -dynamiclib -Wl,-headerpad_max_install_names -undefined dynamic_lookup -single_module -multiply_defined suppress -L/usr/local/lib -o mrenci.so MRMRTree.o Matrix.o MiMBuilder.o SymmetricMatrix.o adaptor.o memory.o tools.o /Library/Frameworks/R.framework/Versions/2.15/Resources/library/Rcpp/lib/x86_64/libRcpp.a -F/Library/Frameworks/R.framework/.. -framework R -Wl,-framework -Wl,CoreFoundation
installing to /Library/Frameworks/R.framework/Versions/2.15/Resources/library/mrenci/libs/x86_64
** R
** preparing package for lazy loading
** testing if installed package can be loaded
Error in dyn.load(file, DLLpath = DLLpath, ...) :
 unable to load shared object '/Library/Frameworks/R.framework/Versions/2.15/Resources/library/mrenci/libs/x86_64/mrenci.so':
 dlopen(/Library/Frameworks/R.framework/Versions/2.15/Resources/library/mrenci/libs/x86_64/mrenci.so, 6): Symbol not found: _GOMP_critical_name_end
 Referenced from: /Library/Frameworks/R.framework/Versions/2.15/Resources/library/mrenci/libs/x86_64/mrenci.so
 Expected in: flat namespace
in /Library/Frameworks/R.framework/Versions/2.15/Resources/library/mrenci/libs/x86_64/mrenci.so
Error: loading failed
Execution halted
ERROR: loading failed
* removing '/Library/Frameworks/R.framework/Versions/2.15/Resources/library/mrenci'
At first, the installation on my colleague's computer would result in the compilation of the package for both architectures, upon which g++ complained about an unknown -arch argument. This issue, however, appears to have been mitigated by forcing the targeting of a single architecture x86_64. It is also worth noting that as a result of these errors, all computers now have several versions of R and g++. Is this an issue with the linker? Does the same compiler need to be used for both R and its packages? In the case of my computer, I never explicitly asked for g++-mp-4.5 to be used rather than the default g++ (version 4.2), so I figured R automatically detects it.
In case this is of any help, here is what my Makevars contains:
PKG_LIBS=`$(R_HOME)/bin/Rscript -e "Rcpp:::LdFlags()"` $(SHLIB_OPENMP_CFLAGS) -fopenmp
PKG_CPPFLAGS=$(SHLIB_OPENMP_CXXFLAGS) -fopenmp
PKG_CFLAGS=$(SHLIB_OPENMP_CFLAGS) -fopenmp
The $(SHLIB_OPENMP_*FLAGS) flags seem to be defined only on my computer; -fopenmp flags were explicitly added for the package to work on all the machines.
Has anyone experienced similar issues? Any help would be appreciated.
I changed my colleague's ~/.R/Makevars to conform to my configs
LDFLAGS=-L/opt/local/lib
CC=/opt/local/bin/gcc-mp-4.5 -std=gnu99
CXX=/opt/local/bin/g++-mp-4.5
CPP=/opt/local/bin/gcc-mp-4.5 -std=gnu99 -E
CXXCPP=/opt/local/bin/g++-mp-4.5 -E
CFLAGS=-pipe -O2 -m64
CXXFLAGS=-pipe -O2 -m64
SHLIB_CXXLD=/opt/local/bin/g++-mp-4.5
SHLIB_CXXLDFLAGS=-dynamiclib -Wl,-headerpad_max_install_names -undefined dynamic_lookup -single_module -multiply_defined suppress
SHLIB_LD=/opt/local/bin/gcc-mp-4.5 -std=gnu99
SHLIB_LDFLAGS=-dynamiclib -Wl,-headerpad_max_install_names -undefined dynamic_lookup -single_module -multiply_defined suppress
Additionally, the --no-multiarch argument was used when issuing the installation command. And it now works on his computer.
The problem was because the use of openMP was hardwired (no checks) inside the code and clang did not support openMP at the same I asked the question. My colleague's R was installed using the default (Xcode) compiler when we were trying to use gcc via Mac Ports.

i have an error when i install gsl (with netbeans)

I try to install gsl gem for Ruby but it doesn't work. i have a matrix_complex.o error.
So is there a solution to install gsl for netbeans ?
or is there a fonction quantile in an other library?
Any help would be appreciated.
stagiaire#stagiaire-desktop:~$ sudo gem install -v=1.14.7 gsl
Building native extensions. This could take a while...
ERROR: Error installing gsl:
ERROR: Failed to build gem native extension.
/usr/bin/ruby1.8 extconf.rb
checking gsl version... 1.15
checking gsl cflags... -I/usr/include
checking for main() in -lcblas... no
checking gsl libs... -L/usr/lib -lgsl -lgslcblas -lm
checking for round()... no
checking for rngextra/rngextra.h... no
checking for qrngextra/qrngextra.h... no
checking for ool/ool_version.h... no
checking for tensor/tensor.h... no
checking for jacobi.h... no
checking for gsl/gsl_cqp.h... no
checking for gsl/gsl_multimin_fsdf.h... no
checking for gsl_poly_solve_quartic() in -lgsl... no
checking for gsl_eigen_francis() in -lgsl... yes
checking for ndlinear/gsl_multifit_ndlinear.h... no
checking for alf/alf.h... no
checking rb-gsl version...1.14.7
checking ruby version... 1.8.7
checking for graph... no
checking for narray.h... yes
checking for tamu_anova/tamu_anova.h... no
checking for main() in -ltamuanova... no
creating Makefile
make
gcc -I. -I. -I/usr/lib/ruby/1.8/i686-linux -I. -DHAVE_NARRAY_H -I/var/lib/gems/1.8/gems /narray-0.6.0.1/. -I/usr/local/lib/site_ruby/1.8/i686-linux -D_FILE_OFFSET_BITS=64 -fPIC -Wall -I../include -I/usr/include -c sf_debye.c
gcc -I. -I. -I/usr/lib/ruby/1.8/i686-linux -I. -DHAVE_NARRAY_H -I/var/lib/gems/1.8/gems /narray-0.6.0.1/. -I/usr/local/lib/site_ruby/1.8/i686-linux -D_FILE_OFFSET_BITS=64 -fPIC -Wall -I../include -I/usr/include -c histogram.c
histogram.c: In function ‘rb_gsl_histogram_fit_exponential’:
histogram.c:1029:24: attention : variable ‘hh’ set but not used [-Wunused-but-set-variable]
histogram.c: In function ‘rb_gsl_histogram_fit_power’:
histogram.c:1079:24: attention : variable ‘hh’ set but not used [-Wunused-but-set-variable]
gcc -I. -I. -I/usr/lib/ruby/1.8/i686-linux -I. -DHAVE_NARRAY_H -I/var/lib/gems/1.8/gems/narray-0.6.0.1/. -I/usr/local/lib/site_ruby/1.8/i686-linux -D_FILE_OFFSET_BITS=64 -fPIC -Wall -I../include -I/usr/include -c eigen.c
gcc -I. -I. -I/usr/lib/ruby/1.8/i686-linux -I. -DHAVE_NARRAY_H -I/var/lib/gems/1.8/gems/narray-0.6.0.1/. -I/usr/local/lib/site_ruby/1.8/i686-linux -D_FILE_OFFSET_BITS=64 -fPIC -Wall -I../include -I/usr/include -c histogram_oper.c
gcc -I. -I. -I/usr/lib/ruby/1.8/i686-linux -I. -DHAVE_NARRAY_H -I/var/lib/gems/1.8/gems/narray-0.6.0.1/. -I/usr/local/lib/site_ruby/1.8/i686-linux -D_FILE_OFFSET_BITS=64 -fPIC -Wall -I../include -I/usr/include -c signal.c
signal.c: In function ‘rb_gsl_fft_conv_corr’:
signal.c:108:28: attention : variable ‘stride3’ set but not used [-Wunused-but-set-variable]
gcc -I. -I. -I/usr/lib/ruby/1.8/i686-linux -I. -DHAVE_NARRAY_H -I/var/lib/gems/1.8/gems/narray-0.6.0.1/. -I/usr/local/lib/site_ruby/1.8/i686-linux -D_FILE_OFFSET_BITS=64 -fPIC -Wall -I../include -I/usr/include -c graph.c
graph.c:974:13: attention : ‘gsl_graph_set_command’ defined but not used [-Wunused-function]
gcc -I. -I. -I/usr/lib/ruby/1.8/i686-linux -I. -DHAVE_NARRAY_H -I/var/lib/gems/1.8/gems/narray-0.6.0.1/. -I/usr/local/lib/site_ruby/1.8/i686-linux -D_FILE_OFFSET_BITS=64 -fPIC -Wall -I../include -I/usr/include -c sf_zeta.c
gcc -I. -I. -I/usr/lib/ruby/1.8/i686-linux -I. -DHAVE_NARRAY_H -I/var/lib/gems/1.8/gems/narray-0.6.0.1/. -I/usr/local/lib/site_ruby/1.8/i686-linux -D_FILE_OFFSET_BITS=64 -fPIC -Wall -I../include -I/usr/include -c sf_elljac.c
sf_elljac.c: In function ‘rb_gsl_sf_elljac_e’:
sf_elljac.c:18:7: attention : variable ‘status’ set but not used [-Wunused-but-set-variable]
gcc -I. -I. -I/usr/lib/ruby/1.8/i686-linux -I. -DHAVE_NARRAY_H -I/var/lib/gems/1.8/gems/narray-0.6.0.1/. -I/usr/local/lib/site_ruby/1.8/i686-linux -D_FILE_OFFSET_BITS=64 -fPIC -Wall -I../include -I/usr/include -c ieee.c
gcc -I. -I. -I/usr/lib/ruby/1.8/i686-linux -I. -DHAVE_NARRAY_H -I/var/lib/gems/1.8/gems/narray-0.6.0.1/. -I/usr/local/lib/site_ruby/1.8/i686-linux -D_FILE_OFFSET_BITS=64 -fPIC -Wall -I../include -I/usr/include -c array_complex.c
array_complex.c: In function ‘rb_gsl_complex_arithmetics5’:
array_complex.c:34:9: attention : variable ‘func3’ set but not used [-Wunused-but-set-variable]
array_complex.c:33:9: attention : variable ‘func2’ set but not used [-Wunused-but-set-variable]
gcc -I. -I. -I/usr/lib/ruby/1.8/i686-linux -I. -DHAVE_NARRAY_H -I/var/lib/gems/1.8/gems/narray-0.6.0.1/. -I/usr/local/lib/site_ruby/1.8/i686-linux -D_FILE_OFFSET_BITS=64 -fPIC -Wall -I../include -I/usr/include -c histogram3d_source.c
gcc -I. -I. -I/usr/lib/ruby/1.8/i686-linux -I. -DHAVE_NARRAY_H -I/var/lib/gems/1.8/gems/narray-0.6.0.1/. -I/usr/local/lib/site_ruby/1.8/i686-linux -D_FILE_OFFSET_BITS=64 -fPIC -Wall -I../include -I/usr/include -c vector_double.c
vector_double.c: In function ‘rb_gsl_vector_normalize_bang’:
vector_double.c:872:10: attention : variable ‘mean’ set but not used [-Wunused-but-set-variable]
vector_double.c: Hors de toute fonction :
vector_double.c:692:13: attention : ‘draw_hist’ defined but not used [-Wunused-function]
vector_double.c:624:13: attention : ‘draw_vector’ defined but not used [-Wunused-function]
vector_double.c:634:13: attention : ‘draw_vector2’ defined but not used [-Wunused-function]
vector_double.c:704:13: attention : ‘draw_vector_array’ defined but not used [-Wunused-function]
vector_double.c:679:13: attention : ‘draw_narray’ defined but not used [-Wunused-function]
gcc -I. -I. -I/usr/lib/ruby/1.8/i686-linux -I. -DHAVE_NARRAY_H -I/var/lib/gems/1.8/gems/narray-0.6.0.1/. -I/usr/local/lib/site_ruby/1.8/i686-linux -D_FILE_OFFSET_BITS=64 -fPIC -Wall -I../include -I/usr/include -c const.c
gcc -I. -I. -I/usr/lib/ruby/1.8/i686-linux -I. -DHAVE_NARRAY_H -I/var/lib/gems/1.8/gems/narray-0.6.0.1/. -I/usr/local/lib/site_ruby/1.8/i686-linux -D_FILE_OFFSET_BITS=64 -fPIC -Wall -I../include -I/usr/include -c block.c
In file included from block.c:29:0:
block_source.c: In function ‘rb_gsl_block_compare’:
block_source.c:550:7: attention : variable ‘status’ set but not used [-Wunused-but-set-variable]
In file included from block.c:35:0:
block_source.c: In function ‘rb_gsl_block_int_compare’:
block_source.c:550:7: attention : variable ‘status’ set but not used [-Wunused-but-set-variable]
In file included from block.c:41:0:
block_source.c: In function ‘rb_gsl_block_uchar_compare’:
block_source.c:550:7: attention : variable ‘status’ set but not used [-Wunused-but-set-variable]
gcc -I. -I. -I/usr/lib/ruby/1.8/i686-linux -I. -DHAVE_NARRAY_H -I/var/lib/gems/1.8/gems/narray-0.6.0.1/. -I/usr/local/lib/site_ruby/1.8/i686-linux -D_FILE_OFFSET_BITS=64 -fPIC -Wall -I../include -I/usr/include -c sf_dawson.c
gcc -I. -I. -I/usr/lib/ruby/1.8/i686-linux -I. -DHAVE_NARRAY_H -I/var/lib/gems/1.8/gems/narray-0.6.0.1/. -I/usr/local/lib/site_ruby/1.8/i686-linux -D_FILE_OFFSET_BITS=64 -fPIC -Wall -I../include -I/usr/include -c fcmp.c
gcc -I. -I. -I/usr/lib/ruby/1.8/i686-linux -I. -DHAVE_NARRAY_H -I/var/lib/gems/1.8/gems/narray-0.6.0.1/. -I/usr/local/lib/site_ruby/1.8/i686-linux -D_FILE_OFFSET_BITS=64 -fPIC -Wall -I../include -I/usr/include -c matrix_complex.c
matrix_complex.c: In function ‘rb_gsl_matrix_complex_eye’:
matrix_complex.c:202:19: attention : variable ‘p’ set but not used [-Wunused-but-set-variable]
matrix_complex.c: In function ‘rb_gsl_matrix_complex_set_row’:
matrix_complex.c:410:19: attention : variable ‘pz’ set but not used [-Wunused-but-set-variable]
matrix_complex.c: In function ‘rb_gsl_matrix_complex_set_col’:
matrix_complex.c:436:19: attention : variable ‘pz’ set but not used [-Wunused-but-set-variable]
matrix_complex.c: In function ‘rb_gsl_matrix_complex_inspect’:
matrix_complex.c:654:3: attention : format ‘%lu’ expects argument of type ‘long unsigned int’, but argument 4 has type ‘size_t’ [-Wformat]
matrix_complex.c:654:3: attention : format ‘%lu’ expects argument of type ‘long unsigned int’, but argument 5 has type ‘size_t’ [-Wformat]
matrix_complex.c: Hors de toute fonction :
matrix_complex.c:1523:12: erreur: conflicting types for ‘gsl_matrix_complex_equal’
/usr/include/gsl/gsl_matrix_complex_double.h:227:5: note: previous declaration of ‘gsl_matrix_complex_equal’ was here
make: *** [matrix_complex.o] Erreur 1
Gem files will remain installed in /var/lib/gems/1.8/gems/gsl-1.14.7 for inspection.
Results logged to /var/lib/gems/1.8/gems/gsl-1.14.7/ext/gem_make.out
stagiaire#stagiaire-desktop:~$
Getting some clues from https://github.com/romanbsd/rb-gsl/issues/2 I did the following on Ubuntu:
Uninstalled my existing gsl:
sudo apt-get remove gsl-bin libgsl0-dev libgsl0ldbl
Built a new gsl
wget ftp.gnu.org/gnu/gsl/gsl-1.14.tar.gz
tar xf gsl-1.14.tar.gz
cd gsl-1.14
./configure
make
sudo make install
Installed the gem
gem install gsl
This worked for me.
The above answer works as you can simply use version ~1.14 of both the GSL and ruby bindings (rb-gsl).
However, if you have installed GSL via homebrew (brew install gsl) or prefer version 1.15 you can alternatively specify the following repo in your Gemfile for the ruby bindings:
https://github.com/whistlerbrk/rb-gsl/
which is based off of:
https://github.com/30robots/rb-gsl/
This has the patch for gsl_matrix and the first repo also has a patch for newer versions of rubygems.

How to install mysql2 on Ubuntu server 10.04 with ree-1.8.7

When I try to install mysql2 on Ubuntu with ree-1.8.7-2011.03 I get:
# gem install mysql2
Building native extensions. This could take a while...
ERROR: Error installing mysql2:
ERROR: Failed to build gem native extension.
/usr/local/rvm/rubies/ree-1.8.7-2011.03/bin/ruby extconf.rb
checking for rb_thread_blocking_region()... no
checking for rb_wait_for_single_fd()... no
checking for mysql.h... yes
checking for errmsg.h... yes
checking for mysqld_error.h... yes
creating Makefile
make
gcc -I. -I/opt/local/include -I. -I/usr/local/rvm/rubies/ree-1.8.7-
2011.03/lib/ruby/1.8/i686-linux -I. -DHAVE_MYSQL_H -DHAVE_ERRMSG_H -DHAVE_MYSQLD_ERROR_H -D_FILE_OFFSET_BITS=64 -I/usr/include -fPIC -g -static-libgcc -fno-omit-frame-pointer -fPIC -g -static-libgcc -fno-omit-frame-pointer -fno-strict-aliasing -DMY_PTHREAD_FASTMUTEX=1 -fPIC -g -O2 -Wall -funroll-loops -c client.c
gcc -I. -I/opt/local/include -I. -I/usr/local/rvm/rubies/ree-1.8.7-2011.03/lib/ruby/1.8/i686-linux -I. -DHAVE_MYSQL_H -DHAVE_ERRMSG_H -DHAVE_MYSQLD_ERROR_H -D_FILE_OFFSET_BITS=64 -I/usr/include -fPIC -g -static-libgcc -fno-omit-frame-pointer -fPIC -g -static-libgcc -fno-omit-frame-pointer -fno-strict-aliasing -DMY_PTHREAD_FASTMUTEX=1 -fPIC -g -O2 -Wall -funroll-loops -c mysql2_ext.c
./client.h:16: warning: ‘rb_thread_blocking_region’ defined but not used
gcc -I. -I/opt/local/include -I. -I/usr/local/rvm/rubies/ree-1.8.7-2011.03/lib/ruby/1.8/i686-linux -I. -DHAVE_MYSQL_H -DHAVE_ERRMSG_H -DHAVE_MYSQLD_ERROR_H -D_FILE_OFFSET_BITS=64 -I/usr/include -fPIC -g -static-libgcc -fno-omit-frame-pointer -fPIC -g -static-libgcc -fno-omit-frame-pointer -fno-strict-aliasing -DMY_PTHREAD_FASTMUTEX=1 -fPIC -g -O2 -Wall -funroll-loops -c result.c
gcc -shared -o mysql2.so client.o mysql2_ext.o result.o -L. -L/usr/local/rvm/rubies/ree-1.8.7-2011.03/lib -Wl,-R/usr/local/rvm/rubies/ree-1.8.7-2011.03/lib -L. -rdynamic -Wl,- export-dynamic -Wl,-rpath,/usr/lib -L/usr/lib -lmysqlclient_r -lpthread -lm -lrt -ldl -L/opt/local/lib -lrt -ldl -lcrypt -lm -lc
/usr/bin/ld: cannot find -lmysqlclient_r
collect2: ld returned 1 exit status
make: *** [mysql2.so] Error 1
I am not sure what the error is. Any idea of the cause?

Resources