Object file associated with UHD (USRP Hardware Driver) not found - matlab

I am trying to compile a C++ file that uses the utilities of UHD (USRP Hardware Driver) in MATLAB. This is in connection with trying to use a USRP called NI-2954R with MATLAB 2013b on a 64-bit system with windows 10 OS.
The following is the mex command:
mex -largeArrayDims -v -g rx_samples_to_file.cpp -I. "C:\Users\VINAYAK KARANDIKAR\Documents\MATLAB\MATLAB\Thesis\MATLAB_USRP_INTERFACE\UHD_sample_programs_from_GitHub\uhd"...
-I."C:\Users\VINAYAK KARANDIKAR\Documents\MATLAB\MATLAB\Thesis\MATLAB_USRP_INTERFACE\UHD_sample_programs_from_GitHub\boost_1_55_0\boost"...
-L."C:\Program Files\MATLAB\R2013b\extern\lib\win64\microsoft" ...
uhd.lib ...
uhd.lib libmx.lib libmex.lib libmat.lib ...
"C:\Program Files\MATLAB\R2013b\extern\lib\win64\microsoft"
And I receive the following error:
LINK : fatal error LNK1181: cannot open input file 'C:\Users\VINAYAK KARANDIKAR\Documents\MATLAB\MATLAB\Thesis\MATLAB_USRP_INTERFACE\UHD_sample_programs_from_GitHub\uhd.obj'
C:\PROGRA~1\MATLAB\R2013B\BIN\MEX.PL: Error: Link of 'rx_samples_to_file.mexw64' failed.
Unable to complete successfully.
Error in make_rx_samples_to_file (line 4)
mex -largeArrayDims -v -g rx_samples_to_file.cpp -I. "C:\Users\VINAYAK
KARANDIKAR\Documents\MATLAB\MATLAB\Thesis\MATLAB_USRP_INTERFACE\UHD_sample_programs_from_GitHub\uhd
Why do I get this error and how can I fix the compilation?

Your MEX-command has some duplicated parts, I will assume this is because of copy-paste errors. I will assume you actually used:
mex -largeArrayDims -v -g rx_samples_to_file.cpp ...
-I. "C:\Users\VINAYAK KARANDIKAR\Documents\MATLAB\MATLAB\Thesis\MATLAB_USRP_INTERFACE\UHD_sample_programs_from_GitHub\uhd"...
-I."C:\Users\VINAYAK KARANDIKAR\Documents\MATLAB\MATLAB\Thesis\MATLAB_USRP_INTERFACE\UHD_sample_programs_from_GitHub\boost_1_55_0\boost"...
-L."C:\Program Files\MATLAB\R2013b\extern\lib\win64\microsoft" ...
uhd.lib libmx.lib libmex.lib libmat.lib
You have an argument -I., indicating you want to add the current directory (.) to the compiler's include path, then another argument "C:\Users\VINAYAK KARANDIKAR\Documents\MATLAB\MATLAB\Thesis\MATLAB_USRP_INTERFACE\UHD_sample_programs_from_GitHub\uhd", indicating you want to add that file to the compilation. Consequently, mex will look for a file uhd.obj, which does not exist.
The solution is to not separate the two parts of the -I argument with a space, and not add a . after the -I argument (you also have this in the -L argument). This leads to:
mex -largeArrayDims -v -g rx_samples_to_file.cpp ...
-I"C:\Users\VINAYAK KARANDIKAR\Documents\MATLAB\MATLAB\Thesis\MATLAB_USRP_INTERFACE\UHD_sample_programs_from_GitHub\uhd" ...
-I"C:\Users\VINAYAK KARANDIKAR\Documents\MATLAB\MATLAB\Thesis\MATLAB_USRP_INTERFACE\UHD_sample_programs_from_GitHub\boost_1_55_0\boost" ...
-L"C:\Program Files\MATLAB\R2013b\extern\lib\win64\microsoft" ...
uhd.lib libmx.lib libmex.lib libmat.lib
Though I'm sort of surprised that this works in MATLAB, if you look at the documentation to the mex command you'll see that the recommended syntax would be:
mex -largeArrayDims -v -g rx_samples_to_file.cpp ...
'-IC:\Users\VINAYAK KARANDIKAR\Documents\MATLAB\MATLAB\Thesis\MATLAB_USRP_INTERFACE\UHD_sample_programs_from_GitHub\uhd' ...
'-IC:\Users\VINAYAK KARANDIKAR\Documents\MATLAB\MATLAB\Thesis\MATLAB_USRP_INTERFACE\UHD_sample_programs_from_GitHub\boost_1_55_0\boost' ...
'-LC:\Program Files\MATLAB\R2013b\extern\lib\win64\microsoft' ...
uhd.lib libmx.lib libmex.lib libmat.lib

