Skip to content


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP


Noqt #305

merged 2 commits into from

2 participants


I think I (finally) removed the last Qt dependencies for the core and tests.

Testing/review would be appreciated :)


this breaks older boost... i think uhm .. fs::canonical was introduced in 1.48 or somewhere around there.

im trying to backport and i got pretty far but there was some bizarre bug that made a handful of import tests fail on an old freebsd machine i was on.

will try again tomorrow (if you havent fixed by then....)


wops - well, I had a hunch I shouldn't push to master...
It looked so easy - just needed a way of replacing QDir::relativeFilePath().

There is an alternative implementation in boostfs_relative_path().
I somehow trust it less, but haven't really tested it.


We should document somewhere minimum required versions of libraries, and why we want to be compatible with those versions, so that we can upgrade when the reason to stay compatible goes away.


hm, but the alternative implementation uses fs::absolute(), which isn't available in older boost versions either..


It still fails on Boost 1.40 on gcc20:

I'm working on setting up an easier way of testing against different library versions.


gcc 20 has an outdated version of gmp and it doesn't have glew at all so i have always used the build script on that machine.... i was doing testing on the freebsd 9.0 machine they had... oh well. . . i think it had like boost 1.45..

the few times i did test 'old boost' i edited the version in the build-script file itself and rebuilt the dependencies.... anyways like you said itd be nice to have a policy regarding backports.... the issue with boost is that machines with outdated boost are likely to also have old gmp and/or mpfr, which CGAL uses directly, so it gets complicated....
i am not sure how to approach it really. i have focused energy in the past on making the dependency-build work because so many distros do not have updated CGAL or opencsg or even boost... (and a lot of people dont have root anyways so they cant install things like boost,glew, etc even if they wanted to)



On gcc20, I built all libraries using the script, but with old versions, for testing. boost 1.40 was the oldest version I managed to build. The idea was to have an easy way of testing compatibility given the latest boost issues.

I'm hoping to set up a decent collection of builds, and make the deps folders public, so that we all can build against them. Using gcc20 makes my turnaround times vastly faster than building locally on my Mac.


the problem i have when building older boost is that, older boost has a lot of bugs, for example certain versions of boost are broken against certain versions of gcc and wont build at all, sometimes only portions of boost are broken (like variant.hpp) .... also some older versions of boost have a broken '--prefix' on their install script so the install to home fails, and on and on and on.


How fun..

Do you remember which version of boost you tested your last changes to this branch on?


yeah i think it was 1.45 on freebsd 9 (which might work different from linux).

something about dealing with ".." and fs::path.remove_filename() inside of canonical() is what is currently breaking your tests i believe. i have been experimenting with 1.36 but no solid fix yet.


and by the way you may know this, but the 'openscad example 001' breaks on certain versions of Mesa + Xvfb - including PPC64 Fedora 18, FreebSD 9, and Gcc20 (whatever it is using), but that is a problem in Master not related to boost or 'noqt'.

@donbright donbright backport to boost 1.37. improve dependency build for older lib versions
including the requirement of symlink to $DEPLOYDIR/include/boost if
boost is so old that it uses version numbers in the path name

ok this is a backport to boost 1.37 tests 100% on gcc 20 (except for example001 which is Xvfb related)

also improved the way boost and CGAL build so that it will be more reliable and not break so often.

it also requires a by-hand symlink of $DEPLOYDIR/include/boost_1_37_0 to $DEPLOYDIR/include/boost


I believe this should be stable enough to merge into master - any thoughts?


i say go for it.

@kintel kintel merged commit f242a7a into master
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Mar 17, 2013
  1. @kintel

    Merge pull request #313 from openscad/noqt_tweaks

    kintel authored
    Noqt tweaks
Commits on Mar 21, 2013
  1. @donbright

    backport to boost 1.37. improve dependency build for older lib versions

    donbright authored
    including the requirement of symlink to $DEPLOYDIR/include/boost if
    boost is so old that it uses version numbers in the path name
