kyamagu / matlab-sqlite3-driver

Matlab driver for SQLite3 database

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

not compiling on Debian GNU/Linux

cosexp opened this issue · comments

Hi,
I'm trying to compile matlab-sqlite3-driver on Debian (Jessie), but get this, see below.
Any idea what might me going wrong?
Thanks,
Christian

>> sqlite3.make
mex -c -Iinclude src/sqlite3/sqlite3.c -outdir src/sqlite3

Warning: You are using gcc version "4.9.1".  The version
         currently supported with MEX is "4.7.x".
         For a list of currently supported compilers see: 
         http://www.mathworks.com/support/compilers/current_release/

mex -Iinclude src/api.cc src/sqlite3mex.cc src/sqlite3/sqlite3.o -output +sqlite3/private/libsqlite3_ -ldl -lboost_regex CXXFLAGS="$CXXFLAGS -std=c++11"

Warning: You are using gcc version "4.9.1".  The version
         currently supported with MEX is "4.7.x".
         For a list of currently supported compilers see: 
         http://www.mathworks.com/support/compilers/current_release/

/usr/bin/ld: api.o: relocation R_X86_64_32S against `.rodata' can not be used when making a shared object; recompile with -fPIC
api.o: error adding symbols: Bad value
collect2: error: ld returned 1 exit status

    mex: link of ' "+sqlite3/private/libsqlite3_.mexa64"' failed.

Unable to complete successfully.

Error in sqlite3.make>dispAndEval (line 40)
  eval(command);

Error in sqlite3.make (line 14)
      dispAndEval([...

Can you open +sqlite3/make.m and change

options = ' -ldl -lboost_regex CXXFLAGS="$CXXFLAGS -std=c++11"';

to

options = ' -ldl -lboost_regex CXXFLAGS="$CXXFLAGS -std=c++11 -fPIC"';

Also you might need to add the following to the Line 13 of make.m.

CFLAGS="&CFLAGS -fPIC"

Ok, thanks, now the error is this:

>> sqlite3.make
mex -c -Iinclude src/sqlite3/sqlite3.c -outdir src/sqlite3
The destination directory "src/sqlite3" cannot be found.

Error in sqlite3.make>dispAndEval (line 40)
  eval(command);

Error in sqlite3.make (line 13)
      dispAndEval('mex -c -Iinclude src/sqlite3/sqlite3.c -outdir src/sqlite3');

>> cd ..
>> sqlite3.make
mex -c -Iinclude src/sqlite3/sqlite3.c -outdir src/sqlite3

Warning: You are using gcc version "4.9.1".  The version
         currently supported with MEX is "4.7.x".
         For a list of currently supported compilers see: 
         http://www.mathworks.com/support/compilers/current_release/

mex -Iinclude src/api.cc src/sqlite3mex.cc src/sqlite3/sqlite3.o -output +sqlite3/private/libsqlite3_ -ldl -lboost_regex CXXFLAGS="$CXXFLAGS -std=c++11 -fPIC"

Warning: You are using gcc version "4.9.1".  The version
         currently supported with MEX is "4.7.x".
         For a list of currently supported compilers see: 
         http://www.mathworks.com/support/compilers/current_release/

/usr/bin/ld: cannot find -lboost_regex
collect2: error: ld returned 1 exit status

    mex: link of ' "+sqlite3/private/libsqlite3_.mexa64"' failed.

Unable to complete successfully.

Error in sqlite3.make>dispAndEval (line 40)
  eval(command);

Error in sqlite3.make (line 14)
      dispAndEval([...

@cosexp You have to install boost then, i.e., apt-get install libboost-regex.

@cosexp Oops, you're using gcc 4.9. You can remove -lboost_regex from the make.m.

Yes, now it's working. Thanks a lot!