Related

Unable to compile / install Orange Data Mining on Raspberry Pi

I have been trying to compile and install Orange 2.7.8 on Raspberry Pi 2 but was unsuccessful. I tried compiling by hand and also used pip install orange as per suggestion from: How can I install python-Orange on ubuntu 12.10
The first warning I got this:
gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -I/usr/include/python2.7 -I/usr/lib/pymodules/python2.7/numpy/core/include -Isource/include -Isource/orange/liblinear -Isource/orange/ppp -Isource/orange/px -I/usr/include/python2.7 -c source/orange/basstat.cpp -o build/temp.linux-armv7l-2.7/source/orange/basstat.o -fPIC -w -DLINUX -DORANGE_EXPORTS
cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid for Ada/C/ObjC but not for C++ [enabled by default]
But it kept going without an error. Then when it started compiling with g++, it started getting an error on multiple definition of TOrangeVector. There are many errors like the lines below:
build/temp.linux-armv7l-2.7/source/orange/distance.o:(.data.rel.ro+0x6c): multiple definition of `typeinfo for TOrangeVector<GCPtr<TVariable>, true>'
build/temp.linux-armv7l-2.7/source/orange/basstat.o:(.data.rel.ro+0x6c): first defined here
build/temp.linux-armv7l-2.7/source/orange/distance.o: In function `TExamplesDistance::classDescription() const':
/home/pi/build/orange/source/orange/ppp/distance.ppp:17: multiple definition of `typeinfo for TOrangeVector<bool, false>'
In the end it got kicked out:
/home/pi/build/orange/source/orange/vectortemplates.hpp:1075: multiple definition of `typeinfo name for TOrangeVector<GCPtr<TOrangeVector<GCPtr<TVariable>, true> >, true>'
build/temp.linux-armv7l-2.7/source/orange/basstat.o:/home/pi/build/orange/source/orange/ppp/../basstat.hpp:8: first defined here
collect2: ld returned 1 exit status
error: command 'g++' failed with exit status 1
Any guide on how to tweak this to make it compiled would be appreciated.

Install Perl Image::Magick on Fedora

