Opened 8 years ago

Closed 8 years ago

#51840 closed defect (fixed)

[openscad] [2015.03-3_0] [build error]

Reported by: moala@… Owned by: dstrubbe (David Strubbe)
Priority: Normal Milestone:
Component: ports Version: 2.3.4
Keywords: Cc:
Port: openscad

Description

Can't upgrade openscad since version 2014.03_4.

Mac OS X 10.11.5 (15F34)

universal variant or no variant.

Attached is the build log for an attempt with variant -universal and build.jobs=1

Trimmed potentially relevant build log:

:info:build Undefined symbols for architecture x86_64:
:info:build   "save_framebuffer(OffscreenContext*, std::__1::basic_ostream<char, std::__1::char_traits<char> >&)", referenced from:
:info:build       OffscreenView::save(std::__1::basic_ostream<char, std::__1::char_traits<char> >&) in OffscreenView.o
:info:build   "write_png(std::ostream&, unsigned char*, int, int)", referenced from:
:info:build       save_framebuffer(OffscreenContext*, std::ostream&) in OffscreenContextCGL.o

etc.

Attachments (1)

openscad.build.main.log (335.1 KB) - added by moala@… 8 years ago.
build log

Download all attachments as: .zip

Change History (12)

Changed 8 years ago by moala@…

Attachment: openscad.build.main.log added

build log

comment:1 Changed 8 years ago by moala@…

Xcode 7.3.1 BTW

comment:2 Changed 8 years ago by mf2k (Frank Schima)

Cc: dstrubbe@… openmaintainer@… removed
Owner: changed from macports-tickets@… to dstrubbe@…

Please do not Cc openmaintainer@… because it is not a valid email address.

FYI, it built fine for me on El Cap.

$ port -v installed openscad
The following ports are currently installed:
  openscad @2015.03-3_0 (active) platform='darwin 15' archs='x86_64' date='2016-06-13 15:16:32'

comment:3 Changed 8 years ago by kenneth.f.cunningham@…

I just tried to build it as well, on 10.6.8 with <https://trac.macports.org/wiki/LibcxxOnOlderSystems> installed, and ran into the same error log. It's a bit confusing, as the errors seem to be from different libraries (save_framebuffer appears to be in OpenGL, CocoaUtils would probably be in objc, and there are many failed links into the std:: lib which would seem to be generic c++.