This page is out of date. Refresh to see the latest.
Showing with 72 additions and 34 deletions.
  1. +34 −12 scripts/
  2. +24 −19 src/boosty.h
  3. +14 −3 src/
46 scripts/
@@ -264,6 +264,12 @@ build_boost()
echo boost build failed
exit 1
+ if [ "`ls $DEPLOYDIR/include/ | grep boost.[0-9]`" ]; then
+ if [ ! -e $DEPLOYDIR/include/boost ]; then
+ echo "boost is old, make a symlink to $DEPLOYDIR/include/boost & rerun"
+ exit 1
+ fi
+ fi
@@ -276,17 +282,26 @@ build_cgal()
echo "Building CGAL" $version "..."
cd $BASEDIR/src
rm -rf CGAL-$version
- if [ ! -f CGAL-$version.tar.* ]; then
- # 4.1
- curl --insecure -O$version.tar.bz2
- # 4.0.2 curl --insecure -O$version.tar.bz2
- # 4.0 curl --insecure -O$version.tar.gz #4.0
- # 3.9 curl --insecure -O$version.tar.gz #3.9
- # 3.8 curl --insecure -O$version.tar.gz
- # 3.7 curl --insecure -O$version.tar.gz
- fi
- tar xf CGAL-$version.tar.bz2
+ ver4_1="curl --insecure -O"
+ ver4_0_2="curl --insecure -O"
+ ver4_0="curl --insecure -O"
+ ver3_9="curl --insecure -O"
+ ver3_8="curl --insecure -O"
+ ver3_7="curl --insecure -O"
+ vernull="echo already downloaded..skipping"
+ download_cmd=ver`echo $version | sed s/"\."/"_"/`
+ if [ -e CGAL-$version.tar.gz ]; then download_cmd=vernull; fi
+ if [ -e CGAL-$version.tar.bz2 ]; then download_cmd=vernull; fi
+ `eval echo "$"$download_cmd`
+ if [ -e CGAL-$version.tar.gz ]; then tar xf CGAL-$version.tar.gz; fi
+ if [ -e CGAL-$version.tar.bz2 ]; then tar xf CGAL-$version.tar.bz2; fi
cd CGAL-$version
+ # older cmakes have buggy FindBoost that can result in
+ # finding the system libraries but OPENSCAD_LIBRARIES include paths
+ cp $FINDBOOST_CMAKE ./cmake/modules/
mkdir bin
cd bin
rm -rf ./*
@@ -295,10 +310,13 @@ build_cgal()
+ DEBUGBOOSTFIND=0 # for debugging FindBoost.cmake (not for debugging boost)
if [ "`echo $2 | grep use-sys-libs`" ]; then
make -j$NUMCPU
make install
@@ -459,7 +477,11 @@ build_eigen()
# the 'dirname' command installed
if [ "`command -v dirname`" ]; then
+ cd $RUNDIR
if [ ! -f ]; then
echo "Must be run from the OpenSCAD source root directory (dont have 'dirname')"
43 src/boosty.h
@@ -26,6 +26,7 @@
#include <string>
#include <boost/version.hpp>
#include <boost/filesystem.hpp>
+#include <boost/algorithm/string.hpp>
namespace fs = boost::filesystem;
#include "printutils.h"
@@ -97,29 +98,33 @@ inline fs::path canonical( fs::path p )
inline fs::path canonical( fs::path p, fs::path p2 )
- // dotpath: win32/mac builds will be using newer versions of boost
- // so we can treat this as though it is unix only
- const fs::path dot_path(".");
- const fs::path dot_dot_path("..");
+#if defined (__WIN32__) || defined(__APPLE__)
+#error you should be using a newer version of boost on win/mac
+ // based on the code in boost
fs::path result;
- if (p=="")
+ if (p=="") p=p2;
+ std::string result_s;
+ std::vector<std::string> resultv, pieces;
+ std::vector<std::string>::iterator pi;
+ std::string tmps = boosty::stringy( p );
+ boost::split( pieces, tmps, boost::is_any_of("/") );
+ for ( pi = pieces.begin(); pi != pieces.end(); ++pi )
+ {
+ if (*pi == "..")
+ resultv.erase( resultv.end() );
+ else
+ resultv.push_back( *pi );
+ }
+ for ( pi = resultv.begin(); pi != resultv.end(); ++pi )
- p=p2;
+ if ((*pi).length()>0) result_s = result_s + "/" + *pi;
- for (fs::path::iterator itr = p.begin(); itr != p.end(); itr++)
+ result = fs::path( result_s );
+ if (fs::is_symlink(result))
- if (*itr == dot_path) continue;
- if (*itr == dot_dot_path)
- {
- result.remove_filename();
- continue;
- }
- result /= *itr;
- if (fs::is_symlink(result))
- {
- PRINT("WARNING: canonical() wrapper can't do symlinks. rebuild openscad with boost >=1.48");
- PRINT("WARNING: or don't use symbolic links");
- }
+ PRINT("WARNING: canonical() wrapper can't do symlinks. rebuild openscad with boost >=1.48");
+ PRINT("WARNING: or don't use symbolic links");
return result;
17 src/
@@ -185,6 +185,17 @@ static bool point_on_line(double *p1, double *p2, double *p3)
return true;
+typedef std::pair<int,int> pair_ii;
+inline void do_emplace( boost::unordered_multimap<int, pair_ii> &tri_by_atan2, int ai, const pair_ii &indexes)
+#if BOOST_VERSION >= 104800
+ tri_by_atan2.emplace(ai, indexes);
+ std::pair< int, pair_ii > tmp( ai, indexes );
+ tri_by_atan2.insert( tmp );
up: true if the polygon is facing in the normal direction (i.e. normal = [0,0,1])
rot: CLOCKWISE rotation around positive Z axis
@@ -280,7 +291,7 @@ void dxf_tesselate(PolySet *ps, DxfData &dxf, double rot, bool up, bool do_trian
for (int j = 0; j < 3; j++) {
int ai = (int)round(atan2(fabs(tess_tri[i].p[(j+1)%3][0] - tess_tri[i].p[j][0]),
fabs(tess_tri[i].p[(j+1)%3][1] - tess_tri[i].p[j][1])) / 0.001);
- tri_by_atan2.emplace(ai, std::pair<int,int>(i, j));
+ do_emplace( tri_by_atan2, ai, std::pair<int,int>(i, j) );
while (added_triangles)
@@ -321,13 +332,13 @@ void dxf_tesselate(PolySet *ps, DxfData &dxf, double rot, bool up, bool do_trian
for (int m = 0; m < 2; m++) {
int ai = (int)round(atan2(fabs(tess_tri.back().p[(m+1)%3][0] - tess_tri.back().p[m][0]),
fabs(tess_tri.back().p[(m+1)%3][1] - tess_tri.back().p[m][1])) / 0.001 );
- tri_by_atan2.emplace(ai, std::pair<int,int>(tess_tri.size()-1, m));
+ do_emplace(tri_by_atan2, ai, std::pair<int,int>(tess_tri.size()-1, m));
tess_tri[i].p[(k+1)%3] = tess_tri[j].p[l];
for (int m = 0; m < 2; m++) {
int ai = (int)round(atan2(fabs(tess_tri[i].p[(m+1)%3][0] - tess_tri[i].p[m][0]),
fabs(tess_tri[i].p[(m+1)%3][1] - tess_tri[i].p[m][1])) / 0.001 );
- tri_by_atan2.emplace(ai, std::pair<int,int>(i, m));
+ do_emplace(tri_by_atan2, ai, std::pair<int,int>(i, m));
added_triangles = true;
Something went wrong with that request. Please try again.