Octave not compiling, confused by build error - octave

I'm a modest user of Linux; but I appear to have hit a wall here when building Octave.
I need to use Octave 4.0.0 on (64-bit) Ubuntu 14.04, and it seems the only option for me (so far) is to build from source (as the repos apparently don't offer anything prebuilt for this version yet). Anyway, I do
./configure
make
...and then get this:
/usr/bin/ld: /usr/local/lib/libGraphicsMagick.a(magick_libGraphicsMagick_la-analyze.o): relocation R_X86_64_32 against `.gomp_critical_user_GM_GetImageDepthCallBack' can not be used when making a shared object; recompile with -fPIC
/usr/local/lib/libGraphicsMagick.a: error adding symbols: Bad value
collect2: error: ld returned 1 exit status
I figured this was because my graphicsmagick install wasn't build with -fPIC. So I downloaded graphicsmagick and did
./configure --with-shared
and built out a new graphicsmagick (make install). Still the same error. So I tried to "force it" by doing the following to graphicsmagick:
./configure CCSHARED="-fPIC" CXXFLAGS="-fPIC"
This time I did a search within the generated Makefile and found -fPIC was, indeed, added to the CXXFLAGS. But after making and install the new graphicsmagick, I still get the same error.
This seems like a build chain problem that I've caused. Any thoughts?

Try with:
./configure --enable-shared --disable-static

Related

Cross-compile Qt5 (Mingw) with MySQL driver issue

I tried a lot of things I read on documentations or tutorials... But I still can't cross-compile Qt with the MySQL library driver. Story begins:
I have to cross-compile Qt from Linux to Windows (32bits) using MinGW (i686-w64-mingw32- prefix to be precise). I downloaded qtbase-opensource-src-5.9.4 and started to work like that:
$ ./configure -prefix [...]/qt-5.9.4 -xplatform win32-g++ -device-option CROSS_COMPILE=/usr/bin/i686-w64-mingw32- -opengl desktop -no-sql-odbc -sql-sqlite -enable-shared -nomake examples -nomake tests -release
And it worked. Then, make and make install worked too. But I figured out that there was only the SQLite ".dll" in the plugins/sqldrivers repository. So I tried to compile the MySQL driver and... How can I do that?? If I add -sql-mysql to my ./configure ... call, I have to following error:
ERROR: Feature 'sql-mysql' was enabled, but the pre-condition 'libs.mysql' failed.
I downloaded MySQL library from the official website to get mysql-5.7.21-win32.zip. But how to link it with qtbase sources? Adding MYSQL_INCDIR=[...]/mysql-5.7.21-win32/include and MYSQL_LIBDIR=[...]/mysql-5.7.21-win32/lib or just MYSQL_PREFIX=[...]/mysql-5.7.21-win32 to my ./configure ... command results to the same error message.
Any idea please?
EDIT:
I tried to compile the driver like that (with the qmake I built previously):
$ cd qtbase-opensource-src-5.9.4/src/plugins/sqldrivers/mysql
$ [/*prefix of my previous build*/]/qt-5.9.4/bin/qmake .
And the result is:
Project ERROR: Library 'mysql' is not defined.
Ok everyone, I found the solution: do a clean checkout or add -recheck-all to the ./configure command when you want to add a lib like MySQL in my case. Easy isn't it? To make it clear, here is the command I used:
./configure -prefix [...] -xplatform win32-g++ -device-option CROSS_COMPILE=/usr/bin/i686-w64-mingw32- -opengl desktop -no-sql-odbc -sql-sqlite -plugin-sql-mysql MYSQL_PREFIX=[...] -enable-shared -nomake examples -nomake tests -release -recheck-all
That was just a refresh problem, but I prefer to let this answer because it's pretty hard to realize.
Instead of what you tried in your EDIT, should I think be:
$ cd qtbase-opensource-src-5.9.4/src/plugins/sqldrivers
qmake -- MYSQL_PREFIX= [...]/mysql-5.7.21-win32/include

can't find any solution for running f2py correctly on my windows 7 machine

Can someone pinpoint where I'm doing wrong, PLEASE? I'm so exhausted. I installed MinGW 4.7, python2.7.8, numpy 1.7.1 and scipy0.13.2 to an Anaconda (32bit) environment in Windows7.
Also, for user enviroment variables, I set
C_INCLUDE_PATH:
D:\Anaconda2\envs\arc103\MinGW\i686-w64-mingw32\include
Path (User variable):
C:\Program Files (x86)\Microsoft VS code\bin;D:\Anaconda2\Library\bin;D:\Anaconda2\envs\arc103\MinGW\bin
Tying the following commands in Anaconda Prompt
"f2py -c --help-fcompiler" outputs "... Fortran compilers found:
--fcompiler=gnu95 GNU Fortran 95 compiler (4.7.0) ...."
"f2py -c --help-compiler" outputs
"List of available compilers: ...", not specifically compilers found though.
Running "f2py -c fib1.f -m fib1" according to "NumPy v1.12.dev0 Manual" gives me lots of error as below:
D:\Anaconda2\envs\arc103\Scripts\gfortran.bat -Wall -Wall -shared c:\users\dkim1\appdata\local\temp\tmpvyedhg\Release\users\dkim1\appdata\local\temp\tmpvyedhg\src.win32-.7\fib1module.oc:\users\dkim1\appdata\local\temp\tmpvyedhg\Release\users\dkim1\appdata\local\temp\tmpvyedhg\src.win32-2.7\fortranobject.o c:\users\dkim1\appdata\local\temp\tmpvyedhg\Release\fib1.o -Ld:\anaconda2\envs\arc103\mingw\lib\gcc\i686-w64-mingw32\4.7.0 -LD:\Anaconda2\envs\arc103\libs -LD:\Anaconda2\envs\arc103\PCbuild -lpython27 -lgfortran -o .\fib1.pyd
c:\users\dkim1\appdata\local\temp\tmpvyedhg\Release\users\dkim1\appdata\local\temp\tmpvyedhg\src.win32-2.7\fib1module.o:fib1module.c:(.text+0x35): undefined reference to `__imp__PyNumber_Int'
c:\users\dkim1\appdata\local\temp\tmpvyedhg\Release\users\dkim1\appdata\local\temp\tmpvyedhg\src.win32-2.7\fib1module.o:fib1module.c:(.text+0x68): undefined reference to `__imp__PyComplex_Type'
c:\users\dkim1\appdata\local\temp\tmpvyedhg\Release\users\dkim1\appdata\local\temp\tmpvyedhg\src.win32-2.7\fib1module.o:fib1module.c:(.text+0x79): undefined reference to `__imp__PyType_IsSubtype'
c:\users\dkim1\appdata\local\temp\tmpvyedhg\Release\users\dkim1\appdata\local\temp\tmpvyedhg\src.win32-2.7\fib1module.o:fib1module.c:(.text+0x93): undefined reference to `__imp__PyErr_Occurred'
... (Thousands of "undefined reference to" errors I didn't put it here) ...
collect2.exe: error: ld returned 1 exit statuserror: Command "D:\Anaconda2\envs\arc103\Scripts\gfortran.bat -Wall -Wall -shared c:\users\dkim1\appdata\local\temp\tmpvyedhg\Release\users\dkim1\appdata\local\temp\tmpvyedhg\src.win32-2.7\fib1module.o
c:\users\dkim1\appdata\local\temp\tmpvyedhg\Release\users\dkim1\appdata\local\temp\tmpvyedhg\src.win32-2.7\fortranobject.o
c:\users\dkim1\appdata\local\temp\tmpvyedhg\Release\fib1.o -Ld:\anaconda2\envs\arc103\mingw\lib\gcc\i686-w64-mingw32\4.7.0 -LD:\Anaconda2\envs\arc103\libs
-LD:\Anaconda2\envs\arc103\PCbuild -lpython27 -lgfortran -o .\fib1.pyd" failed with exit status 1
Sorry for the mess. I have spent almost a few months finding out the fix, but it's too hard for me and all gone to no avail. It would be hugely appreciated if you can help me out. Thanks.
Since this is a couple month old, I am not sure if these tips will still help, but I found when building a Fortran to Python module on Win 10, that only compiling for 32bit worked, and you need to use a signature file, i.e. something along the lines of:
f2py.py -c cuncsd.pyf cuncsd.f
Instead of using the i686-w64-mingw32 toolchain I used a straight mingw32 one (to reduce the risk that I accidentally end up with anything 64bit).
I also found that you need to install a special Visual Studio for Python instance as described here:
Microsoft Visual C++ Compiler for Python 3.4
If you are using Python 2.7 this VSC version should do the trick for you, only newer version (3.5, 3.6) are left out at this time.
For reference here is my complete f2py invocation on the console that I ended up using (neither python nor f2py were on the execution PATH):
python C:\Python34\Scripts\f2py.py -c cuncsd.pyf --opt="-frecursive -fmax-stack-var-size=66560" cuncsd.f -llapack -lrefblas -ltmglib
This particular module depends on 32 bit LAPCK shared libraries that I compiled previously, and we found it even works on XP systems.
I later went back and tried to compile this for 64 bit, but eventually gave up, when I always encountered ld errors. I think going forward for Windows 10 it will be much easier to use the embedded Ubuntu to execute and extend Python.
(See How to enable Bash in Windows 10 developer preview? and Getting PyCharm to recognize python on the windows linux subsystem (bash on windows))

libgflags bad value error for caffe

I've linked all the required libraries and the caffee confige ran smoothly. But when I want to make the library I get this error:
/usr/bin/ld: /usr/local/lib/libgflags.a(gflags.cc.o): relocation R_X86_64_32S against `std::basic_string, std::allocator >::_Rep::_S_empty_rep_storage' can not be used when making a shared object; recompile with -fPIC
/usr/local/lib/libgflags.a: could not read symbols: Bad value
I found a 'workaround' for this problem at the libgflags and glog troubleshooting websites:
https://code.google.com/p/google-glog/issues/detail?id=201
But I tried them and it doesn't seem to work. Am I missing something? Maybe I haven't uncommented a line in my original Makefile.config file? *I am installing caffe on my laptop with no CUDA or parallel computing for now.
Try recompiling the gflags library with -fPIC compiler flag.
Did the caffe work using gflags shared library instead of using the static one?
Try to choose 'BUILD SHARED LIBS' option when using Cmake

no mpicxx when compiling examples for NVIDIA CUDA 5

I installed the driver and toolkit for CUDA 5 in 64-bit RHEL 6.3 successfully.
However, when I tried compiling the CUDA 5 examples, I got the error message:
make[1]: Leaving directory `/root/NVIDIA_CUDA-5.0_Samples/0_Simple/cppIntegration'
which: no mpicxx
How can I fix this for the CUDA 5 examples to compile?
In order to build the simpleMPI example, you need some kind of MPI installed on your system. You can get around this and build most of the samples by doing:
make -k
this will attempt to go past errors in the make process and build all targets that can be built.
If you prefer, you can delete this directory:
/root/NVIDIA_CUDA-5.0_Samples/0_Simple/simpleMPI
perhaps with the following command, as root:
rm -Rf /root/NVIDIA_CUDA-5.0_Samples/0_Simple/simpleMPI
and relaunch your make. Personally I think the make -k option is simpler.
(the message about cppIntegration is just the last target that got successfully built)

compile basic mysql c code with xcode

Anyone manage to write code that uses the mysqlclient library? I can get compiling working but not linking :(
XCode produces the following output:
Build TestMysql of project TestMysql with configuration Debug
Ld build/Debug/TestMysql normal x86_64
cd /Users/jacob/Documents/cocoa/TestMysql
setenv MACOSX_DEPLOYMENT_TARGET 10.5
/Developer/usr/bin/gcc-4.2 -arch x86_64 -isysroot /Developer/SDKs/MacOSX10.5.sdk
-L/Users/jacob/Documents/cocoa/TestMysql/build/Debug -L/usr/local/mysql/lib
-L/usr/local/mysql-5.1.38-osx10.5-x86_64/lib
-F/Users/jacob/Documents/cocoa/TestMysql/build/Debug -filelist /Users/jacob/Documents/cocoa/TestMysql/build/TestMysql.build/Debug/TestMysql.build/Objects-normal/x86_64/TestMysql.LinkFileList
-mmacosx-version-min=10.5 -lm -lz -lmysqlclient -lmygcc "
" -framework CoreFoundation -o /Users/jacob/Documents/cocoa/TestMysql/build/Debug/TestMysql
i686-apple-darwin10-gcc-4.2.1:
: No such file or directory
Command /Developer/usr/bin/gcc-4.2 failed with exit code 1
And yes I already know about the mysql/cocoa framework, im writing code that must compile on os/x and linux. Ironically it only took me 20 minutes to work out how to write a make file to compile and link and run objective-c / mysql code, but xcode is soo much more complicated.
I believe the "" string is causing you grief -- especially since the error message's filename is the empty string.
Alternate methodology:
Have you considered just using the Makefile you made in XCode?
File->New Project->Other->External Build System.
Apple docs on this method: http://bit.ly/dYNuR
Ok, its an xcode bug. Under the screen to add linker options with the + and - buttons, somehow there was an extra link option with a CR or LF in it. Don't ask me how it got there I don't know! (:
That comment about the weird "" helped me solve it (eventually).
I know this is an old post but for anyone that has the same issue...
Make sure you install into the /usr/local by first setting the make files:
sudo cmake -G "Unix Makefiles" -DCMAKE_INSTALL_PREFIX=/usr/local
Then, 'make install' will put everything in the right directories. Next, in Xcode, you have to right click a folder in the project, say add existing framework, change the drop down to pick dylibs, finally choose libmysql.dylib.
The libmysql.dylib is a shared library that xcode needs to look at for the function names.