:info:build /opt/local/bin/clang++-mp-3.7 -headerpad_max_install_names -stdlib=libc++ -arch x86_64 -Xarch_x86_64 -mmacosx-version-min=10.6 -o OpenSCAD.app/Contents/MacOS/OpenSCAD objects/OffscreenContextCGL.o objects/CocoaUtils.o objects/PlatformUtils-mac.o objects/scintillaeditor.o objects/scadlexer.o objects/version_check.o objects/ProgressWidget.o objects/mathc99.o objects/linalg.o objects/Camera.o objects/handle_dep.o objects/value.o objects/expr.o objects/stackcheck.o objects/func.o objects/localscope.o objects/module.o objects/feature.o objects/node.o objects/context.o objects/modcontext.o objects/evalcontext.o objects/csgterm.o objects/csgtermnormalizer.o objects/Geometry.o objects/Polygon2d.o objects/clipper-utils.o objects/polyset-utils.o objects/GeometryUtils.o objects/polyset.o objects/csgops.o objects/transform.o objects/color.o objects/primitives.o objects/projection.o objects/cgaladv.o objects/surface.o objects/control.o objects/render.o objects/text.o objects/dxfdata.o objects/dxfdim.o objects/offset.o objects/linearextrude.o objects/rotateextrude.o objects/printutils.o objects/fileutils.o objects/progress.o objects/parsersettings.o objects/stl-utils.o objects/boost-utils.o objects/PlatformUtils.o objects/LibraryInfo.o objects/nodedumper.o objects/traverser.o objects/GeometryEvaluator.o objects/ModuleCache.o objects/GeometryCache.o objects/Tree.o objects/DrawingCallback.o objects/FreetypeRenderer.o objects/FontCache.o objects/settings.o objects/rendersettings.o objects/highlighter.o objects/Preferences.o objects/OpenCSGWarningDialog.o objects/editor.o objects/GLView.o objects/QGLView.o objects/AutoUpdater.o objects/grid.o objects/builtin.o objects/calc.o objects/export.o objects/export_png.o objects/import.o objects/renderer.o objects/colormap.o objects/ThrownTogetherRenderer.o objects/CSGTermEvaluator.o objects/svg.o objects/OffscreenView.o objects/fbo.o objects/system-gl.o objects/imageutils.o objects/lodepng.o objects/openscad.o objects/mainwin.o objects/UIUtils.o objects/Dock.o objects/FontListDialog.o objects/FontListTableView.o objects/launchingscreen.o objects/legacyeditor.o objects/LibraryInfoDialog.o objects/clipper.o objects/bucketalloc.o objects/dict.o objects/geom.o objects/mesh.o objects/priorityq.o objects/sweep.o objects/tess.o objects/imageutils-macosx.o objects/OpenCSGRenderer.o objects/cgalutils.o objects/cgalutils-tess.o objects/cgalutils-polyhedron.o objects/CGALCache.o objects/CGALRenderer.o objects/CGAL_Nef_polyhedron.o objects/cgalworker.o objects/Polygon2d-CGAL.o objects/AppleEvents.o objects/moc_scintillaeditor.o objects/moc_ProgressWidget.o objects/moc_QGLView.o objects/moc_MainWindow.o objects/moc_Preferences.o objects/moc_OpenCSGWarningDialog.o objects/moc_AboutDialog.o objects/moc_FontListDialog.o objects/moc_FontListTableView.o objects/moc_highlighter.o objects/moc_editor.o objects/moc_Dock.o objects/moc_AutoUpdater.o objects/moc_launchingscreen.o objects/moc_legacyeditor.o objects/moc_LibraryInfoDialog.o objects/moc_cgalworker.o objects/moc_EventFilter.o objects/qrc_openscad.o objects/parser_yacc.o objects/lexer_lex.o   -F/opt/local/libexec/qt4/Library/Frameworks -F/opt/local/libexec/qt4/lib -L/opt/local/lib -framework Cocoa -framework ApplicationServices -lCGAL -lmpfr -lgmp -lopencsg -lGLEW -lboost_thread-mt -lboost_program_options-mt -lboost_filesystem-mt -lboost_system-mt -lboost_regex-mt -L/opt/local/lib -lglib-2.0 -lintl -liconv -lharfbuzz -lfreetype -lfontconfig -L/opt/local/libexec/qt4/lib -lqscintilla2 -F/opt/local/libexec/qt4/Library/Frameworks -F/opt/local/libexec/qt4/lib -framework QtOpenGL -F/opt/local/Library/Frameworks -framework QtGui -framework QtCore -framework OpenGL -framework AGL 

comment:4 Changed 8 years ago by kenneth.f.cunningham@…

I notice upstream hasn't been able to compile a version for Snow Leopard since the 2013.06 version. <http://files.openscad.org/> so at least for SL, it may be a lost cause.

Last edited 8 years ago by kenneth.f.cunningham@… (previous) (diff)

comment:5 Changed 8 years ago by kenneth.f.cunningham@…

I did manage to get this current OpenSCAD version to compile successfully on 10.6.8 with <https://trac.macports.org/wiki/LibcxxOnOlderSystems> installed. Perhaps this fix might work for you as well. Hope this helps. Ken.

in the openscad Makefile, I added an objective C reference to libc++ like so:

QMAKE_COMP_QMAKE_OBJECTIVE_CFLAGS = -pipe \
		-stdlib=libc++ \
		-O2 \
             (etc)

I also had to add rebuild opencsg to make the link work on my system, adjusting the makefile by adding in a reference to libc++ as it was strangely built against the libstdc++ despite being freshly installed.

CXXFLAGS      = -pipe -std=c++11 -stdlib=libc++  (etc)

and 

LIBS          = $(SUBLIBS) -lc++ (etc)

I also changed the OpenSCAD deployment target to 10.6.

Last edited 8 years ago by kenneth.f.cunningham@… (previous) (diff)

comment:6 Changed 8 years ago by ken-cunningham-webuse

I realized these instructions were not 100% clear, so I redid this process tonight to install openscad on 10.6 with LibcxxOnOlderSystems installed. The libc++ upgrade is obviously required for this one. There are several steps, and I haven't yet managed to determine how to put all these in the portfiles, so these are manual steps.

The first problem is OpenCSG. By default, when you build it, it builds against libstdc++ despite having MacPorts set up for libc++. (It seems likely to me that this is the problem the OP had with the link described in the ticket, but I'm not 100% certain of that.) After building OpenCSG, you get

MacPro2010:lib admin$ ls -la
total 256
drwxr-xr-x  6 root  admin     204 Sep 27 20:40 .
drwxr-xr-x  4 root  admin     136 Sep 27 20:40 ..
-rwxr-xr-x  1 root  admin  100452 Sep 27 20:40 libopencsg.1.4.0.dylib
lrwxr-xr-x  1 root  admin      22 Sep 27 20:40 libopencsg.1.4.dylib -> libopencsg.1.4.0.dylib
lrwxr-xr-x  1 root  admin      22 Sep 27 20:40 libopencsg.1.dylib -> libopencsg.1.4.0.dylib
lrwxr-xr-x  1 root  admin      22 Sep 27 20:40 libopencsg.dylib -> libopencsg.1.4.0.dylib
$ otool -L libopencsg.1.4.0.dylib
libopencsg.1.4.0.dylib:
	/opt/local/lib/libopencsg.1.dylib (compatibility version 1.4.0, current version 1.4.0)
	/opt/local/lib/libGLEW.2.0.0.dylib (compatibility version 2.0.0, current version 2.0.0)
	/System/Library/Frameworks/OpenGL.framework/Versions/A/OpenGL (compatibility version 1.0.0, current version 1.0.0)
	/System/Library/Frameworks/AGL.framework/Versions/A/AGL (compatibility version 1.0.0, current version 1.0.0)
	/usr/lib/libstdc++.6.dylib (compatibility version 7.0.0, current version 7.9.0)
	/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 125.2.11)

so that is obviously a problem. sudo port clean opencsg, and sudo port configure opencsg it. Then go into the opencsg build directory, and edit src/Makefile. Change the settings of CXXFLAGS and LIBS to the following:

####### Compiler, tools and options

CC            = /opt/local/bin/clang-mp-3.7
CXX           = /opt/local/bin/clang++-mp-3.7
DEFINES       = 
CFLAGS        = -pipe -O2 -Wall -W -fPIC $(DEFINES)
CXXFLAGS      = -pipe -stdlib=libc++ -O2 -Wall -W -fPIC $(DEFINES)
INCPATH       = -I/opt/local/libexec/qt4/share/mkspecs/macx-g++ -I. -I../include -I.. -I/System/Library/Frameworks/OpenGL.framework/Versions/A/Headers -I/System/Library/Frameworks/AGL.framework/Headers
LINK          = /opt/local/bin/clang++-mp-3.7
LFLAGS        = -headerpad_max_install_names -single_module -dynamiclib -compatibility_version	1.4 -current_version	1.4.0 -install_name	/usr/local/lib/libopencsg.1.dylib
LIBS          = $(SUBLIBS) -stdlib=libc++  -lGLEW -framework OpenGL -framework AGL 
AR            = ar cq
RANLIB        = ranlib -s
QMAKE         = /opt/local/libexec/qt4/bin/qmake
TAR           = tar -cf
COMPRESS      = gzip -9f
COPY          = cp -f
SED           = sed
COPY_FILE     = cp -f
COPY_DIR      = cp -f -R
STRIP         = 
INSTALL_FILE  = $(COPY_FILE)
INSTALL_DIR   = $(COPY_DIR)
INSTALL_PROGRAM = $(COPY_FILE)
DEL_FILE      = rm -f
SYMLINK       = ln -f -s
DEL_DIR       = rmdir
MOVE          = mv -f
CHK_DIR_EXISTS= test -d
MKDIR         = mkdir -p
export MACOSX_DEPLOYMENT_TARGET = 10.6

