Effacer les filtres
Effacer les filtres

Error generating c++ shared library in ubuntu 12.04 MATLAB R2012a

4 vues (au cours des 30 derniers jours)
ab
ab le 4 Juin 2013
I am getting an error while using matlab compiler to generate c++ shared library .I am using MATLAB R2012a in ubuntu 12.4.I also read that it may be because of the ubuntu 12.4 and I should degrade to 10.10 but I am not sure if the error is beacause of that:
ant:
<mkdir dir="/home/fashion/handbag/trial1/distrib" />
<mkdir dir="/home/fashion/handbag/trial1/src" />
mcc -W cpplib:trial1 -T link:lib -d /home/fashion/handbag/trial1/src -N -p vision -p stats -w enable:specified_file_mismatch -w enable:repeated_file -w enable:switch_ignored -w enable:missing_lib_sentinel -w enable:demo_license -v /home/fashion/handbag/handbagtest.m -a /home/fashion/handbag/allfeatures_mat.mat -a /home/fashion/handbag/cluster_lab_pixels.m -a /home/fashion/handbag/color_labels_for_means.m -a /home/fashion/handbag/color_space_file.mat -a /home/fashion/handbag/compute_color_signature.m -a /home/fashion/handbag/extract_canny_prelim_mask.m -a /home/fashion/handbag/extract_phog_features.m -a /home/fashion/handbag/generate_pyramid.m -a /home/fashion/handbag/pb_raster_scan.m -a /home/fashion/handbag/rank_query_L2.m -a /home/fashion/handbag/rec_structdisp.m -a /home/fashion/handbag/renew_mask.m -a /home/fashion/handbag/single_handbag_description_seq.m
Compiler version: 4.17 (R2012a)
Warning: The name of a shared library should begin with the letters "lib".
'trial1' doesn't.
Processing /usr/local/MATLAB/R2012a/toolbox/matlab/mcc.enc
Processing /usr/local/MATLAB/R2012a/toolbox/images/mcc.enc
Processing /usr/local/MATLAB/R2012a/toolbox/stats/mcc.enc
Processing /usr/local/MATLAB/R2012a/toolbox/shared/statslib/mcc.enc
Processing /usr/local/MATLAB/R2012a/toolbox/shared/imageslib/mcc.enc
Processing include files...
2 item(s) added.
Processing directories installed with MCR...
The file /home/fashion/handbag/trial1/src/mccExcludedFiles.log contains a list of functions excluded from the CTF archive.
0 item(s) added.
Generating MATLAB path for the compiled application...
Created 48 path items.
Begin validation of MEX files: Tue Jun 4 18:05:18 2013
Validating '/usr/local/MATLAB/R2012a/toolbox/images/images/private/applylutc.mexa64'.
No conflicting MATLAB file found.
Validating '/usr/local/MATLAB/R2012a/toolbox/images/images/private/computeedge.mexa64'.
No conflicting MATLAB file found.
Validating '/usr/local/MATLAB/R2012a/toolbox/images/images/private/grayto8.mexa64'.
Found MATLAB file '/usr/local/MATLAB/R2012a/toolbox/images/images/private/grayto8.m'.
MEX file
'/usr/local/MATLAB/R2012a/toolbox/images/images/private/grayto8.mexa64'
is valid. It contains 'mexFunction.'
Validating '/usr/local/MATLAB/R2012a/toolbox/images/images/private/imapplymatrixc.mexa64'.
No conflicting MATLAB file found.
Validating '/usr/local/MATLAB/R2012a/toolbox/images/images/private/imcomplementmex.mexa64'.
No conflicting MATLAB file found.
Validating '/usr/local/MATLAB/R2012a/toolbox/images/images/private/imfilter_mex.mexa64'.
No conflicting MATLAB file found.
Validating '/usr/local/MATLAB/R2012a/toolbox/images/images/private/imhistc.mexa64'.
Found MATLAB file '/usr/local/MATLAB/R2012a/toolbox/images/images/private/imhistc.m'.
MEX file
'/usr/local/MATLAB/R2012a/toolbox/images/images/private/imhistc.mexa64'
is valid. It contains 'mexFunction.'
Validating '/usr/local/MATLAB/R2012a/toolbox/images/images/private/imlincombc.mexa64'.
No conflicting MATLAB file found.
Validating '/usr/local/MATLAB/R2012a/toolbox/images/images/private/imreconstructmex.mexa64'.
No conflicting MATLAB file found.
Validating '/usr/local/MATLAB/R2012a/toolbox/images/images/private/imresizemex.mexa64'.
No conflicting MATLAB file found.
Validating '/usr/local/MATLAB/R2012a/toolbox/images/images/private/ind2rgb8c.mexa64'.
No conflicting MATLAB file found.
Validating '/usr/local/MATLAB/R2012a/toolbox/images/images/private/int16touint16.mexa64'.
No conflicting MATLAB file found.
Validating '/usr/local/MATLAB/R2012a/toolbox/images/images/private/int32touint32.mexa64'.
No conflicting MATLAB file found.
Validating '/usr/local/MATLAB/R2012a/toolbox/images/images/private/int8touint8.mexa64'.
No conflicting MATLAB file found.
Validating '/usr/local/MATLAB/R2012a/toolbox/images/iptformats/private/bitparse.mexa64'.
No conflicting MATLAB file found.
Validating '/usr/local/MATLAB/R2012a/toolbox/images/iptformats/private/dicom_decode_rle_segment.mexa64'.
No conflicting MATLAB file found.
Validating '/usr/local/MATLAB/R2012a/toolbox/images/iptformats/private/dicomlookup_helper.mexa64'.
No conflicting MATLAB file found.
Validating '/usr/local/MATLAB/R2012a/toolbox/images/iptformats/private/dicomparse.mexa64'.
No conflicting MATLAB file found.
Validating '/usr/local/MATLAB/R2012a/toolbox/images/iptformats/private/rnitfc.mexa64'.
No conflicting MATLAB file found.
Validating '/usr/local/MATLAB/R2012a/toolbox/images/iptformats/private/tobits.mexa64'.
No conflicting MATLAB file found.
Validating '/usr/local/MATLAB/R2012a/toolbox/shared/statslib/@categorical/private/issqrbrktliteral.mexa64'.
No conflicting MATLAB file found.
Validating '/usr/local/MATLAB/R2012a/toolbox/stats/stats/@sobolset/private/DNToMatrix.mexa64'.
No conflicting MATLAB file found.
Validating '/usr/local/MATLAB/R2012a/toolbox/stats/stats/@sobolset/private/MatrixToDN.mexa64'.
No conflicting MATLAB file found.
Validating '/usr/local/MATLAB/R2012a/toolbox/stats/stats/@sobolset/private/computeDN.mexa64'.
No conflicting MATLAB file found.
Validating '/usr/local/MATLAB/R2012a/toolbox/stats/stats/@sobolset/private/convertToDouble.mexa64'.
No conflicting MATLAB file found.
Validating '/usr/local/MATLAB/R2012a/toolbox/stats/stats/@sobolset/private/matrixBitXor.mexa64'.
No conflicting MATLAB file found.
Validating '/usr/local/MATLAB/R2012a/toolbox/stats/stats/@sobolset/private/sobolIndexed.mexa64'.
No conflicting MATLAB file found.
Validating '/usr/local/MATLAB/R2012a/toolbox/stats/stats/@sobolset/private/sobolNet.mexa64'.
No conflicting MATLAB file found.
Validating '/usr/local/MATLAB/R2012a/toolbox/stats/stats/@sobolset/private/sobolPoint.mexa64'.
No conflicting MATLAB file found.
Validating '/usr/local/MATLAB/R2012a/toolbox/stats/stats/@sobolset/private/sobolSequence.mexa64'.
No conflicting MATLAB file found.
Validating '/usr/local/MATLAB/R2012a/toolbox/stats/stats/private/statsizechk.mexa64'.
Found MATLAB file '/usr/local/MATLAB/R2012a/toolbox/stats/stats/private/statsizechk.m'.
MEX file
'/usr/local/MATLAB/R2012a/toolbox/stats/stats/private/statsizechk.mexa64'
is valid. It contains 'mexFunction.'
End validation of MEX files: Tue Jun 4 18:05:18 2013
Warning: Adding path "/home/fashion/handbag" to Compiler path instance.
Parsing file "/home/fashion/handbag/handbagtest.m"
    (Referenced from: "Compiler Command Line").
