I was building NIX, from source using from the github repo.
Everything went according to the instructions, but in the end it failed on make.
The Error what I got is
caffeinated:nix sudoankit$ make all
[ 1%] Linking CXX shared library libnix.dylib
Undefined symbols for architecture x86_64:
"YAML::detail::node_data::set_scalar(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)", referenced from:
YAML::detail::node_ref::set_scalar(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) in AttributesFS.cpp.o
YAML::detail::node_ref::set_scalar(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) in DataArrayFS.cpp.o
YAML::detail::node_ref::set_scalar(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) in DimensionFS.cpp.o
YAML::detail::node_ref::set_scalar(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) in Directory.cpp.o
YAML::detail::node_ref::set_scalar(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) in DirectoryWithAttributes.cpp.o
YAML::detail::node_ref::set_scalar(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) in EntityFS.cpp.o
YAML::detail::node_ref::set_scalar(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) in FeatureFS.cpp.o
...
"YAML::LoadFile(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)", referenced from:
nix::file::AttributesFS::open_or_create() in AttributesFS.cpp.o
"YAML::operator<<(std::basic_ostream<char, std::char_traits<char> >&, YAML::Node const&)", referenced from:
nix::file::AttributesFS::flush() in AttributesFS.cpp.o
"boost::re_detail_106000::perl_matcher<__gnu_cxx::__normal_iterator<char const*, std::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<boost::sub_match<__gnu_cxx::__normal_iterator<char const*, std::basic_string<char, std::char_traits<char>, std::allocator<char> > > > >, boost::regex_traits<char, boost::cpp_regex_traits<char> > >::construct_init(boost::basic_regex<char, boost::regex_traits<char, boost::cpp_regex_traits<char> > > const&, boost::regex_constants::_match_flags)", referenced from:
boost::re_detail_106000::perl_matcher<__gnu_cxx::__normal_iterator<char const*, std::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<boost::sub_match<__gnu_cxx::__normal_iterator<char const*, std::basic_string<char, std::char_traits<char>, std::allocator<char> > > > >, boost::regex_traits<char, boost::cpp_regex_traits<char> > >::perl_matcher(__gnu_cxx::__normal_iterator<char const*, std::basic_string<char, std::char_traits<char>, std::allocator<char> > >, __gnu_cxx::__normal_iterator<char const*, std::basic_string<char, std::char_traits<char>, std::allocator<char> > >, boost::match_results<__gnu_cxx::__normal_iterator<char const*, std::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<boost::sub_match<__gnu_cxx::__normal_iterator<char const*, std::basic_string<char, std::char_traits<char>, std::allocator<char> > > > > >&, boost::basic_regex<char, boost::regex_traits<char, boost::cpp_regex_traits<char> > > const&, boost::regex_constants::_match_flags, __gnu_cxx::__normal_iterator<char const*, std::basic_string<char, std::char_traits<char>, std::allocator<char> > >) in util.cpp.o
"boost::re_detail_106000::perl_matcher<__gnu_cxx::__normal_iterator<char const*, std::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<boost::sub_match<__gnu_cxx::__normal_iterator<char const*, std::basic_string<char, std::char_traits<char>, std::allocator<char> > > > >, boost::regex_traits<char, boost::cpp_regex_traits<char> > >::find()", referenced from:
bool boost::regex_search<__gnu_cxx::__normal_iterator<char const*, std::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<boost::sub_match<__gnu_cxx::__normal_iterator<char const*, std::basic_string<char, std::char_traits<char>, std::allocator<char> > > > >, char, boost::regex_traits<char, boost::cpp_regex_traits<char> > >(__gnu_cxx::__normal_iterator<char const*, std::basic_string<char, std::char_traits<char>, std::allocator<char> > >, __gnu_cxx::__normal_iterator<char const*, std::basic_string<char, std::char_traits<char>, std::allocator<char> > >, boost::match_results<__gnu_cxx::__normal_iterator<char const*, std::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<boost::sub_match<__gnu_cxx::__normal_iterator<char const*, std::basic_string<char, std::char_traits<char>, std::allocator<char> > > > > >&, boost::basic_regex<char, boost::regex_traits<char, boost::cpp_regex_traits<char> > > const&, boost::regex_constants::_match_flags, __gnu_cxx::__normal_iterator<char const*, std::basic_string<char, std::char_traits<char>, std::allocator<char> > >) in util.cpp.o
"boost::re_detail_106000::perl_matcher<__gnu_cxx::__normal_iterator<char const*, std::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<boost::sub_match<__gnu_cxx::__normal_iterator<char const*, std::basic_string<char, std::char_traits<char>, std::allocator<char> > > > >, boost::regex_traits<char, boost::cpp_regex_traits<char> > >::match()", referenced from:
bool boost::regex_match<__gnu_cxx::__normal_iterator<char const*, std::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<boost::sub_match<__gnu_cxx::__normal_iterator<char const*, std::basic_string<char, std::char_traits<char>, std::allocator<char> > > > >, char, boost::regex_traits<char, boost::cpp_regex_traits<char> > >(__gnu_cxx::__normal_iterator<char const*, std::basic_string<char, std::char_traits<char>, std::allocator<char> > >, __gnu_cxx::__normal_iterator<char const*, std::basic_string<char, std::char_traits<char>, std::allocator<char> > >, boost::match_results<__gnu_cxx::__normal_iterator<char const*, std::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<boost::sub_match<__gnu_cxx::__normal_iterator<char const*, std::basic_string<char, std::char_traits<char>, std::allocator<char> > > > > >&, boost::basic_regex<char, boost::regex_traits<char, boost::cpp_regex_traits<char> > > const&, boost::regex_constants::_match_flags) in util.cpp.o
ld: symbol(s) not found for architecture x86_64
collect2: error: ld returned 1 exit status
make[2]: *** [libnix.1.1.0.dylib] Error 1
make[1]: *** [CMakeFiles/nix.dir/all] Error 2
make: *** [all] Error 2
caffeinated:nix sudoankit$
How should I proceed in building it now?
The C++ library dependencies (i.e. Boost/Yaml) you have installed via Homebrew were compiled with clang++. The result is: some symbols resulting from STL interactions when compiling with GCC are missing.
Thus, you have to compile with clang++, e.g. like this:
$ mkdir build
$ CXX=clang++ CC=clang cmake -DCMAKE_BUILD_TYP=Release ..
$ make
Looking at the git repository, the authors even have Mac OS X enabled in their Travis CI configuration:
os:
- linux
- osx
But they also have explicitly excluded GCC builds on Mac OS X:
matrix:
exclude:
- os: osx
compiler: gcc
Related
I'm trying to use boost::regex_search in my application. Compiling with g++ 8.3 version gives me a symbol referencing error as below
boost::re_detail_106600::perl_matcher<__gnu_cxx::__normal_iterator<char const*, std::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<boost::sub_match<__gnu_cxx::__normal_iterator<char const*, std::basic_string<char, std::char_traits<char>, std::allocator<char> > > > >, boost::regex_traits<char, boost::cpp_regex_traits<char> > >::construct_init(boost::basic_regex<char, boost::regex_traits<char, boost::cpp_regex_traits<char> > > const&, boost::regex_constants::_match_flags)
std::string url = "A4B3CD";
boost::regex exp("4");
boost::smatch match;
if (boost::regex_search(url, match, exp))
P.S :: When the same is compiled with g++ 8.5 it works fine.
Machine details : Red Hat Enterprise Linux release 8.6
Today I experimented with GCC/G++ :(
I was not sure which c++ standards were installed (completely new to c++), so I updated gcc to the latest version with brew (brew install gcc --HEAD) but now it seems that the latest version is unfortunately unstable for my setup.
clang version before: Apple clang version 12.0.0 (clang-1200.0.32.27)
clang version after: Apple clang version 12.0.0 (clang-1200.0.32.27) but with following error:
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
OS: macOS#11.0.1
Does anyone knows how to solve this? I am still able to use g++, only gcc is not working at all, no matter of -std= flag or not. Is installing the latest stable version a proper solution or will this make it worse ;-) ?
gcc helloworld.cc -v -o out
Apple clang version 12.0.0 (clang-1200.0.32.27)
Target: x86_64-apple-darwin20.1.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin
ignoring nonexistent directory "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1"
"/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang" -cc1 -triple x86_64-apple-macosx11.0.0 -Wdeprecated-objc-isa-usage -Werror=deprecated-objc-isa-usage -Werror=implicit-function-declaration -emit-obj -mrelax-all -disable-free -disable-llvm-verifier -discard-value-names -main-file-name helloworld.cc -mrelocation-model pic -pic-level 2 -mthread-model posix -mframe-pointer=all -fno-strict-return -masm-verbose -munwind-tables -target-sdk-version=11.0 -target-cpu penryn -dwarf-column-info -debugger-tuning=lldb -target-linker-version 609.6 -v -resource-dir /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/12.0.0 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk -I/usr/local/include -stdlib=libc++ -internal-isystem /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1 -internal-isystem /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/local/include -internal-isystem /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/12.0.0/include -internal-externc-isystem /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include -internal-externc-isystem /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include -Wno-reorder-init-list -Wno-implicit-int-float-conversion -Wno-c99-designator -Wno-final-dtor-non-final-class -Wno-extra-semi-stmt -Wno-misleading-indentation -Wno-quoted-include-in-framework-header -Wno-implicit-fallthrough -Wno-enum-enum-conversion -Wno-enum-float-conversion -fdeprecated-macro -fdebug-compilation-dir "/Users/user/x/y/z/zz/zzz" -ferror-limit 19 -fmessage-length 167 -stack-protector 1 -fstack-check -mdarwin-stkchk-strong-link -fblocks -fencode-extended-block-signature -fregister-global-dtors-with-atexit -fgnuc-version=4.2.1 -fobjc-runtime=macosx-11.0.0 -fcxx-exceptions -fexceptions -fmax-type-align=16 -fdiagnostics-show-option -fcolor-diagnostics -o /var/folders/rq/6cbshbgd2bdbpl3tqf7cg27c0000gn/T/helloworld-3e60f0.o -x c++ helloworld.cc
clang -cc1 version 12.0.0 (clang-1200.0.32.27) default target x86_64-apple-darwin20.1.0
ignoring nonexistent directory "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/local/include"
ignoring nonexistent directory "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/Library/Frameworks"
#include "..." search starts here:
#include <...> search starts here:
/usr/local/include
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/12.0.0/include
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks (framework directory)
End of search list.
"/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld" -demangle -lto_library /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/libLTO.dylib -no_deduplicate -dynamic -arch x86_64 -platform_version macos 11.0.0 11.0 -syslibroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk -o out -L/usr/local/lib /var/folders/rq/6cbshbgd2bdbpl3tqf7cg27c0000gn/T/helloworld-3e60f0.o -lSystem /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/12.0.0/lib/darwin/libclang_rt.osx.a
Undefined symbols for architecture x86_64:
"std::__1::locale::use_facet(std::__1::locale::id&) const", referenced from:
std::__1::ctype<char> const& std::__1::use_facet<std::__1::ctype<char> >(std::__1::locale const&) in helloworld-3e60f0.o
"std::__1::ios_base::getloc() const", referenced from:
std::__1::basic_ios<char, std::__1::char_traits<char> >::widen(char) const in helloworld-3e60f0.o
"std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::__init(unsigned long, char)", referenced from:
std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::basic_string(unsigned long, char) in helloworld-3e60f0.o
"std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::~basic_string()", referenced from:
std::__1::ostreambuf_iterator<char, std::__1::char_traits<char> > std::__1::__pad_and_output<char, std::__1::char_traits<char> >(std::__1::ostreambuf_iterator<char, std::__1::char_traits<char> >, char const*, char const*, char const*, std::__1::ios_base&, char) in helloworld-3e60f0.o
"std::__1::basic_ostream<char, std::__1::char_traits<char> >::put(char)", referenced from:
std::__1::basic_ostream<char, std::__1::char_traits<char> >& std::__1::endl<char, std::__1::char_traits<char> >(std::__1::basic_ostream<char, std::__1::char_traits<char> >&) in helloworld-3e60f0.o
"std::__1::basic_ostream<char, std::__1::char_traits<char> >::flush()", referenced from:
std::__1::basic_ostream<char, std::__1::char_traits<char> >& std::__1::endl<char, std::__1::char_traits<char> >(std::__1::basic_ostream<char, std::__1::char_traits<char> >&) in helloworld-3e60f0.o
"std::__1::basic_ostream<char, std::__1::char_traits<char> >::sentry::sentry(std::__1::basic_ostream<char, std::__1::char_traits<char> >&)", referenced from:
std::__1::basic_ostream<char, std::__1::char_traits<char> >& std::__1::__put_character_sequence<char, std::__1::char_traits<char> >(std::__1::basic_ostream<char, std::__1::char_traits<char> >&, char const*, unsigned long) in helloworld-3e60f0.o
"std::__1::basic_ostream<char, std::__1::char_traits<char> >::sentry::~sentry()", referenced from:
std::__1::basic_ostream<char, std::__1::char_traits<char> >& std::__1::__put_character_sequence<char, std::__1::char_traits<char> >(std::__1::basic_ostream<char, std::__1::char_traits<char> >&, char const*, unsigned long) in helloworld-3e60f0.o
"std::__1::cout", referenced from:
_main in helloworld-3e60f0.o
"std::__1::ctype<char>::id", referenced from:
std::__1::ctype<char> const& std::__1::use_facet<std::__1::ctype<char> >(std::__1::locale const&) in helloworld-3e60f0.o
"std::__1::locale::~locale()", referenced from:
std::__1::basic_ios<char, std::__1::char_traits<char> >::widen(char) const in helloworld-3e60f0.o
"std::__1::ios_base::__set_badbit_and_consider_rethrow()", referenced from:
std::__1::basic_ostream<char, std::__1::char_traits<char> >& std::__1::__put_character_sequence<char, std::__1::char_traits<char> >(std::__1::basic_ostream<char, std::__1::char_traits<char> >&, char const*, unsigned long) in helloworld-3e60f0.o
"std::__1::ios_base::clear(unsigned int)", referenced from:
std::__1::ios_base::setstate(unsigned int) in helloworld-3e60f0.o
"std::terminate()", referenced from:
___clang_call_terminate in helloworld-3e60f0.o
"___cxa_begin_catch", referenced from:
std::__1::basic_ostream<char, std::__1::char_traits<char> >& std::__1::__put_character_sequence<char, std::__1::char_traits<char> >(std::__1::basic_ostream<char, std::__1::char_traits<char> >&, char const*, unsigned long) in helloworld-3e60f0.o
___clang_call_terminate in helloworld-3e60f0.o
"___cxa_call_unexpected", referenced from:
std::__1::ostreambuf_iterator<char, std::__1::char_traits<char> >::ostreambuf_iterator(std::__1::basic_ostream<char, std::__1::char_traits<char> >&) in helloworld-3e60f0.o
"___cxa_end_catch", referenced from:
std::__1::basic_ostream<char, std::__1::char_traits<char> >& std::__1::__put_character_sequence<char, std::__1::char_traits<char> >(std::__1::basic_ostream<char, std::__1::char_traits<char> >&, char const*, unsigned long) in helloworld-3e60f0.o
"___gxx_personality_v0", referenced from:
std::__1::basic_ostream<char, std::__1::char_traits<char> >& std::__1::__put_character_sequence<char, std::__1::char_traits<char> >(std::__1::basic_ostream<char, std::__1::char_traits<char> >&, char const*, unsigned long) in helloworld-3e60f0.o
std::__1::ostreambuf_iterator<char, std::__1::char_traits<char> > std::__1::__pad_and_output<char, std::__1::char_traits<char> >(std::__1::ostreambuf_iterator<char, std::__1::char_traits<char> >, char const*, char const*, char const*, std::__1::ios_base&, char) in helloworld-3e60f0.o
std::__1::ostreambuf_iterator<char, std::__1::char_traits<char> >::ostreambuf_iterator(std::__1::basic_ostream<char, std::__1::char_traits<char> >&) in helloworld-3e60f0.o
std::__1::basic_ios<char, std::__1::char_traits<char> >::widen(char) const in helloworld-3e60f0.o
Dwarf Exception Unwind Info (__eh_frame) in helloworld-3e60f0.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
You cannot compile C++ code with gcc or clang. You need to use a C++ compiler, such as clang++ or g++.
Check what you are actually running. If you use gcc file.c, at least run:
type gcc
to se what you are running. If it's /bin/something or /usr/bin/something or /Applications/something, it's from Apple. If it's /usr/local/something it's homebrew.
If you are using homebrew, firstly check you are doing everything right by running:
brew doctor
And secondly, make sure your PATH starts with /usr/local/bin which is where homebrew puts its binaries:
export PATH=/usr/local/bin:$PATH
I'm trying to install openscad, I have install all dependencies but when i'm trying to make openscad i've got this problem:
$ make
clang++ -headerpad_max_install_names -stdlib=libc++ -mmacosx-version-min=10.7 -stdlib=libc++ -arch x86_64 -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/csgnode.o objects/CSGTreeNormalizer.o objects/CSGTreeEvaluator.o objects/Geometry.o objects/Polygon2d.o objects/clipper-utils.o objects/polyset-utils.o objects/GeometryUtils.o objects/polyset.o objects/polyset-gl.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_stl.o objects/export_amf.o objects/export_off.o objects/export_dxf.o objects/export_svg.o objects/export_nef.o objects/export_png.o objects/import.o objects/renderer.o objects/colormap.o objects/ThrownTogetherRenderer.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-applyops.o objects/cgalutils-project.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/usr/local/Cellar/qt/4.8.7_2/lib -L/opt/local/lib -L/usr/local/Cellar/qt/4.8.7_2/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/usr/local/Cellar/glib/2.46.2/lib -L/usr/local/opt/gettext/lib -lglib-2.0 -lintl -liconv -L/usr/local/lib -lharfbuzz -L/usr/local/Cellar/freetype/2.6_1/lib -L/usr/local/Cellar/fontconfig/2.11.1/lib -lfontconfig -lfreetype -L/usr/local/Cellar/qt/4.8.7_2/lib -lqscintilla2 -framework QtOpenGL -L/usr/local/opt/openssl/lib -F/usr/local/Cellar/qt/4.8.7_2/lib -framework QtGui -framework QtCore -framework OpenGL -framework AGL
ld: warning: object file (objects/OffscreenContextCGL.o) was built for newer OSX version (10.10) than being linked (10.7)
ld: warning: object file (objects/CocoaUtils.o) was built for newer OSX version (10.10) than being linked (10.7)
ld: warning: object file (objects/PlatformUtils-mac.o) was built for newer OSX version (10.10) than being linked (10.7)
Undefined symbols for architecture x86_64:
"boost::re_detail_106000::get_mem_block()", referenced from:
boost::re_detail_106000::perl_matcher, std::__1::allocator > >, boost::regex_traits > >::find_imp() in Tree.o
boost::re_detail_106000::perl_matcher, std::__1::allocator > >, boost::regex_traits > >::match_all_states() in Tree.o
boost::re_detail_106000::perl_matcher, std::__1::allocator > >, boost::regex_traits > >::match_startmark() in Tree.o
boost::re_detail_106000::perl_matcher, std::__1::allocator > >, boost::regex_traits > >::match_alt() in Tree.o
boost::re_detail_106000::perl_matcher, std::__1::allocator > >, boost::regex_traits > >::match_rep() in Tree.o
boost::re_detail_106000::perl_matcher, std::__1::allocator > >, boost::regex_traits > >::match_char_repeat() in Tree.o
boost::re_detail_106000::perl_matcher, std::__1::allocator > >, boost::regex_traits > >::match_set_repeat() in Tree.o
...
"boost::re_detail_106000::put_mem_block(void*)", referenced from:
boost::re_detail_106000::perl_matcher, std::__1::allocator > >, boost::regex_traits > >::find_imp() in Tree.o
boost::re_detail_106000::perl_matcher, std::__1::allocator > >, boost::regex_traits > >::unwind_extra_block(bool) in Tree.o
boost::re_detail_106000::perl_matcher, std::__1::allocator > >, boost::regex_traits > >::find_imp() in import.o
boost::re_detail_106000::perl_matcher, std::__1::allocator > >, boost::regex_traits > >::unwind_extra_block(bool) in import.o
"boost::re_detail_106000::verify_options(unsigned int, boost::regex_constants::_match_flags)", referenced from:
boost::re_detail_106000::perl_matcher, std::__1::allocator > >, boost::regex_traits > >::find_imp() in Tree.o
boost::re_detail_106000::perl_matcher, std::__1::allocator > >, boost::regex_traits > >::find_imp() in import.o
"boost::re_detail_106000::raise_runtime_error(std::runtime_error const&)", referenced from:
void boost::re_detail_106000::raise_error > > >(boost::regex_traits_wrapper > > const&, boost::regex_constants::error_type) in Tree.o
void boost::re_detail_106000::raise_error > > >(boost::regex_traits_wrapper > > const&, boost::regex_constants::error_type) in import.o
"boost::re_detail_106000::get_default_error_string(boost::regex_constants::error_type)", referenced from:
boost::re_detail_106000::cpp_regex_traits_implementation::error_string(boost::regex_constants::error_type) const in Tree.o
boost::re_detail_106000::cpp_regex_traits_implementation::error_string(boost::regex_constants::error_type) const in import.o
"boost::re_detail_106000::cpp_regex_traits_implementation::transform_primary(char const*, char const*) const", referenced from:
std::__1::__wrap_iter boost::re_detail_106000::re_is_set_member, char, boost::regex_traits >, unsigned int>(std::__1::__wrap_iter, std::__1::__wrap_iter, boost::re_detail_106000::re_set_long const*, boost::re_detail_106000::regex_data > > const&, bool) in Tree.o
std::__1::__wrap_iter boost::re_detail_106000::re_is_set_member, char, boost::regex_traits >, unsigned int>(std::__1::__wrap_iter, std::__1::__wrap_iter, boost::re_detail_106000::re_set_long const*, boost::re_detail_106000::regex_data > > const&, bool) in import.o
"boost::re_detail_106000::cpp_regex_traits_implementation::transform(char const*, char const*) const", referenced from:
std::__1::__wrap_iter boost::re_detail_106000::re_is_set_member, char, boost::regex_traits >, unsigned int>(std::__1::__wrap_iter, std::__1::__wrap_iter, boost::re_detail_106000::re_set_long const*, boost::re_detail_106000::regex_data > > const&, bool) in Tree.o
std::__1::__wrap_iter boost::re_detail_106000::re_is_set_member, char, boost::regex_traits >, unsigned int>(std::__1::__wrap_iter, std::__1::__wrap_iter, boost::re_detail_106000::re_set_long const*, boost::re_detail_106000::regex_data > > const&, bool) in import.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [OpenSCAD.app/Contents/MacOS/OpenSCAD] Error 1
Looking at the linker flags, it looks like you might have two different version of Boost installed. Mixing packages from different package managing frameworks makes such issues hard to track down. It could of course be a case of just needing "make clean", but hard to see from only the linker line.
I would recommend using the official build instructions to manage dependencies - those are pretty well maintained on OS X: https://github.com/openscad/openscad#building-for-mac-os-x
I'm trying to build cmake 3.1.3 using clang and its own c++ library, i.e:
export CC=clang
export CXX=clang++
export CXXFLAGS="-std=c++11 -stdlib=libc++"
export LDFLAGS="-lc++ -lc++abi"
followed by
./bootstrap
However, this does not work due to the way the bootstrap script tests the CXX compiler. If I hack the bootstrap file and add the LDFLAGS to the CXX test I can start to compile cmake. However, once I reach the bootstrap stage, the compile cmake binary is broken. What am I doing wrong?
Using Angew's idea and trying to compile with the existing cmake installation actually gets you a bit farther: If you use almost the same exports as above:
export CC=clang
export CXX=clang++
export CXXFLAGS="-std=c++11 -stdlib=libc++"
export LDFLAGS="-L${COMPILERROOT}/lib -lc++ -lc++abi"
and a little sed to get around a weird compilation error (assuming you are in a different build directory and you extracted the cmake sources to the directory ../cmake from the current one)
sed -i s/kwsys_ios::hex/cmsys_ios::istringstream::hex/g ../cmake/Source/kwsys/SystemInformation.cxx
sed -i s/kwsys_ios::dec/cmsys_ios::istringstream::dec/g ../cmake/Source/kwsys/SystemInformation.cxx
You can then compile cmake via:
cmake ../cmake/ -DCMAKE_INSTALL_PREFIX=${INSTALLDIR}
make -j${NPROC}
make install
It still crashed for example if I try to cmake a Cern ROOT6 install:
This warning is for project developers. Use -Wno-dev to suppress it.
uncaught_exception not yet implemented
Program received signal SIGABRT, Aborted.
0x00007ffff6e495e9 in raise () from /lib64/libc.so.6
(gdb) bt
#0 0x00007ffff6e495e9 in raise () from /lib64/libc.so.6
#1 0x00007ffff6e4acf8 in abort () from /lib64/libc.so.6
#2 0x00007ffff7b755a5 in std::uncaught_exception() () from /home/balzer/middleware/software/clang/3.6.0/lib/libc++.so.1
#3 0x00007ffff7ba80fd in std::__1::basic_ostream<char, std::__1::char_traits<char> >::sentry::~sentry() () from /home/balzer/middleware/software/clang/3.6.0/lib/libc++.so.1
#4 0x0000000000531561 in std::__1::basic_ostream<char, std::__1::char_traits<char> >& std::__1::__put_character_sequence<char, std::__1::char_traits<char> >(std::__1::basic_ostream<char, std::__1::char_traits<char> >&, char const*, unsigned long) ()
#5 0x0000000000530c8c in std::__1::basic_ostream<char, std::__1::char_traits<char> >& std::__1::operator<< <std::__1::char_traits<char> >(std::__1::basic_ostream<char, std::__1::char_traits<char> >&, char const*) ()
#6 0x000000000052fccb in cmakemainMessageCallback(char const*, char const*, bool&, void*) ()
#7 0x00000000007527c9 in cmSystemTools::Message(char const*, char const*) ()
#8 0x000000000085c934 in cmake::IssueMessage(cmake::MessageType, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, cmListFileBacktrace const&) ()
#9 0x000000000062a756 in cmMakefile::IssueMessage(cmake::MessageType, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) const ()
#10 0x00000000009c56cb in cmConditionEvaluator::GetDefinitionIfUnquoted(cmExpandedCommandArgument const&) const ()
#11 0x00000000009c57fd in cmConditionEvaluator::GetVariableOrString(cmExpandedCommandArgument const&) const ()
#12 0x00000000009c0600 in cmConditionEvaluator::HandleLevel2(std::__1::list<cmExpandedCommandArgument, std::__1::allocator<cmExpandedCommandArgument> >&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >&, cmake::MessageType&) ()
#13 0x00000000009bce3b in cmConditionEvaluator::IsTrue(std::__1::vector<cmExpandedCommandArgument, std::__1::allocator<cmExpandedCommandArgument> > const&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >&, cmake::MessageType&) ()
#14 0x00000000009bdd5e in cmConditionEvaluator::HandleLevel0(std::__1::list<cmExpandedCommandArgument, std::__1::allocator<cmExpandedCommandArgument> >&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >&, cmake::MessageType&) ()
#15 0x00000000009bcd91 in cmConditionEvaluator::IsTrue(std::__1::vector<cmExpandedCommandArgument, std::__1::allocator<cmExpandedCommandArgument> > const&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >&, cmake::MessageType&) ()
#16 0x00000000009d902b in cmIfCommand::InvokeInitialPass(std::__1::vector<cmListFileArgument, std::__1::allocator<cmListFileArgument> > const&, cmExecutionStatus&) ()
#17 0x000000000062b4d6 in cmMakefile::ExecuteCommand(cmListFileFunction const&, cmExecutionStatus&) ()
#18 0x000000000098ffb1 in cmForEachFunctionBlocker::IsFunctionBlocked(cmListFileFunction const&, cmMakefile&, cmExecutionStatus&) ()
#19 0x000000000062c5cb in cmMakefile::IsFunctionBlocked(cmListFileFunction const&, cmExecutionStatus&) ()
#20 0x000000000062b21c in cmMakefile::ExecuteCommand(cmListFileFunction const&, cmExecutionStatus&) ()
#21 0x0000000000630242 in cmMakefile::ReadListFile(char const*, char const*, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >*, bool) ()
#22 0x00000000005cbad4 in cmLocalGenerator::ReadInputFile() ()
#23 0x00000000005cb437 in cmLocalGenerator::Configure() ()
#24 0x0000000000ca2af8 in cmLocalUnixMakefileGenerator3::Configure() ()
#25 0x0000000000bf3df6 in cmGlobalGenerator::Configure() ()
#26 0x0000000000c44edd in cmGlobalUnixMakefileGenerator3::Configure() ()
#27 0x000000000084c49e in cmake::ActualConfigure() ()
#28 0x0000000000849b24 in cmake::Configure() ()
#29 0x0000000000850efa in cmake::Run(std::__1::vector<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::allocator<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > > > const&, bool) ()
#30 0x000000000052f665 in do_cmake(int, char const* const*) ()
#31 0x000000000052c149 in main ()
However, if I add the -Wno-dev option to the cmake call it works fine.
Here is my simple test code,
#include <iostream>
int main(){
std::cout << "SAO" << std::endl;
return 0;
}
and compile command below
gcc -o test test.cpp
and I am having a compile error below.
Undefined symbols for architecture x86_64:
"std::basic_string<char, std::char_traits<char>, std::allocator<char> >::size() const", referenced from:
std::__verify_grouping(char const*, unsigned long, std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)in ccMFcxIz.o
"std::basic_string<char, std::char_traits<char>, std::allocator<char> >::operator[](unsigned long) const", referenced from:
std::__verify_grouping(char const*, unsigned long, std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)in ccMFcxIz.o
"std::basic_ostream<char, std::char_traits<char> >::operator<<(std::basic_ostream<char, std::char_traits<char> >& (*)(std::basic_ostream<char, std::char_traits<char> >&))", referenced from:
_main in ccMFcxIz.o
"std::ios_base::Init::Init()", referenced from:
__static_initialization_and_destruction_0(int, int)in ccMFcxIz.o
"std::ios_base::Init::~Init()", referenced from:
___tcf_0 in ccMFcxIz.o
"std::cout", referenced from:
_main in ccMFcxIz.o
"std::basic_ostream<char, std::char_traits<char> >& std::endl<char, std::char_traits<char> >(std::basic_ostream<char, std::char_traits<char> >&)", referenced from:
_main in ccMFcxIz.o
"std::basic_ostream<char, std::char_traits<char> >& std::operator<< <std::char_traits<char> >(std::basic_ostream<char, std::char_traits<char> >&, char const*)", referenced from:
_main in ccMFcxIz.o
"___gxx_personality_v0", referenced from:
Dwarf Exception Unwind Info (__eh_frame) in ccMFcxIz.o
ld: symbol(s) not found for architecture x86_64
collect2: ld returned 1 exit status
I've tried putting -m32 just in case but still give me error below.
ld: symbol(s) not found for architecture i386
collect2: ld returned 1 exit status
Version of gcc is 4.2 which is installed by XCode "command line tool".
OS is Mac OSX Mountain Lion.
I've tried with gcc 4.7 or clang 3.1 but same error..
Ofcourse, compiling cpp code with gcc will give you error. You should use g++