=======================

Then, rebuild OpenCSG sudo port install opencsg, and you should get a properly linked library against libc++:

$ otool -L libopencsg.1.4.0.dylib
libopencsg.1.4.0.dylib:
	/opt/local/lib/libopencsg.1.dylib (compatibility version 1.4.0, current version 1.4.0)
	/opt/local/lib/libGLEW.2.0.0.dylib (compatibility version 2.0.0, current version 2.0.0)
	/System/Library/Frameworks/OpenGL.framework/Versions/A/OpenGL (compatibility version 1.0.0, current version 1.0.0)
	/System/Library/Frameworks/AGL.framework/Versions/A/AGL (compatibility version 1.0.0, current version 1.0.0)
	/usr/lib/libc++.1.dylib (compatibility version 1.0.0, current version 3.7.1)
	/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 125.2.11)
	/usr/lib/libc++abi.dylib (compatibility version 1.0.0, current version 3.7.0)

then sudo port configure openscad. It will bring in cgal:

--->  Building cgal
--->  Staging cgal into destroot
--->  Installing cgal @4.9_0
--->  Activating cgal @4.9_0

and then, if you try, it will fail to build openscad.

:info:build 2 warnings generated.
:info:build /opt/local/bin/clang++-mp-3.7 -headerpad_max_install_names -stdlib=libc++ -o OpenSCAD.app/Contents/MacOS/OpenSCAD objects/OffscreenContextCGL.o objects/CocoaUtils.o objects/PlatformUtils-mac.o objects/scintillaeditor.o objects/scadlexer.o objects/version_check.o objects/ProgressWidget.o objects/mathc99.o objects/linalg.o objects/Camera.o objects/handle_dep.o objects/value.o objects/expr.o objects/stackcheck.o objects/func.o objects/localscope.o objects/module.o objects/feature.o objects/node.o objects/context.o objects/modcontext.o objects/evalcontext.o objects/csgterm.o objects/csgtermnormalizer.o objects/Geometry.o objects/Polygon2d.o objects/clipper-utils.o objects/polyset-utils.o objects/GeometryUtils.o objects/polyset.o objects/csgops.o objects/transform.o objects/color.o objects/primitives.o objects/projection.o objects/cgaladv.o objects/surface.o objects/control.o objects/render.o objects/text.o objects/dxfdata.o objects/dxfdim.o objects/offset.o objects/linearextrude.o objects/rotateextrude.o objects/printutils.o objects/fileutils.o objects/progress.o objects/parsersettings.o objects/stl-utils.o objects/boost-utils.o objects/PlatformUtils.o objects/LibraryInfo.o objects/nodedumper.o objects/traverser.o objects/GeometryEvaluator.o objects/ModuleCache.o objects/GeometryCache.o objects/Tree.o objects/DrawingCallback.o objects/FreetypeRenderer.o objects/FontCache.o objects/settings.o objects/rendersettings.o objects/highlighter.o objects/Preferences.o objects/OpenCSGWarningDialog.o objects/editor.o objects/GLView.o objects/QGLView.o objects/AutoUpdater.o objects/grid.o objects/builtin.o objects/calc.o objects/export.o objects/export_png.o objects/import.o objects/renderer.o objects/colormap.o objects/ThrownTogetherRenderer.o objects/CSGTermEvaluator.o objects/svg.o objects/OffscreenView.o objects/fbo.o objects/system-gl.o objects/imageutils.o objects/lodepng.o objects/openscad.o objects/mainwin.o objects/UIUtils.o objects/Dock.o objects/FontListDialog.o objects/FontListTableView.o objects/launchingscreen.o objects/legacyeditor.o objects/LibraryInfoDialog.o objects/clipper.o objects/bucketalloc.o objects/dict.o objects/geom.o objects/mesh.o objects/priorityq.o objects/sweep.o objects/tess.o objects/imageutils-macosx.o objects/OpenCSGRenderer.o objects/cgalutils.o objects/cgalutils-tess.o objects/cgalutils-polyhedron.o objects/CGALCache.o objects/CGALRenderer.o objects/CGAL_Nef_polyhedron.o objects/cgalworker.o objects/Polygon2d-CGAL.o objects/AppleEvents.o objects/moc_scintillaeditor.o objects/moc_ProgressWidget.o objects/moc_QGLView.o objects/moc_MainWindow.o objects/moc_Preferences.o objects/moc_OpenCSGWarningDialog.o objects/moc_AboutDialog.o objects/moc_FontListDialog.o objects/moc_FontListTableView.o objects/moc_highlighter.o objects/moc_editor.o objects/moc_Dock.o objects/moc_AutoUpdater.o objects/moc_launchingscreen.o objects/moc_legacyeditor.o objects/moc_LibraryInfoDialog.o objects/moc_cgalworker.o objects/moc_EventFilter.o objects/qrc_openscad.o objects/parser_yacc.o objects/lexer_lex.o   -F/opt/local/libexec/qt4/Library/Frameworks -F/opt/local/libexec/qt4/lib -L/opt/local/lib -framework Cocoa -framework ApplicationServices -lCGAL -lmpfr -lgmp -lopencsg -lGLEW -lboost_thread-mt -lboost_program_options-mt -lboost_filesystem-mt -lboost_system-mt -lboost_regex-mt -L/opt/local/lib -lglib-2.0 -lintl -liconv -lharfbuzz -lfreetype -lfontconfig -L/opt/local/libexec/qt4/lib -lqscintilla2 -F/opt/local/libexec/qt4/Library/Frameworks -F/opt/local/libexec/qt4/lib -framework QtOpenGL -F/opt/local/Library/Frameworks -framework QtGui -framework QtCore -framework OpenGL -framework AGL 
:info:build Undefined symbols for architecture x86_64:
:info:build   "save_framebuffer(OffscreenContext*, std::__1::basic_ostream<char, std::__1::char_traits<char> >&)", referenced from:
:info:build       OffscreenView::save(std::__1::basic_ostream<char, std::__1::char_traits<char> >&) in OffscreenView.o
:info:build   "write_png(std::ostream&, unsigned char*, int, int)", referenced from:
:info:build       save_framebuffer(OffscreenContext*, std::ostream&) in OffscreenContextCGL.o
:info:build       save_framebuffer_common(OffscreenContext*, std::ostream&) in OffscreenContextCGL.o
:info:build   "CocoaUtils::nslog(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, void*)", referenced from:
:info:build       _main in openscad.o
:info:build   "std::__basic_file<char>::is_open() const", referenced from:
:info:build       save_framebuffer(OffscreenContext*, char const*) in OffscreenContextCGL.o
:info:build   "std::basic_stringbuf<char, std::char_traits<char>, std::allocator<char> >::str() const", referenced from:
:info:build       offscreen_context_getinfo(OffscreenContext*) in OffscreenContextCGL.o
:info:build   "std::locale::id::_M_id() const", referenced from:
:info:build       boost::detail::lcast_put_unsigned<std::char_traits<char>, unsigned int, char>::convert() in PlatformUtils-mac.o
:info:build   "std::locale::operator==(std::locale const&) const", referenced from:
:info:build       boost::detail::lcast_put_unsigned<std::char_traits<char>, unsigned int, char>::convert() in PlatformUtils-mac.o