Parsing file "/usr/local/MATLAB/R2012a/toolbox/compiler/deploy/deployprint.m"
    (Referenced from: "Compiler Command Line").
Parsing file "/usr/local/MATLAB/R2012a/toolbox/compiler/deploy/printdlg.m"
    (Referenced from: "Compiler Command Line").
Deleting 31 temporary MEX authorization files.
Removing: '/tmp/01665T6Wb9X_5733.auth'.
Removing: '/tmp/01665UXFol1_5733.auth'.
Removing: '/tmp/01665HZrCx4_5733.auth'.
Removing: '/tmp/01665Wp8QJ7_5733.auth'.
Removing: '/tmp/01665LsG6Va_5733.auth'.
Removing: '/tmp/01665q25m8d_5733.auth'.
Removing: '/tmp/016651RmEkh_5733.auth'.
Removing: '/tmp/01665CLtWwk_5733.auth'.
Removing: '/tmp/01665NDufJn_5733.auth'.
Removing: '/tmp/016658QmzVq_5733.auth'.
Removing: '/tmp/01665lg9T7t_5733.auth'.
Removing: '/tmp/01665syNfkx_5733.auth'.
Removing: '/tmp/01665NNmCwA_5733.auth'.
Removing: '/tmp/01665Y5PZID_5733.auth'.
Removing: '/tmp/01665ZAetVG_5733.auth'.
Removing: '/tmp/01665WJBX7J_5733.auth'.
Removing: '/tmp/01665d7ytkN_5733.auth'.
Removing: '/tmp/01665gLp0wQ_5733.auth'.
Removing: '/tmp/016659juzJT_5733.auth'.
Removing: '/tmp/01665eJq9VW_5733.auth'.
Removing: '/tmp/01665HiLO8Z_5733.auth'.
Removing: '/tmp/01665IxxBl3_5733.auth'.
Removing: '/tmp/01665towpy6_5733.auth'.
Removing: '/tmp/01665mRyeL9_5733.auth'.
Removing: '/tmp/01665Tku4Xc_5733.auth'.
Removing: '/tmp/016652HoVag_5733.auth'.
Removing: '/tmp/016651JgNnj_5733.auth'.
Removing: '/tmp/016650lKHAm_5733.auth'.
Removing: '/tmp/01665pnbDNp_5733.auth'.
Removing: '/tmp/01665aMyz0s_5733.auth'.
Removing: '/tmp/01665houxdw_5733.auth'.
Generating file "/home/fashion/handbag/trial1/src/trial1.h".
Generating file "/home/fashion/handbag/trial1/src/trial1.cpp".
Generating file "/home/fashion/handbag/trial1/src/trial1.exports".
Generating file "/home/fashion/handbag/trial1/src/readme.txt".
Executing command: "/usr/local/MATLAB/R2012a/bin/mbuild" -O -v -output "trial1" -I"/home/fashion/handbag/trial1/src" "/home/fashion/handbag/trial1/src/trial1.cpp" "/home/fashion/handbag/trial1/src/trial1.exports" -link shared -outdir "/home/fashion/handbag/trial1/src"
Warning: You are using gcc version "4.7.2-2ubuntu1)". The version
currently supported with MATLAB Compiler is "4.4.6".
For a list of currently supported compilers see:
http://www.mathworks.com/support/compilers/current_release/
----------------------------------------------------------------
-> mbuildopts.sh sourced from directory (DIR = .)
FILE = ./mbuildopts.sh
----------------------------------------------------------------
-> TMW_ROOT = /usr/local/MATLAB/R2012a
-> CC = g++
-> CC flags:
CFLAGS = -fPIC -ansi -D_GNU_SOURCE -I/usr/local/MATLAB/R2012a/extern/include/cpp -I/usr/local/MATLAB/R2012a/extern/include -DUNIX -DX11 -DGLNXA64 -DGCC -pthread
CDEBUGFLAGS = -g
COPTIMFLAGS = -O -DNDEBUG
CLIBS = -Wl,-rpath-link,/usr/local/MATLAB/R2012a/bin/glnxa64 -L/usr/local/MATLAB/R2012a/runtime/glnxa64 -lmwmclmcrrt -lm
arguments =
-> LD = g++
-> Link flags:
LDFLAGS = -pthread -shared
LDDEBUGFLAGS = -g
LDOPTIMFLAGS = -O
arguments =
----------------------------------------------------------------
-> g++ -c -I/home/fashion/handbag/trial1/src -fPIC -ansi -D_GNU_SOURCE -I/usr/local/MATLAB/R2012a/extern/include/cpp -I/usr/local/MATLAB/R2012a/extern/include -DUNIX -DX11 -DGLNXA64 -DGCC -pthread -O -DNDEBUG "/home/fashion/handbag/trial1/src/trial1.cpp" -o /home/fashion/handbag/trial1/src/trial1.o
/usr/local/MATLAB/R2012a/bin/mbuild: 1: eval: g++: not found
mbuild: compile of ' "/home/fashion/handbag/trial1/src/trial1.cpp"' failed.
Error: An error occurred while shelling out to mbuild (error code = 1).
Unable to build executable.
IS it because of the compiler??I used
mbuild -setup
Options files control which compiler to use, the compiler and link command
options, and the runtime libraries to link against.
Using the 'mbuild -setup' command selects an options file that is
placed in /home/fashion/.matlab/R2012a and used by default for 'mbuild'. An options
file in the current working directory or specified on the command line
overrides the default options file in /home/fashion/.matlab/R2012a.
To override the default options file, use the 'mbuild -f' command
(see 'mbuild -help' for more information).
The options files available for mbuild are:
1: /usr/local/MATLAB/R2012a/bin/mbuildopts.sh :
Build and link with MATLAB Compiler generated library via the system ANSI C/C++ compiler
0: Exit with no changes
Enter the number of the compiler (0-1):
1
/usr/local/MATLAB/R2012a/bin/mbuildopts.sh is being copied to
/home/fashion/.matlab/R2012a/mbuildopts.sh

Réponses (1)

Walter Roberson
Walter Roberson le 5 Juin 2013
You do not have any "g++" on your Linux path. You do have "gcc" (though it is a newer version than is officially supported by that mbuild.)
It is possible that you have a g++-4.7.2 on your path that is not linked to g++ so you should look around a bit.
!ls $(dirname $(which gcc))/g+*
  5 commentaires
ab
ab le 5 Juin 2013
which gcc gives
/usr/bin/gcc
which g++ gives
/usr/bin/g++
$ gcc --version gcc (Ubuntu/Linaro 4.7.2-2ubuntu1) 4.7.2
$ g++ --version g++ (Ubuntu/Linaro 4.7.2-2ubuntu1) 4.7.2
Walter Roberson
Walter Roberson le 5 Juin 2013
Try editing mbuildopts.sh and changing
CC = g++
to
CC = /usr/bin/g++
Also please notice the warning you got near the beginning: shared libraries should begin with "lib". You could name yours "libtrial1" for example.

Connectez-vous pour commenter.

Catégories

En savoir plus sur C Shared Library Integration dans Help Center et File Exchange

Produits

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by