I'm installing Image::Magick via cpan and I keep getting this error. I've tried with and without forcing it. I've trimmed the install log. I've read something about missing an ImageMagick.h file but don't exactly know anything other then that. Apparently this has been a common problem since 2007.....
[gandalf#Durmstrang ~]$ cpan -if Image::Magick
"/usr/bin/perl" "/usr/share/perl5/vendor_perl/ExtUtils/xsubpp" -typemap "/usr/share/perl5/ExtUtils/typemap" -typemap "typemap" Magick.xs > Magick.xsc && mv Magick.xsc Magick.c
gcc -c -I/usr/local/include/ImageMagick-6 -DMAGICKCORE_HDRI_ENABLE=0 -DMAGICKCORE_QUANTUM_DEPTH=16 -I/usr/include/libxml2 -I"/usr/include/ImageMagick-6" -D_REENTRANT -D_GNU_SOURCE -fno-strict-aliasing -pipe -fstack-protector -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -I/usr/include/freetype2 -g -O2 -Wall -pthread -DMAGICKCORE_HDRI_ENABLE=0 -DMAGICKCORE_QUANTUM_DEPTH=16 -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic -DVERSION=\"6.89\" -DXS_VERSION=\"6.89\" -fPIC "-I/usr/lib64/perl5/CORE" -D_LARGE_FILES=1 -DHAVE_CONFIG_H Magick.c
Magick.xs: In function ‘XS_Image__Magick_ComplexImages’:
Magick.xs:3475:5: error: unknown type name ‘ComplexOperator’
ComplexOperator
^
Magick.xs:3510:8: error: ‘UndefinedComplexOperator’ undeclared (first use in this function)
op=UndefinedComplexOperator;
^
Magick.xs:3510:8: note: each undeclared identifier is reported only once for each function it appears in
Magick.xs:3516:31: error: ‘MagickComplexOptions’ undeclared (first use in this function)
in=ParseCommandOption(MagickComplexOptions,MagickFalse,(char *)
^
Magick.xs:3524:13: error: ‘ComplexOperator’ undeclared (first use in this function)
op=(ComplexOperator) in;
^
Magick.xs:3524:30: error: expected ‘;’ before ‘in’
op=(ComplexOperator) in;
^
Magick.xs:3548:38: error: expected ‘;’ before ‘in’
op=(ComplexOperator) in;
^
Magick.xs:3563:5: warning: implicit declaration of function ‘ComplexImages’ [-Wimplicit-function-declaration]
image=ComplexImages(image,op,exception);
^
Magick.xs:3563:10: warning: assignment makes pointer from integer without a cast [enabled by default]
image=ComplexImages(image,op,exception);
^
Magick.xs: In function ‘XS_Image__Magick_Mogrify’:
Magick.xs:9824:11: warning: implicit declaration of function ‘RotationalBlurImageChannel’ [-Wimplicit-function-declaration]
image=RotationalBlurImageChannel(image,channel,geometry_info.rho,
^
Magick.xs:9824:16: warning: assignment makes pointer from integer without a cast [enabled by default]
image=RotationalBlurImageChannel(image,channel,geometry_info.rho,
^
Magick.xs:10895:11: warning: implicit declaration of function ‘CannyEdgeImage’ [-Wimplicit-function-declaration]
image=CannyEdgeImage(image,geometry_info.rho,geometry_info.sigma,
^
Magick.xs:10895:16: warning: assignment makes pointer from integer without a cast [enabled by default]
image=CannyEdgeImage(image,geometry_info.rho,geometry_info.sigma,
^
Magick.xs:10916:11: warning: implicit declaration of function ‘HoughLineImage’ [-Wimplicit-function-declaration]
image=HoughLineImage(image,(size_t) geometry_info.rho,(size_t)
^
Magick.xs:10916:16: warning: assignment makes pointer from integer without a cast [enabled by default]
image=HoughLineImage(image,(size_t) geometry_info.rho,(size_t)
^
Magick.xs:10939:11: warning: implicit declaration of function ‘MeanShiftImage’ [-Wimplicit-function-declaration]
image=MeanShiftImage(image,(size_t) geometry_info.rho,(size_t)
^
Magick.xs:10939:16: warning: assignment makes pointer from integer without a cast [enabled by default]
image=MeanShiftImage(image,(size_t) geometry_info.rho,(size_t)
^
make: *** [Magick.o] Error 1
JCRISTY/PerlMagick-6.89-1.tar.gz
/usr/bin/make -- NOT OK
Running make test
Can't test without successful make
Running make install
Make had returned bad status, install seems impossible
The problem is that CPAN doesn't know about non-Perl dependencies.
The Perl Image::Magick module is just a wrapper around a C library. You'll need that library installed before you can build the Perl module.
$ sudo yum install ImageMagick
It also probably need ImageMagick's development package.
$ sudo yum install ImageMagick-devel
But it's probably easier to just install the RPM version that has already been packaged for Fedora (that will automatically pull in any other requirements).
$ sudo yum install ImageMagick-perl
In Fedora, CentOS, Ubuntu and more there have been this type of challenge in geting Image::Magick to install via the cpan program, and there have been sensitivities about the install-script for Image::Magick for a couple of years, it seems (if one searches around). This is so both for on desktop Linux and, even more so, via Apache cpanel. There are recipies but at least at Ubuntu, they have not been solving all issues. Sometimes, to get it right, one must first do removal of relevant libraries using ImageMagick to reset the links. All the proposed solutions center around installing other things before using 'cpan'. However, the best approach, I find, isn't at all to compile from source but to install the binary ImageMagick application when that is available, and relevant libraries before and after cpan, like this--in Ubuntu, but adapted for Fedora it should be similar or much the same:
sudo apt-get install perlmagick
sudo apt-get install ImageMagick
sudo cpan install Image::Magick
sudo apt-get install libperl-dev
For the sake of completeness, if one cannot find the right binary, one must take care to preinstall all relevant libraries as indicated on http://www.imagemagick.org and then this set of commands will replace the line#2 above, when performed after 'sudo -i' (in Ubuntu) or equivalent in Fedora, inside a temporary folder:
wget http://www.imagemagick.org/download/ImageMagick.tar.gz
tar xvfz ImageMagick.tar.gz
cd Imag*
./configure --with-perl
make
make install
When this installation is complete, proceed with line#3 above. Adapt the beginning of the command to the form that fits with other forms of linuxes. After this, a perl program having use Image::Magick; in its start should be able to do such as resizing of jpg images etc flawlessly.

mex cc file in ubuntu

I've download some code online. The makefile is like following:
all: cascade
cascade: cascade.cc model.cc model.h
mex -o cascade \
CXXFLAGS="\$$CXXFLAGS -O3 -march=nocona -fomit-frame-pointer" \
cascade.cc model.cc
clean:
rm *.mex*
I use command !make to run in matlab. But it gives me the following error:
mex -O cascade \
CXXFLAGS="\$CXXFLAGS -O3 -march=nocona -fomit-frame-pointer" \
cascade.cc model.cc
/bin/sh: 1: mex: not found
make: *** [cascade] Error 127
I go to /bin/sh of my system. There is no mex indeed.
What should I do to add mex to /bin/sh.
Thanks

unable to build binutils for my cross compiler

i am trying to build binutils 2.19.1 with mingw/msys using following commands:
export PREFIX=/usr/local/cross
export TARGET=i586-elf
cd /usr/src
mkdir build-binutils
cd /usr/src/build-binutils
../binutils-x.xx/configure --target=$TARGET --prefix=$PREFIX --disable-nls
make all
make install
and im getting following errors:
/bin/sh ./libtool --tag=CC --mode=compile gcc -DHAVE_CONFIG_H -I. -I../../binuti
ls-2.19.1/bfd -I. -D__USE_MINGW_FSEEK -I. -I../../binutils-2.19.1/bfd -I../..
/binutils-2.19.1/bfd/../include -W -Wall -Wstrict-prototypes -Wmissing-proto
types -Wno-format -Werror -g -O2 -D__USE_MINGW_ACCESS -c -o archive.lo ../../bin
utils-2.19.1/bfd/archive.c
./libtool: line 2258: cygpath: command not found
libtool: compile: gcc -DHAVE_CONFIG_H -I. -I../../binutils-2.19.1/bfd -I. -D__U
SE_MINGW_FSEEK -I. -I../../binutils-2.19.1/bfd -I../../binutils-2.19.1/bfd/../in
clude -W -Wall -Wstrict-prototypes -Wmissing-prototypes -Wno-format -Werror -g -
O2 -D__USE_MINGW_ACCESS -c "" -o archive.o
gcc.exe: error: : No such file or directory
gcc.exe: fatal error: no input files
compilation terminated.
make[3]: *** [archive.lo] Error 1
make[3]: Leaving directory `/usr/src/build-binutils/bfd'
make[2]: *** [install-recursive] Error 1
make[2]: Leaving directory `/usr/src/build-binutils/bfd'
make[1]: *** [install-bfd] Error 2
make[1]: Leaving directory `/usr/src/build-binutils'
make: *** [install] Error 2
/x.sh: line 8: ../gcc-4.5.0/configure: No such file or directory
make: *** No rule to make target `all-gcc'. Stop.
make: *** No rule to make target `install-gcc'. Stop.
i am getting the same error even for the diff binutils version,i have tried binutils-2.19.1, 2.22.0, 2.23.1
so what can be the problem ??
also my mingw's gcc compiler version is 4.6.2
i've also tried the command
make CFLAGS="-Os -w"
bt still the same problem persists
I'm getting a similar error ("cygpath: command not found"), but with newer versions. FWICT there is a line within binutils that assumes that Cygwin is present, although I didn't see any notes in the build instructions saying that Cygwin was required (I might have missed it, though).
I suppose the correct approach would be to install Cygwin, but I'm not sure if that will interfere with Mingw in other ways. It looks like binutils is just trying to use cygpath to convert between O/S path naming conventions, so I got around this problem by creating a little dummy cygpath shell script:
#options described at http://cygwin-lite.sourceforge.net/html/cygpath.html
#echo "MISSING CYGPATH"
if [ "x$1" == "x-w" ]
then
echo $2 #just echo path name back as-is
else
read -p "MISSING CYGPATH. PARAMS WERE: 1=$1 2=$2 3=$3 4=$4 5=$5"
fi
I placed this on the PATH so binutils could find it, instead of getting an error during the build. This script just echoes the path name back as-is (for the path renaming scenario), since Windows seems to be able to understand Unix-style paths anyways these days (and I was running on Windows). For anything else, this script will pause and display the first few command line parameters, to provide some hints as to what further functionality is needed.
HTH someone get a little farther

Matlab 2011b and mingw64

I've followed the guidance I found here.
I have almost completed the work. The following section is the paragraph of batch conversion work. I have created a batch file to convert a lot of DLLs pre-built by MSVC in Matlab 2011b Windows 7(64-bit).
set path=C:\MinGW64\bin;C:\mingw\msys\bin;
mkdir lib
mkdir bin
#echo y |copy *.dll .\bin
#echo y |copy *.lib .\lib
#echo EXPORTS >libmex.def
#echo EXPORTS >libmx.def
#echo EXPORTS >libmat.def
#echo EXPORTS >libeng.def
#echo EXPORTS >libmwlapack.def
c:\mingw64\bin\pexports ./bin/libmex.dll | sed "s/^_//" > libmex.def
c:\mingw64\bin\pexports ./bin/libmat.dll | sed "s/^_//" > libmat.def
c:\mingw64\bin\pexports ./bin/libeng.dll | sed "s/^_//" > libeng.def
c:\mingw64\bin\pexports ./bin/libmwlapack.dll | sed "s/^_//" >libmwlapack.def
gendef ./bin/libmx.dll
echo "Add the mexErrMsgTxt string to each def file,"
echo "then press any key to continue the conversion process"
pause
lib /machine:x64 /def:libmex.def /name:.\bin\libmex.dll /out:.\lib\libmex.lib
lib /machine:x64 /def:libmx.def /name:.\bin\libmx.dll /out:.\lib\libmx.lib
lib /machine:x64 /def:libmat.def /name:.\bin\libmat.dll /out:.\lib\libmat.lib
lib /machine:x64 /def:libeng.def /name:.\bin\libeng.dll /out:.\lib\libeng.lib
lib /machine:x64 /def:libmwlapack.def /name:.\bin\libmwlapack.dll /out:.\lib\libmwlapack.lib
c:\mingw64\bin\x86_64-w64-mingw32-dlltool --kill-at -U -d libmex.def -l /lib/libmex.a
c:\mingw64\bin\x86_64-w64-mingw32-dlltool --kill-at -U -d libmat.def -l ./lib/libmat.a
c:\mingw64\bin\x86_64-w64-mingw32-dlltool --kill-at -U -d libeng.def -l ./lib/libeng.a
c:\mingw64\bin\x86_64-w64-mingw32-dlltool --kill-at -U -d libmx.def -l./lib/libmx.a
c:\mingw64\bin\x86_64-w64-mingw32-dlltool --kill-at -U -d libmwlapack.def -l ./lib/libmwlapack.a
Makefile for engwindemo.exe:
LIBS= -Lc:/mingw64/lib ../lib/libeng.a ../lib/libmx.a ../lib/
libmex.a ../lib/libmat.a
CC=c:/mingw64/bin/gcc -m64 -O3 -I../include -Ic:/mingw64/include
EXE=../bin/engwindemo.exe
SRC=engwindemo.c
all:$(EXE)
$(EXE): $(SRC)
$(CC) $(SRC) $(LIBS) -L../lib -ladvapi32 -luser32 -lgdi32 -lkernel32 -
lmingwex -o $(EXE)
#rm -f *.o*
Using (mingw64) gcc, the compiling and linking processes is ok. Execute engwindemo.exe, I get this error:
_engClose entry point error (in libeng.dll)
In mingw64, how can I build a stand-alone application (engwindemo.exe) which calls from the functions built-in the libeng.dll (Matlab R2011b)?
Thank everyone response! I have built up successfully! In the Matlab R2011b
win32/64, just setting up in the cygwin(x86_64-w64-mingw32-gcc 4.5.2) environment without any dll file conversion.
The part of primary setting is as following
Set the MATLABROOT in short filename form (long filename may be ok.)
MATLABROOT=c:/Progra~1/MATLAB/R2011b
linking the primary libraries built by MSVC
LIBS= -L$(MATLABROOT)/bin/win64 -lmex -lmx -lmwlapack -lmwblas -leng
declare the gcc with the flags
CC=x86_64-w64-mingw32-gcc
CFLAG=-Wall -m64 -O3 -I$(MATLABROOT)/extern/include
MEXFLAG=-m64 -shared -DMATLAB_MEX_FILE -I$(MATLABROOT)/extern/include -Wl,--export-all-symbols $(LIBS)
Others additional parameters to keep compiler happy.
And finally, in the cygwin consloe or mingw64 shell just make this project.