ld: cannot find -lguide while compiling files using mex with intel c++ compiler - matlab

Here is the situation:
Ubuntu 13.04, Matlab 2012a and Intel C++ Composer XE 2013 for Linux.
I downloaded a matlab code archive and followed the instructions in it to compile the .cpp files. Formerly when I finished installing Matlab 2012a and started it, some error messages showed up and I googled out an answer which is:
sudo ln -s /lib/x86_64-linux-gnu/libc.so.6 /lib64/libc.so.6
And then there came out another error message which told me 'missing lstdc++' when I started compiling, the idea of re-installing g++ first came into my mind, and the error message disappeared after I did so. However, finally I got an error which I could not find an answer anywhere:
>> compilemex
ld: cannot find -lguide
mex: link of ' "max_pool.mexa64"' failed.
Error using mex (line 206)
Unable to complete successfully.
Error in compilemex (line 20)
eval(exec_string{1});
During the the process of searching for a solution, I found a thread for my previous 'missing lstdc++' error which differed from what I did to fix it, does this matter or not? And another hint is that I could not find any file named like 'libguide' under the /opt/intel/ directory, how could I fix it?
Thanks in advance!

Googl'ing for libguide, i found this:
http://software.intel.com/en-us/forums/topic/284445
According to this, the build script you're using refers to an old version of the intel compiler. Newer versions seem to have the functions in libguide.so moved to libiomp5.so.
So try replacing -lguide by -liomp5.
Disclaimer: this is pure google knowledge. Personally I have no idea what either library is good for :)

Related

How to fix Xcode linker command ld emulation error message issue?

