Subject: CGAL users discussion list
List archive
[cgal-discuss] want to use CGAL in Matlab, but can't compile mex file in matlab,
Chronological Thread
- From: 魏华祎 <>
- To:
- Subject: [cgal-discuss] want to use CGAL in Matlab, but can't compile mex file in matlab,
- Date: Fri, 13 May 2011 17:37:45 -0700
- Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:date:message-id:subject:from:to:content-type; b=toZTs4AptNZsfS0IKlcyUF5wAxFvLQIF+tec9fH6YNU7SM0WQbvsnfaR1GaLqB1qyz g2cECnfsPxBpNsRdYBKA0cwBVwKopxurFW4oUd+gr+dqtM+1+4hSl2ovcd60173A0yqC 8rit/vQxRmvZH+WyBGPUw+EfQvRt7JYUO4H6s=
Hi, everyone,
In fact, I can compile it before I update my Ubuntu system to 11.04 and CGAL to 3.8. But now, it can't compile. The error information is at the bottom. I can't understand the error. Who can give me some suggestion or hints about it?
Thanks a lot!
Best
Huayi
mex -v spherevoronoi.cpp -lCGAL -lgmp -lboost_thread -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_thread -L/usr/lib/:/usr/local/lib/:/opt/matlab/extern/lib/glnxa64
-> LDCXX =
-> Link flags:
LDCXXFLAGS =
LDCXXDEBUGFLAGS =
LDCXXOPTIMFLAGS =
LDCXXEXTENSION =
arguments = -lCGAL -lgmp -lboost_thread -L/usr/lib/:/usr/local/lib/:/opt/matlab/extern/lib/glnxa64
----------------------------------------------------------------
Warning: You are using gcc version "4.5.2-8ubuntu4)". The version
currently supported with MEX is "4.2.3".
For a list of currently supported compilers see:
-> 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 "spherevoronoi.cpp"
/usr/lib/x86_64-linux-gnu/gcc/x86_64-linux-gnu/4.5.2/cc1plus: /opt/matlab/sys/os/glnxa64/libstdc++.so.6: version `GLIBCXX_3.4.14' not found (required by /usr/lib/libppl_c.so.2)
/usr/lib/x86_64-linux-gnu/gcc/x86_64-linux-gnu/4.5.2/cc1plus: /opt/matlab/sys/os/glnxa64/libstdc++.so.6: version `GLIBCXX_3.4.11' not found (required by /usr/lib/libppl_c.so.2)
/usr/lib/x86_64-linux-gnu/gcc/x86_64-linux-gnu/4.5.2/cc1plus: /opt/matlab/sys/os/glnxa64/libstdc++.so.6: version `GLIBCXX_3.4.14' not found (required by /usr/lib/libppl.so.7)
/usr/lib/x86_64-linux-gnu/gcc/x86_64-linux-gnu/4.5.2/cc1plus: /opt/matlab/sys/os/glnxa64/libstdc++.so.6: version `GLIBCXX_3.4.11' not found (required by /usr/lib/libppl.so.7)
/usr/lib/x86_64-linux-gnu/gcc/x86_64-linux-gnu/4.5.2/cc1plus: /opt/matlab/sys/os/glnxa64/libstdc++.so.6: version `GLIBCXX_3.4.11' not found (required by /usr/lib/libgmpxx.so.4)
mex: compile of ' "spherevoronoi.cpp"' failed.
??? Error using ==> mex at 222
Unable to complete successfully.
// Huayi Wei, <> #include <CGAL/Surface_mesh_default_triangulation_3.h> #include <iostream> #include <fstream> #include <list> #include <set> #include <vector> #include "matrix.h" #include "mex.h" // default triangulation for Surface_mesher typedef CGAL::Surface_mesh_default_triangulation_3 Delaunay3d; typedef Delaunay3d::Finite_vertices_iterator Vit; typedef Delaunay3d::Cell_handle Cell_handle; typedef Delaunay3d::Vertex_handle Vertex_handle; typedef Delaunay3d::Facet Facet; typedef Delaunay3d::Edge Edge; typedef Delaunay3d::Triangle Triangle; typedef Delaunay3d::Geom_traits GT; typedef GT::Point_3 Point_3; typedef GT::Vector_3 Vector_3; typedef GT::FT FT; void mexFunction(int nlhs, mxArray* plhs[], int nrhs, mxArray *prhs[]){ /* Check for proper number of input and output arguments */ if (nrhs != 1) { mexErrMsgTxt("we need one input of generators!"); } if(nlhs > 2){ mexErrMsgTxt("Too many output arguments."); } mwIndex offset; mxArray * generator_on_sphere = prhs[0]; mwSize number_of_generator = mxGetM(generator_on_sphere); std::vector<Point_3> points; double * pg_on_sphere = mxGetPr(generator_on_sphere); for(int i = 0; i < number_of_generator; i++){ int subs[2]; subs[0]=i; subs[1]=0; offset = mxCalcSingleSubscript(generator_on_sphere,2,subs); double x = pg_on_sphere[offset]; subs[1]=1; offset = mxCalcSingleSubscript(generator_on_sphere,2,subs); double y = pg_on_sphere[offset]; subs[1]=2; offset = mxCalcSingleSubscript(generator_on_sphere,2,subs); double z = pg_on_sphere[offset]; points.push_back(Point_3(x,y,z)); } //produce the delaunay triangulation Delaunay3d D3d(points.begin(),points.end()); //compute the circumcenter of the facet on the sphere surface std::map<Facet,int> facets_map; std::vector<Point_3> circumcenters; int count = 0; std::vector<Cell_handle> all_infinite_cells; D3d.incident_cells( D3d.infinite_vertex(), std::back_inserter(all_infinite_cells)); std::vector<Cell_handle>::iterator cit = all_infinite_cells.begin(); for( ;cit != all_infinite_cells.end(); cit++){ int idx =(*cit)->index(D3d.infinite_vertex()); Facet facet = Facet(*cit,idx); facets_map[facet]=count; Triangle t = D3d.triangle(facet); Point_3 p = CGAL::circumcenter(t); FT r = CGAL::sqrt(p.x()*p.x()+p.y()*p.y()+p.z()*p.z()); circumcenters[count] = Point_3(p.x()/r,p.y()/r,p.z()/r); count ++; } //construct the voronoi diagram std::vector<Edge> all_infinite_edges; std::vector<std::list<int> > voronoi_cells; D3d.incident_edges(D3d.infinite_vertex(),std::back_inserter(all_infinite_edges)); std::vector<Edge>::iterator eit = all_infinite_edges.begin(); for(;eit != all_infinite_edges.end(); eit++){ std::list<int> idx_of_voronoi_vertices; Cell_handle cell = (*eit).first; int i = (*eit).second; int j = (*eit).third; Vertex_handle v1, v2;// v1 is the finite vertex and v2 the infinite vertex of edge *eit if (D3d.is_infinite(cell->vertex(i))){ v1 = cell->vertex(j); v2 = cell->vertex(i); }else{ v1 = cell->vertex(i); v2 = cell->vertex(j); } Delaunay3d::Cell_circulator ccir = D3d.incident_cells(*eit); Delaunay3d::Cell_circulator ccir_begin = ccir; bool flag = true; while(true){ Delaunay3d::Cell_circulator ccir_tmp = ccir++; int k1 = ccir_tmp->index(v1); int k2 = ccir_tmp->index(v2); idx_of_voronoi_vertices.push_back(facets_map[Facet(ccir_tmp,k2)]); if(flag) for( int j =0; j < 3; j++){ if(k1 == D3d.vertex_triple_index(k2,j)){ j = (j+2)%3; if(ccir_tmp->neighbor(D3d.vertex_triple_index(k2,j))==ccir) flag = false; } } if( ccir == ccir_begin) break; } if(!flag) idx_of_voronoi_vertices.reverse(); voronoi_cells.push_back(idx_of_voronoi_vertices); } // set the return data: cell mxArray *cell_matrix = mxCreateCellMatrix((mwSize)number_of_generator,1); for(int i = 0; i < number_of_generator; i++){ int n = voronoi_cells[i].size(); mxArray * mxcell = mxCreateDoubleMatrix((mwSize)n,1, mxREAL); double * ptr = mxGetPr(mxcell); std::list<int>::iterator it; int j = 0; for(it = voronoi_cells[i].begin(); it != voronoi_cells[i].end(); it++) ptr[j++]=*it; mxSetCell(cell_matrix,i,mxcell); } // voronoi vertex mxArray * voronoi_vertices_matrix = mxCreateDoubleMatrix((mwSize)count,3, mxREAL); double * ptr_vv = mxGetPr(voronoi_vertices_matrix); for(int i = 0; i < count; i++){ int subs[2]; subs[0]=i; subs[1]=0; offset = mxCalcSingleSubscript(voronoi_vertices_matrix,2,subs); ptr_vv[offset] = circumcenters[i].x(); subs[0]=i; subs[1]=1; offset = mxCalcSingleSubscript(voronoi_vertices_matrix,2,subs); ptr_vv[offset] = circumcenters[i].y(); subs[0]=i; subs[1]=2; offset = mxCalcSingleSubscript(voronoi_vertices_matrix,2,subs); ptr_vv[offset] = circumcenters[i].z(); } plhs[0] = voronoi_vertices_matrix; plhs[1] = cell_matrix; }
- [cgal-discuss] want to use CGAL in Matlab, but can't compile mex file in matlab,, 魏华祎, 05/14/2011
Archive powered by MHonArc 2.6.16.