if you get that far, go into the openscad build directory, and sudo make clean to clean out the wrongly built binaries.

edit the Makefile in the openscad build directory. Then you need to change three things, the deployment target, the CXX flags, and the OBJECTIVE_CXXFLAGS, like so:

export MACOSX_DEPLOYMENT_TARGET = 10.6

change to this:
CXXFLAGS      = -pipe -std=c++11 -stdlib=libc++ -fno-strict-aliasing -frounding-math -I/opt/local/include/glib-2.0 -I/opt/local/lib/glib-2.0/include -I/opt/local/include -I/opt/local/include/harfbuzz -I/opt/local/include/freetype2 -I/opt/local/include/fontconfig -O2 $(DEFINES)


and

change to this:
####### Custom Compiler Variables
QMAKE_COMP_QMAKE_OBJECTIVE_CXXFLAGS = -pipe \
		-stdlib=libc++ \
		-O2 \
		\
		-W

then sudo port build openscad, and the build proceeds through to completion.

--->  Computing dependencies for openscad
--->  Building openscad
--->  Staging openscad into destroot
--->  Installing openscad @2015.03-3_0
--->  Activating openscad @2015.03-3_0
--->  Cleaning openscad
--->  Updating database of binaries
--->  Scanning binaries for linking errors               
--->  No broken files found.
  openscad @2015.03-3_0 (active) platform='darwin 10' archs='x86_64'

You are now the proud owner of software that does not exist in the wild.

Now to figure out (if I can) how to Portfile these changes.

[update - it's probably better to delete the hard-coded MACOSX_DEPLOYMENT_TARGET completely...]

Last edited 8 years ago by ken-cunningham-webuse (previous) (diff)

comment:7 Changed 8 years ago by ken-cunningham-webuse

OK. To fix OpenCSG, I just bulldozed it in by adding this to the Portfile:

post-configure {
    if {${configure.cxx_stdlib} eq "libc++"} {
		reinplace "s|CXXFLAGS      = -pipe|CXXFLAGS      = -pipe -std=c++11 -stdlib=libc++ |g" ${worksrcpath}/src/Makefile
		reinplace "s|-lGLEW|-lGLEW -stdlib=libc++ |g" ${worksrcpath}/src/Makefile
    }
}

Although this works - on 10.6 with LibCxx at least - I have a feeling it is not the most elegant method of accomplishing this process. But, it gets `er done.

Last edited 8 years ago by ken-cunningham-webuse (previous) (diff)

comment:8 Changed 8 years ago by ken-cunningham-webuse

and likewise in openscad, changing the reinplace block to this in the portfile works on 10.6, and maybe other systems with a proper os.major guard added...

post-configure {
    # remove useless/harmful warning flags. g++-4.2 will not accept -Wno-unused-local-typedefs
    reinplace -W ${worksrcpath} "s|\-W\[^ \]* ||g" Makefile

    if {${configure.cxx_stdlib} eq "libc++"} {
	reinplace "s|CXXFLAGS      = -pipe|CXXFLAGS      = -pipe -std=c++11 -stdlib=libc++ |g" ${worksrcpath}/Makefile
	reinplace "s|QMAKE_COMP_QMAKE_OBJECTIVE_CXXFLAGS = -pipe|QMAKE_COMP_QMAKE_OBJECTIVE_CXXFLAGS = -pipe -std=c++11 -stdlib=libc++ |g" ${worksrcpath}/Makefile
	reinplace "s|export MACOSX_DEPLOYMENT_TARGET = 10.7||g" ${worksrcpath}/Makefile
    }
}

I'll leave this information here for posterity, in case anyone else comes along that can make use of this.

Last edited 8 years ago by ken-cunningham-webuse (previous) (diff)

comment:9 Changed 8 years ago by dstrubbe (David Strubbe)

Hopefully the patch to the Qmake port group in r153331 has resolved some of these issues.

comment:10 Changed 8 years ago by michaelld (Michael Dickens)

In 4738dad7/macports-ports:

OpenSCAD: fix build when using libc++, removing minimum OS constraint to allow for Mac OS older than 10.7 when bootstrapping libc++; fix library name of qscintilla for update in 2.10.0 release. Addresses tickets #51840 and #53623 .

comment:11 Changed 8 years ago by michaelld (Michael Dickens)

Resolution: fixed
Status: newclosed

This issue should be fixed now. Turns out that the "proper" fix was just to include "QMAKE_OBJECTIVE_CXXFLAGS = -stdlib=libc++" when using libc++. The change I just pushed should allow for building on -any- libc++ MacPorts install, which should make Ken happy. I also integrated the -W* removal into the patch instead of doing post-configure. Please test! I'm going to close this as fixed; please reopen if this specific issue is not fixed for you & add your new logfile.

Note: See TracTickets for help on using tickets.