You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi all! I recently had call to build Packaide under Windows, and had some difficulty (partly because I was using non-system python, and so had to rebuild python-boost - for the curious, I wanted to build against FreeCAD's Python). I ran in to a couple of roadblocks and unfortunately I'm not skilled enough in CMake to remedy them properly and submit a pull request. Best I can do is summarise what I did for any other Windows users that are having trouble.
I wrote a script to automate this, but it's written for (cygwin's) bash, so it is unlikely to be useful for most users. Nevertheless, I'll include excerpts to illustrate my points. as I go along.
BTW, for those whose threat model allows it, I've made my compiled binaries available - https://github.com/randomdude/Packaide/releases/tag/1.0 . I'm also terrible at Python packaging so YMMV - they might not work, but I'll do my best to fix them if so.
These steps worked for me using Boost 1.84.0 and Visual Studio 2017.
If you're using non-system Python (ie, you want to rebuild Boost_python), then edit the project-config.jam file after invoking bootstrap.bat. Specify paths to your Python there, eg:
After building boost, copy stage/lib/boost_python[pythonver]-*.lib to remove the version number.
for x in `ls stage/lib/boost_python$pythonver-*.lib`; do
newname=`echo $x | sed -e "s/boost_python$pythonver-/boost_python-/g"`
cp $x $newname
done
I found I had to patch Boost - something goes wrong with compiler detection and I'm in no way knowlegable enough to fix it. Simple enough, change std::snprintf to snprintf in the boost/assert/source_location.hpp file. I found I had to do this in both vcpkg boost and the one I'd build, strangely.
sed -i.bak installed/x64-windows/include/boost/assert/source_location.hpp -e 's/std::snprintf/snprintf/g'
sed -i.bak ../boost_1_84_0/boost/assert/source_location.hpp -e 's/std::snprintf/snprintf/g'
Before you invoke CMake, edit src/CMakeLists.txt and remove the following line:
Otherwise, VS will refuse to build (as it doesn't understand -Wfatal-errors. I considered submitting a fix for this, but don't feel comfortable just removing -Wfatal-errors for all platforms - I'll leave it to someone who knows how to CMake to do it properly.
When invoking CMake, we can't specify the usual target for Boost, since that would include vcpkg's version and not the one we've just built. Specify it manually, and also specify other build deps.
I had to tweak the generated project, too - we need to put the python version number back into the libraries-to-link list. If I was smart, I'd know how to fix this in CMake, but unfortunately, I am not :) Use something like '38' for pythonver.
sed -i.bak -e "s/boost_python-\(.*\)-1_84.lib/boost_python${pythonver}-\1-1_84.lib/g" src/PackaideBindings.vcxproj
Finally, when installing, you'll need to change the installed PackadeBindings.dll to PackadeBindings.pyd, since Windows Python requires this extension. You'll need the appropriate runtimes in your PATH - initially I was lazy and just copied mpfr.dll, gmp.dll, and stage/lib/boost_python${pythonver}-vc141-mt-x64-1_84.dll into the Python libs directory, and that worked. I actually have a wheel package set up for Packaide now - see above - but I'm pretty new to Python packaging and so it may well be suboptimal and/or broken.
Apologies for the somewhat rambly nature of this not-really-a-bug! I spent about a week getting Packaide playing nicely with FreeCAD on Windows, and all packaged up via Jenkins. Having sunk that time into it, I'm keen to document the process by sharing my experiences and try to save someone else the hassle.
The text was updated successfully, but these errors were encountered:
Hi all! I recently had call to build Packaide under Windows, and had some difficulty (partly because I was using non-system python, and so had to rebuild python-boost - for the curious, I wanted to build against FreeCAD's Python). I ran in to a couple of roadblocks and unfortunately I'm not skilled enough in CMake to remedy them properly and submit a pull request. Best I can do is summarise what I did for any other Windows users that are having trouble.
I wrote a script to automate this, but it's written for (cygwin's) bash, so it is unlikely to be useful for most users. Nevertheless, I'll include excerpts to illustrate my points. as I go along.
BTW, for those whose threat model allows it, I've made my compiled binaries available - https://github.com/randomdude/Packaide/releases/tag/1.0 . I'm also terrible at Python packaging so YMMV - they might not work, but I'll do my best to fix them if so.
These steps worked for me using Boost 1.84.0 and Visual Studio 2017.
project-config.jam
file after invokingbootstrap.bat
. Specify paths to your Python there, eg:Python
andSystem
options, and be sure to specifyshared
linkingstage/lib/boost_python[pythonver]-*.lib
to remove the version number.std::snprintf
tosnprintf
in theboost/assert/source_location.hpp
file. I found I had to do this in both vcpkg boost and the one I'd build, strangely.src/CMakeLists.txt
and remove the following line:Otherwise, VS will refuse to build (as it doesn't understand
-Wfatal-errors
. I considered submitting a fix for this, but don't feel comfortable just removing-Wfatal-errors
for all platforms - I'll leave it to someone who knows how to CMake to do it properly.I had to tweak the generated project, too - we need to put the python version number back into the libraries-to-link list. If I was smart, I'd know how to fix this in CMake, but unfortunately, I am not :) Use something like '38' for pythonver.
Finally, when installing, you'll need to change the installed
PackadeBindings.dll
toPackadeBindings.pyd
, since Windows Python requires this extension. You'll need the appropriate runtimes in your PATH - initially I was lazy and just copiedmpfr.dll
,gmp.dll
, andstage/lib/boost_python${pythonver}-vc141-mt-x64-1_84.dll
into the Pythonlibs
directory, and that worked. I actually have a wheel package set up for Packaide now - see above - but I'm pretty new to Python packaging and so it may well be suboptimal and/or broken.Apologies for the somewhat rambly nature of this not-really-a-bug! I spent about a week getting Packaide playing nicely with FreeCAD on Windows, and all packaged up via Jenkins. Having sunk that time into it, I'm keen to document the process by sharing my experiences and try to save someone else the hassle.
The text was updated successfully, but these errors were encountered: