Closed joe-jordan closed 5 years ago
OK, having read up on CMake, and had a look at src/CMakeLists.txt, I've switched on Clang in that file - it looks as if the makefiles shouldn't have been using it, but for some reason they were before, at least for linking the dynamic library.
Anyway, having turned on Clang I get much stricter type checking - I've fixed a "bug" - I have no idea why, at src/vertex_positioner.cpp:611 :
bool tol = 1e-3;
was there in the first place, since the value seems to be used as a double... GCC gives this as a warning, but Clang just stops at that point. Having updated that to:
double tol = 1e-3;
The rest of the code builds, and I now get the same Clang error:
[ 95%] Built target openvoronoi_static
Scanning dependencies of target openvoronoi
[100%] Building CXX object CMakeFiles/openvoronoi.dir/py/open_voronoi_py.o
Linking CXX shared module openvoronoi.so
clang: error: invalid argument '-current_version 12.2.284' only allowed with '-dynamiclib'
make[2]: *** [openvoronoi.12.02.284.so] Error 1
make[1]: *** [CMakeFiles/openvoronoi.dir/all] Error 2
make: *** [all] Error 2
Seeing as I can't find "currentversion
" or anything similar in src/CMakeLists.txt (which I'm assuming is the only cmake input file), I'm guessing this is a clash between my version of cmake and my version of clang?
clang version above, cmake:
cmake version 2.8.10.2
I still can't get this to build, any help appreciated.
I have got this to install by editing the offending linker line in the generated cmake file build/CMakeFiles/openvoronoi.dir/link.txt
- two changes were necessary. I removed the -currentversion
argument, and I had to add -framework Python
to avoid missing symbol errors - but the main C++ dynamic shared library now compiles.
When I ran make install, it put the libraries in /usr/local/lib/python2.7/site-packages
, which isn't actually on my import path (I tried to import openvoronoi
and got an ImportError.). Having copied all the installed files to /Library/Python/2.7/site-packages
(where all the rest of my python modules go) I can import the module successfully.
By all means file this issue away now, but I think it would be worth getting to the bottom of what cmake is doing so wrong with clang arguments. I'm sure the build process works fine on Ubuntu, but it's a real pain on a Mac!
This looks more like a cmake issue. Maybe you could come up with a minimal example which works on ubuntu but fails on osX? and post that on the cmake mailing-list? I have programming examples over here. https://github.com/aewallin/sandbox Many use much the same pattern of cmake + boost-python so they might show the same problems. start with e.g. "boost_python_helloworld"
I had the same issue,
joe's hack fixed it that. unfortunately I have -zero knowledge of cmake and cannot supply a fix.
Hi, in CMakeLists.txt the python site-packages directory is found around line 262. It uses the distutils.sysconfig python module and calls get_python_lib(), for documentation see e.g. http://docs.python.org/2/distutils/apiref.html
If you could experiment on your Mac OSX machine, in a normal python shell, with something like: from distutlis.sysconfig import get_python_lib print get_python_lib() # with various options, see docs
until you get the desired install directory, which may be /Library/Python/2.7/site-packages as mentioned above. It should then be fairly simple to modify CMakeLists to check if it's on a Mac platform and run the proper get_python_lib() call.
Hey,
import site; site.getsitepackages() ['/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python', '/Library/Python/2.7/site-packages']
From what I understand from cmake and python (about zero knowledge in both) is that it should be able to figure out...
looking at this line : COMMAND python -c "from distutils.sysconfig import get_python_lib; print get_python_lib(0,0,\"/usr/local\")"
it seems like that some data mangling is done and although python returns the right path, this get's changed back into a /usr/local variant???
Trying to understand python, who not do it like this: COMMAND python -c "from distutils.sysconfig import get_python_lib; print get_python_lib()"
I do see some /usr/local going on late run cmake which I am not sure what to do with.
bash-3.2$ sudo make install Password: [ 47%] Built target libopenvoronoi [ 95%] Built target openvoronoi_static [100%] Built target openvoronoi Install the project... -- Install configuration: "Release" -- Installing: /Library/Python/2.7/site-packages/openvoronoi.12.02.289.so -- Up-to-date: /Library/Python/2.7/site-packages/openvoronoi.so -- Up-to-date: /Library/Python/2.7/site-packages/ovdvtk.py -- Up-to-date: /Library/Python/2.7/site-packages/ngc_writer.py -- Up-to-date: /Library/Python/2.7/site-packages/ovdgenerators.py -- Installing: /usr/local/lib/openvoronoi/libopenvoronoi.12.02.289.dylib -- Installing: /usr/local/lib/openvoronoi/libopenvoronoi.dylib -- Installing: /usr/local/include/openvoronoi/graph.hpp -- Installing: /usr/local/include/openvoronoi/voronoidiagram.hpp -- Installing: /usr/local/include/openvoronoi/vertex.hpp -- Installing: /usr/local/include/openvoronoi/edge.hpp -- Installing: /usr/local/include/openvoronoi/site.hpp -- Installing: /usr/local/include/openvoronoi/checker.hpp -- Installing: /usr/local/include/openvoronoi/vertex_positioner.hpp -- Installing: /usr/local/include/openvoronoi/kdtree.hpp -- Installing: /usr/local/include/openvoronoi/offset.hpp -- Installing: /usr/local/include/openvoronoi/offset_sorter.hpp -- Installing: /usr/local/include/openvoronoi/filter.hpp -- Installing: /usr/local/include/openvoronoi/medial_axis_filter.hpp -- Installing: /usr/local/include/openvoronoi/medial_axis_walk.hpp -- Installing: /usr/local/include/openvoronoi/medial_axis_pocket.hpp -- Installing: /usr/local/include/openvoronoi/polygon_interior_filter.hpp -- Installing: /usr/local/include/openvoronoi/island_filter.hpp -- Installing: /usr/local/include/openvoronoi/version_string.hpp -- Installing: /usr/local/include/openvoronoi/version.hpp -- Installing: /usr/local/include/openvoronoi/common/numeric.hpp -- Installing: /usr/local/include/openvoronoi/common/point.hpp -- Installing: /usr/local/include/openvoronoi/common/halfedgediagram.hpp -- Installing: /usr/local/include/openvoronoi/utility/vd2svg.hpp -- Installing: /usr/local/include/openvoronoi/utility/simple_svg_1.0.0.hpp -- Installing: /usr/local/include/openvoronoi/solvers/solution.hpp -- Installing: /usr/local/include/openvoronoi/solvers/solver.hpp -- Installing: /usr/local/include/openvoronoi/solvers/solver_lll.hpp -- Installing: /usr/local/include/openvoronoi/solvers/solver_lll_para.hpp -- Installing: /usr/local/include/openvoronoi/solvers/solver_ppp.hpp -- Installing: /usr/local/include/openvoronoi/solvers/solver_qll.hpp -- Installing: /usr/local/include/openvoronoi/solvers/solver_sep.hpp -- Installing: /usr/local/include/openvoronoi/solvers/solver_alt_sep.hpp Press any key to continue...
ok, I just committed a change that uses simply get_python_lib() it seems to work over here (Ubuntu 13.10)
the .hpp files are headers, used if you program your own c++ program that links against openvoronoi. I don't know if /usr/local/inculde is the correct place for them on OSX.
https://github.com/nraynaud/opencamlib/commit/7a0dbea57c756c5c59442107257014781f6c6820 I think I struck some gold one year ago, avoiding setting the version when on a mac goes further in the compilation process. I'm looking into it, I hope to send a pull request soon.
closing this old issue.
I get a build error.
Cmake runs without issue (well, it gave me warnings about missing libraries, I installed them, then it ran with out issue).
Then, upon running "make", the static library builds find and the dynamic passes clang an invalid combination of parameters:
I am not a cmake expert, so I don't know how to edit/re-run with the updated option added - instructions on how to do that would be very helpful, as well as a patch!
My system details are:
Mac OS X 10.8.3, clang:
System python (2.7.3, framework.)