Subject: CGAL users discussion list
List archive
- From: 魏华祎 <>
- To:
- Subject: Re: [cgal-discuss] how to compile mex-file based on CGAL in Matlab
- Date: Sun, 13 Mar 2011 19:08:47 -0700
- Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; b=pvYxYj9JEosHTdZISpc6LTlOKnmxJFeELmNea58Zn+R2/tCLt3eiwXB/tLHRh3lLfG jgADf0V08YkKzEuRW7/NXLppdAJYKoj21TDc7F80I4bxDScdfGCFUh5OL/VNB9q8DrB9 foZ7qda1n25mQ1Y2v1JuXyx6dlcLNSXFggcdI=
Hi, Joachim,
Thanks for your reply. It still not work, here is the compile information, it said that it can not find -lboost, but I do have installed the boost in /usr/local/include and /usr/local/lib/. And I can compile my CGAL example very well, I mean use cmake and make command.
%%%%%%%%%%%%
mex -v mexfile.cpp -lCGAL -lgmp -lboost -I/usr/include/:/usr/local/include/:/opt/matlab/extern/include/ -L/usr/lib/:/usr/local/lib/:/opt/matlab/extern/lib/glnxa64
-> mexopts.sh sourced from directory (DIR = $HOME/.matlab/$REL_VERSION)
FILE = /home/huayiwei/.matlab/R2010a/mexopts.sh
----------------------------------------------------------------
-> MATLAB = /opt/matlab
-> CC = gcc
-> CC flags:
CFLAGS = -ansi -D_GNU_SOURCE -fexceptions -fPIC -fno-omit-frame-pointer -pthread
CDEBUGFLAGS = -g
COPTIMFLAGS = -O -DNDEBUG
CLIBS = -Wl,-rpath-link,/opt/matlab/bin/glnxa64 -L/opt/matlab/bin/glnxa64 -lmx -lmex -lmat -lm -lstdc++
arguments = -DMX_COMPAT_32
-> CXX = g++
-> CXX flags:
CXXFLAGS = -ansi -D_GNU_SOURCE -fPIC -fno-omit-frame-pointer -pthread
CXXDEBUGFLAGS = -g
CXXOPTIMFLAGS = -O -DNDEBUG
CXXLIBS = -Wl,-rpath-link,/opt/matlab/bin/glnxa64 -L/opt/matlab/bin/glnxa64 -lmx -lmex -lmat -lm
arguments = -DMX_COMPAT_32
-> FC = g95
-> FC flags:
FFLAGS = -fexceptions -fPIC -fno-omit-frame-pointer
FDEBUGFLAGS = -g
FOPTIMFLAGS = -O
FLIBS = -Wl,-rpath-link,/opt/matlab/bin/glnxa64 -L/opt/matlab/bin/glnxa64 -lmx -lmex -lmat -lm
arguments = -DMX_COMPAT_32
-> LD = g++
-> Link flags:
LDFLAGS = -pthread -shared -Wl,--version-script,/opt/matlab/extern/lib/glnxa64/mexFunction.map -Wl,--no-undefined
LDDEBUGFLAGS = -g
LDOPTIMFLAGS = -O
LDEXTENSION = .mexa64
arguments = -lCGAL -lgmp -lboost -L/usr/lib/:/usr/local/lib/:/opt/matlab/extern/lib/glnxa64
-> LDCXX =
-> Link flags:
LDCXXFLAGS =
LDCXXDEBUGFLAGS =
LDCXXOPTIMFLAGS =
LDCXXEXTENSION =
arguments = -lCGAL -lgmp -lboost -L/usr/lib/:/usr/local/lib/:/opt/matlab/extern/lib/glnxa64
----------------------------------------------------------------
Warning: You are using gcc version "4.4.3-4ubuntu5)". The version
currently supported with MEX is "4.2.3".
For a list of currently supported compilers see:
http://www.mathworks.com/support/compilers/current_release/
-> g++ -c -I/usr/include/:/usr/local/include/:/opt/matlab/extern/include/ -I/opt/matlab/extern/include -I/opt/matlab/simulink/include -DMATLAB_MEX_FILE -ansi -D_GNU_SOURCE -fPIC -fno-omit-frame-pointer -pthread -DMX_COMPAT_32 -O -DNDEBUG "mexfile.cpp"
-> g++ -O -pthread -shared -Wl,--version-script,/opt/matlab/extern/lib/glnxa64/mexFunction.map -Wl,--no-undefined -o "mexfile.mexa64" mexfile.o -lCGAL -lgmp -lboost -L/usr/lib/:/usr/local/lib/:/opt/matlab/extern/lib/glnxa64 -Wl,-rpath-link,/opt/matlab/bin/glnxa64 -L/opt/matlab/bin/glnxa64 -lmx -lmex -lmat -lm
/usr/bin/ld: cannot find -lboost
collect2: ld returned 1 exit status
mex: link of ' "mexfile.mexa64"' failed.
??? Error using ==> mex at 222
Unable to complete successfully.
%%%%%%%%%%%%%%%%%%%%%%%%
On Sun, Mar 13, 2011 at 4:00 PM, Joachim Reichel <> wrote:
Hi,
> [...]
> I have a problem to use mex in matlab to compile the "mexfile.cpp" in
> attachment. In matlab command windows, I use the following command:
>
>>> mex mexfile.cpp
> -I/usr/include/:/usr/local/include/:/opt/matlab/extern/include/
> -L/usr/lib/:/usr/local/lib/:/opt/matlab/extern/lib/glnxa64
>
>
> My CGAL and gmp install location is /usr/include/ and /usr/lib, my boost
> location is /usr/local/include/ and /usr/local/lib/
>
> But I can't complie it, can you give me some suggestion about it? Thanks
> very much!
> The compile result is following:*
>
>
> Warning: You are using gcc version "4.4.3-4ubuntu5)". The version
> currently supported with MEX is "4.2.3".
> For a list of currently supported compilers see:
> http://www.mathworks.com/support/compilers/current_release/
>
> mexfile.o: In function `CGAL::Handle_for<CGAL::Gmpq_rep,
> std::allocator<CGAL::Gmpq_rep> >::~Handle_for()':
> mexfile.cpp:(.text._ZN4CGAL10Handle_forINS_8Gmpq_repESaIS1_EED2Ev[CGAL::Handle_for<CGAL::Gmpq_rep,
> std::allocator<CGAL::Gmpq_rep> >::~Handle_for()]+0x18): undefined reference
> to `__gmpq_clear'
> mexfile.o: In function `boost::operator-(CGAL::Gmpq const&, CGAL::Gmpq
> const&)':
> mexfile.cpp:(.text._ZN5boostmiERKN4CGAL4GmpqES3_[boost::operator-(CGAL::Gmpq
> const&, CGAL::Gmpq const&)]+0x3e): undefined reference to `__gmpq_init'
> mexfile.cpp:(.text._ZN5boostmiERKN4CGAL4GmpqES3_[boost::operator-(CGAL::Gmpq
> const&, CGAL::Gmpq const&)]+0x60): undefined reference to `__gmpq_sub'
> mexfile.o: In function `boost::operator*(CGAL::Gmpq const&, CGAL::Gmpq
> const&)':
> mexfile.cpp:(.text._ZN5boostmlERKN4CGAL4GmpqES3_[boost::operator*(CGAL::Gmpq
> const&, CGAL::Gmpq const&)]+0x3e): undefined reference to `__gmpq_init'
> mexfile.cpp:(.text._ZN5boostmlERKN4CGAL4GmpqES3_[boost::operator*(CGAL::Gmpq
> const&, CGAL::Gmpq const&)]+0x60): undefined reference to `__gmpq_mul'
> mexfile.o: In function `CGAL::Same_uncertainty_nt<CGAL::Sign,
> CGAL::Gmpq>::type CGAL::orientationC2<CGAL::Gmpq>(CGAL::Gmpq const&,
> CGAL::Gmpq const&, CGAL::Gmpq const&, CGAL::Gmpq const&, CGAL::Gmpq const&,
> CGAL::Gmpq const&)':
It seems that you do not link with the used libraries. You need at least -lCGAL,
maybe also -lboost or -lgmp.
If it still does not work please show the linker command that is executed. I
don't know the mex tool, but I guess it has a mode that echoes the executed
commands.
Joachim
--
You are currently subscribed to cgal-discuss.
To unsubscribe or access the archives, go to
https://lists-sop.inria.fr/wws/info/cgal-discuss
- [cgal-discuss] how to compile mex-file based on CGAL in Matlab, 魏华祎, 03/13/2011
- Re: [cgal-discuss] how to compile mex-file based on CGAL in Matlab, Joachim Reichel, 03/14/2011
- Re: [cgal-discuss] how to compile mex-file based on CGAL in Matlab, 魏华祎, 03/14/2011
- Re: [cgal-discuss] how to compile mex-file based on CGAL in Matlab, 魏华祎, 03/14/2011
- Re: [cgal-discuss] how to compile mex-file based on CGAL in Matlab, 魏华祎, 03/14/2011
- Re: [cgal-discuss] how to compile mex-file based on CGAL in Matlab, Sylvain Pion, 03/14/2011
- Re: [cgal-discuss] how to compile mex-file based on CGAL in Matlab, 魏华祎, 03/14/2011
- Re: [cgal-discuss] how to compile mex-file based on CGAL in Matlab, avaxman, 03/14/2011
- Re: [cgal-discuss] how to compile mex-file based on CGAL in Matlab, 魏华祎, 03/14/2011
- Re: [cgal-discuss] how to compile mex-file based on CGAL in Matlab, 魏华祎, 03/14/2011
- Re: [cgal-discuss] how to compile mex-file based on CGAL in Matlab, 魏华祎, 03/14/2011
- Re: [cgal-discuss] how to compile mex-file based on CGAL in Matlab, Joachim Reichel, 03/14/2011
Archive powered by MHonArc 2.6.16.