So in the process of trying to find a way to offset my c program in the linking phase to 0x1000 for the standard kernel loading spot, I downloaded binutils from GNU (myself, not through Homebrew), which seems to have created a tricky error. When I invoke ld in Terminal, I get this error message(yes the blanks are what's displayed):
ld: unrecognised emulation mode:
Supported emulations:
Even after going through each directory in binutils and make uninstalling each, and removing and then redownloading Xcode CommandLineTools, the issue persists. I'm a bit lost- any ideas? Thank you!
Forgot to mention, I noticed ld wasn't included in the initial download of binutils, and downloaded it seperately through the ld directory of binutils. This was before I saw that GNU doesn't support Darwin for ld unless its installed as a cross-linker, yet it still ended up on my system somehow (I didn't install it as a corss-linker). I uninstalled ld along with all the other binutil functions.

Undefined reference error when using mexcuda ubuntu

Ive installed matlab,gcc and CUDA toolkit on ubuntu .to use mexcuda .
but when i compile i get the following errors and i cant find any references on them anywhere .
Error using mex
/tmp/mex_42185702054896_15548/testmem04.o: In function `mexFunction':
tmpxft_00003e3a_00000000-5_testmem04.compute_70.cudafe1.cpp:(.text+0x152): undefined reference
to `__cudaPushCallConfiguration'
/tmp/mex_42185702054896_15548/testmem04.o: In function `__device_stub__Z9MulKernelPhPi(unsigned
char*, int*)':
tmpxft_00003e3a_00000000-5_testmem04.compute_70.cudafe1.cpp:(.text+0x35e): undefined reference
to `__cudaPopCallConfiguration'
collect2: error: ld returned 1 exit status
please note that when i first installed matlab, cuda 10 (my current version) was not supported by it , ive encountered the same thing when i installed matlab on windows , and fixed it by commenting a line in file "nvcc_g++.xml" and it works . when i did this in ubuntu matlab,matlab now detects the nvcc compiler but i get the previous error .
i realize "undefined reference errors " are linker errors , what should i do here ? i tried linking to cuda library but it didnt work .
For mexcuda, it is crucial that you match the CUDA toolkit to the version shipping with your installation of MATLAB (and Parallel Computing Toolbox). This is because Parallel Computing Toolbox ships a selection of libraries from the CUDA toolkit, and expects to be able to link against them. If you use the wrong version of the CUDA toolkit, all sorts of things can go wrong.
To check the appropriate version of the CUDA toolkit, look at the CUDA ToolkitVersion Version showing in the output from gpuDevice.
(Note that it is only the toolkit version that needs to match with MATLAB & PCT - it's almost always fine to get the latest driver).
For more details, see my answer https://uk.mathworks.com/matlabcentral/answers/432360-after-uninstalling-cuda-toolkit-still-matlab-responds-for-gpudevice over there on MATLAB Answers.

Encountered an error while compiling cobalt on raspberry pi

While compiling cobalt for raspberry pi on ninja, im getting an error like this:
undefined reference to symbol 'eglCreateImageKHR'
here is the full trace:
[1/1] LINK cobalt
FAILED: cobalt
/home/mi07/work/raspitools/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian-x64/bin/arm-linux-gnueabihf-g++ #cobalt.rsp
/home/mi07/work/raspitools/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian-x64/bin/../lib/gcc/arm-linux-gnueabihf/4.8.3/../../../../arm-linux-gnueabihf/bin/ld: obj/starboard/raspi/2/../shared/open_max/starboard_platform.decode_target_create.o: undefined reference to symbol 'eglCreateImageKHR'
/home/mi07/work/raspitools/sysroot/opt/vc/lib/libbrcmEGL.so: error adding symbols: DSO missing from command line
collect2: error: ld returned 1 exit status
ninja: build stopped: subcommand failed.
I googled it and found somewhat related article on this site.
As per this article the fault could be that of libssl1.0-dev not being there. I checked and found it was libssl-dev. Replaced it with libssl1.0-dev but still the error persists.
Can somebody tell me what is going wrong?
eglCreateImageKHR() is an EGL extension EGL_KHR_image. Since Cobalt compiled, it appears the headers declare the extension, but the linked EGL library didn't define it. It's surprising that only eglCreateImageKHR() is missing and not eglDestroyImageKHR as well.
At any rate, I recommend trying to update the EGL library, but I'm not familiar with the raspi install, so can't tell you the specifics.
Alternatively, it is safe to comment out the call to that function in decode_target_create.cc since SbImageIsDecodeSupported() always returns false for raspi (see image_is_decode_supported.cc), so decode targets should never be created / destroyed on the platform. (Decode target support is a work in progress for raspi.)
I resolved this by changing the os itself. The problem was that the cobalt was not compatible with raspi stretch but with raspi jessie. Because sysroot files are being copied from the OS it was creating that error. I don't know exactly where the difference is but changing to raspi jessie worked fine for me.

use library (gcc) in matlab and error with compile of mex

I am using Mac OSX (yosemite V 10.10.1) and running MATLAB 2014a on it.
I wanted to use SPAM library (sparse modeling software by J. Mairal) on MATLAB and for that I have to install XCode6.1 (that has gcc). First I type in command window mex -setup and result is shown below:
mex -setup
MEX configured to use 'Xcode with Clang' for C language compilation.
Warning: The MATLAB C and Fortran API has changed to support MATLAB
variables with more than 2^32-1 elements. In the near future
you will be required to update your code to utilize the
new API. You can find more information about this at:
http://www.mathworks.com/help/matlab/matlab_external/upgrading-mex-files-to-use-64-bit-api.html.
To choose a different language, select one from the following:
mex -setup C++
mex -setup FORTRAN
So after that I run the compile.m file in SPAM library and suddenly I saw an error that was:
add_flag =
-mmacosx-version-min=10.6
Warning: Directory already exists.
> In compile at 144
compilation of: -I./linalg/ -I./decomp/ -I./prox/ -I./dictLearn/ dictLearn/mex/mexArchetypalAnalysis.cpp
Building with 'Xcode Clang++'.
clang: warning: argument unused during compilation: '-fopenmp'
Error using mex
ld: warning: directory not found for option '-L/usr/lib/gcc/x86_64-linux-gnu/4.8/'
ld: library not found for -lgomp
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Error in compile (line 439)
mex(args{:});
I don't understand what to do. please help me!
It appears that the actual error is occurring at the point of linking with precompiled libraries. The 2 issues are as follows:
The compile code apparently included in the compile.m file looks like it is intended to compile with gcc (it is trying to include files installed by GCC, possibly even linux-specific ones, are you sure that it's an OSX-compatible toolbox?), and yet the error strongly suggests that you are in fact using clang to compile it - you will either need to change the compiler (easy) or rewrite compile.m (not so easy).
One of the libraries that the code needs to have installed in order to be properly linked hasn't been found. On OSX I think this file should be called libgomp.dylib (any mac afficionados want to confirm this?). If you have it on your computer, then it's not in a directory that clang is looking in. You can confirm the library is installed by running find / | grep libgomp.dylib from the terminal - if it is there, you can add it into the compiler argument in compile.m using the -I /DIRECTORY_HOLDING_LIBRARY syntax.
It is entirely possible that fixing 1. will also remediate 2. - I have never tried using SPAM

installing libsvm on Mac (OSX 10.9.2)

I have tried to install the libsvm package with
mex -setup
(since "make" resulted in an error). This was followed by one choice for a compiler, so I chose "1".
Afterwards I typed in "make" got the following error though:
xcrun: error: SDK "macosx10.7" cannot be located
clang: warning: no such sysroot directory: '-mmacosx-version-min=10.7'
libsvmread.c:1:10: fatal error: 'stdio.h' file not found
#include <stdio.h>
^
1 error generated.
mex: compile of ' "libsvmread.c"' failed.
If make.m fails, please check README about detailed instructions.
What can I do?
I think the following answer from the matlab support might be helpful (http://www.mathworks.com/matlabcentral/answers/103904-can-i-use-xcode-5-as-my-c-or-c-compiler-in-matlab-8-1-r2013a-or-matlab-8-2-r2013b):
The Mac OS X 10.7 SDK, available in Xcode 4.1 through 4.6, is used by
MEX and related capabilities. This SDK is no longer available in Xcode
5, resulting in errors similar to the following when compiling:
xcodebuild: error: SDK "macosx10.7" cannot be located.
xcrun: error: unable to find utility "clang", not a developer tool or
in PATH
The simplest solution is to avoid updating Xcode to version 5 if you
are using R2013a or R2013b. If you need Xcode 5, or you have already
irreversibly upgraded to it, you can update MEX to use the 10.8 SDK:
In the MATLAB Command Window, execute the following commands:
cd(matlabroot)
cd bin
edit mexopts.sh
Save a backup copy of this file somewhere in case you make a mistake and you need to revert your changes.
Scroll down to the Mac (“maci64”) section of this file, beginning around line 120.
Replace all instances of 10.7 with 10.8; there are four of these in all (a fifth may be found in comments only)
Save the file, then execute the following command in the MATLAB Command Window:
mex -setup
Please note that this workaround links MEX files with a different SDK
than with which MATLAB was tested. Although there are no known
compatibility issues, support may be limited.