[gecode-users] Compilation problem on MacOs with Gecode 4.3

Guido Tack tack at gecode.org
Mon Oct 13 20:54:51 CEST 2014


Hi Vijay,

the main difference seems to be that you had -stdlib=libstdc++ on your command line.  The missing symbols were probably mismatches on std::ostream (all the linker errors referenced that symbol), so I guess that you compiled Gecode with libc++ but later tried to compile your example with libstdc++?  In particular if you link against Qt, you have to use the same standard library that was used to compile Qt.

Cheers,
Guido

-- 
Guido Tack
http://www.csse.monash.edu/~guidot/



On 13 Oct 2014, at 8:51 pm, Vijay Saraswat <vijay at saraswat.org> wrote:

> FWIW for others who might be in a similar predicament: Cutting and pasting from the log files for make test yielded the following commands that worked to compile and run my code:
> 
> g++ -I/usr/local/include -Qunused-arguments -fno-signaling-nans -fno-rounding-math -ffinite-math-only -fno-math-errno -fno-strict-aliasing -O3 -fvisibility=hidden -ggdb -pipe -Wall -Wextra -fPIC -pthread -DNDEBUG   -DQT_NO_DEBUG -DQT_PRINTSUPPORT_LIB -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -I${QTH}/5.3/clang_64/mkspecs/macx-clang -I${QTH}/5.3/clang_64/lib/QtPrintSupport.framework/Versions/5/Headers -I${QTH}/5.3/clang_64/lib/QtWidgets.framework/Versions/5/Headers -I${QTH}/5.3/clang_64/lib/QtGui.framework/Versions/5/Headers -I${QTH}/5.3/clang_64/lib/QtCore.framework/Versions/5/Headers -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.8.sdk/System/Library/Frameworks/OpenGL.framework/Versions/A/Headers -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.8.sdk/System/Library/Frameworks/AGL.framework/Headers -F${QTH}/5.3/clang_64/lib -c -o money.o  money.cpp
> 
> bash-3.2$ g++ -o money money.o -L/usr/local/lib -I/usr/local/include -Qunused-arguments -fno-signaling-nans -fno-rounding-math -ffinite-math-only -fno-math-errno -fno-strict-aliasing -O3 -fvisibility=hidden -ggdb -pipe -Wall -Wextra -fPIC -pthread -DNDEBUG -lgecodeflatzinc -lgecodedriver -lgecodegist -lgecodesearch -lgecodeminimodel -lgecodeset -lgecodefloat -lgecodeint -lgecodekernel -lgecodesupport -F/Users/vijaysaraswat/Qt/5.3/clang_64/lib -framework QtPrintSupport -framework QtWidgets -framework QtGui -framework QtCore -framework OpenGL -framework AGL
> On 10/13/14, 1:03 PM, Vijay Saraswat wrote:
>> FWIW, I did "make test", and ran test/test, and all tests pass.
>> 
>> I am also able to run the examples.
>> 
>> So in principle I could decode the make file for the examples and tests and find out what to do :-)
>> 
>> On 10/13/14, 11:11 AM, Christian Schulte wrote:
>>> Apparently you did compile with Gist, that explains the first thing.
>>> 
>>> The second I do not know and I will have to leave to an Apple user...
>>> 
>>> Cheers
>>> Christian
>>> 
>>> -- 
>>> Christian Schulte, Professor of Computer Science, KTH,
>>> www.gecode.org/~schulte/
>>> 
>>> 
>>> -----Original Message-----
>>> From: users-bounces at gecode.org [mailto:users-bounces at gecode.org] On Behalf
>>> Of Vijay Saraswat
>>> Sent: Monday, October 13, 2014 5:11 PM
>>> To: cschulte at kth.se; users at gecode.org
>>> Subject: Re: [gecode-users] Compilation problem on MacOs with Gecode 4.3
>>> 
>>> OK that definitely helps -- I get fewer missing symbols from before.
>>> 
>>> However, -lcodegist did not work:
>>> 
>>> g++ -v -o money money.o  -stdlib=libstdc++ -L/usr/local/lib
>>> -lgecodedriver -lgecodegist -lgecodesearch -lgecodeminimodel -lgecodeint
>>> -lgecodekernel -lgecodesupport Apple LLVM version 5.1 (clang-503.0.40)
>>> (based on LLVM 3.4svn)
>>> Target: x86_64-apple-darwin13.1.0
>>> Thread model: posix
>>> "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolch
>>> ain/usr/bin/ld" -demangle -dynamic -arch x86_64 -macosx_version_min 10.9.0
>>> -syslibroot
>>> /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Develop 
>>> er/SDKs/MacOSX10.9.sdk -o money -L/usr/local/lib money.o -lgecodedriver
>>> -lgecodegist -lgecodesearch -lgecodeminimodel -lgecodeint -lgecodekernel
>>> -lgecodesupport -lstdc++ -lSystem
>>> /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolcha 
>>> in/usr/bin/../lib/clang/5.1/lib/darwin/libclang_rt.osx.a
>>> ld: library not found for -lgecodegist
>>> clang: error: linker command failed with exit code 1 (use -v to see
>>> invocation)
>>> 
>>> This is odd -- there was no error when i did a make to make the system.
>>> 
>>> Without lcodegist I do get a fewer set of missing symbols:
>>> 
>>> g++ -v -o money money.o  -stdlib=libstdc++ -L/usr/local/lib
>>> -lgecodedriver -lgecodesearch -lgecodeminimodel  -lgecodeint -lgecodekernel
>>> -lgecodesupport Apple LLVM version 5.1 (clang-503.0.40) (based on LLVM
>>> 3.4svn)
>>> Target: x86_64-apple-darwin13.1.0
>>> Thread model: posix
>>> "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolch
>>> ain/usr/bin/ld" -demangle -dynamic -arch x86_64 -macosx_version_min 10.9.0
>>> -syslibroot
>>> /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Develop 
>>> er/SDKs/MacOSX10.9.sdk -o money -L/usr/local/lib money.o -lgecodedriver
>>> -lgecodesearch -lgecodeminimodel -lgecodeint -lgecodekernel -lgecodesupport
>>> -lstdc++ -lSystem
>>> /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolcha 
>>> in/usr/bin/../lib/clang/5.1/lib/darwin/libclang_rt.osx.a
>>> Undefined symbols for architecture x86_64:
>>>    "Gecode::Driver::stop(Gecode::Support::Timer&, std::ostream&)",
>>> referenced from:
>>>        void Gecode::Driver::ScriptBase<Gecode::Space>::runMeta<Money,
>>> Gecode::DFS, Gecode::Options,
>>> Gecode::Driver::EngineToMeta>(Gecode::Options const&, Money*) in money.o
>>>        void Gecode::Driver::ScriptBase<Gecode::Space>::runMeta<Money,
>>> Gecode::DFS, Gecode::Options, Gecode::RBS>(Gecode::Options const&,
>>> Money*) in money.o
>>>    "Gecode::branch(Gecode::Home, Gecode::IntVarArgs const&,
>>> Gecode::IntVarBranch, Gecode::IntValBranch, bool (*)(Gecode::Space const&,
>>> Gecode::IntVar, int), void (*)(Gecode::Space const&, Gecode::BrancherHandle
>>> const&, unsigned int, Gecode::IntVar, int, int const&, std::ostream&))",
>>> referenced from:
>>>        Money::Money(Gecode::Options const&) in money.o
>>> ld: symbol(s) not found for architecture x86_64
>>> clang: error: linker command failed with exit code 1 (use -v to see
>>> invocation)
>>> 
>>> Best,
>>> Vijay
>>> 
>>> On 10/13/14, 10:52 AM, Christian Schulte wrote:
>>>> Hi Vijay,
>>>> 
>>>> Not being an Apple user, let me still try a guess: you need to add
>>>> additional libraries:
>>>>   -lgecodeminimodel -lgecodedriver -lgecodegist
>>>> 
>>>> Please use the order as described in MPG.
>>>> 
>>>> Good luck
>>>> Christian
>>>> 
>>>> -- 
>>>> Christian Schulte, Professor of Computer Science, KTH,
>>>> www.gecode.org/~schulte/
>>>> 
>>>> 
>>>> -----Original Message-----
>>>> From: users-bounces at gecode.org [mailto:users-bounces at gecode.org] On
>>>> Behalf Of Vijay Saraswat
>>>> Sent: Monday, October 13, 2014 4:51 PM
>>>> To: users at gecode.org
>>>> Subject: [gecode-users] Compilation problem on MacOs with Gecode 4.3
>>>> 
>>>> Continuing with
>>>> http://www.gecode.org/pipermail/users/2014-April/004368.html
>>>> 
>>>> I am unable to get the basic example running from the tutorial.
>>>> 
>>>> On a MacBook, OS X 10.9.2, XCode 5.1.1, trying to install GECode 4.3
>>>> from the webpage http://www.gecode.org/download.html
>>>> 
>>>> Downloaded source package, did a ./configure, make, make-install --
>>>> all seemed to succeed.
>>>> 
>>>> The following command succeeds:
>>>> 
>>>> $g++ -O3 -I/usr/local/include -stdlib=libstdc++ -c money.cpp
>>>> 
>>>> However, the next command fails -- what am I doing wrong?
>>>> 
>>>> $g++ -v -o money money.o  -L/usr/local/lib -stdlib=libstdc++
>>>> -lgecodesearch -lgecodeint -lgecodekernel -lgecodesupport Apple LLVM
>>>> version 5.1
>>>> (clang-503.0.40) (based on LLVM 3.4svn)
>>>> Target: x86_64-apple-darwin13.1.0
>>>> Thread model: posix
>>>> "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xc
>>>> toolch ain/usr/bin/ld" -demangle -dynamic -arch x86_64
>>>> -macosx_version_min 10.9.0 -syslibroot
>>>> /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/D
>>>> evelop er/SDKs/MacOSX10.9.sdk -o money -L/usr/local/lib money.o
>>>> -lgecodesearch -lgecodeint -lgecodekernel -lgecodesupport -lstdc++
>>>> -lSystem
>>>> /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xct
>>>> oolcha in/usr/bin/../lib/clang/5.1/lib/darwin/libclang_rt.osx.a
>>>> Undefined symbols for architecture x86_64:
>>>>     "Gecode::LinIntExpr::~LinIntExpr()", referenced from:
>>>>         Money::Money(Gecode::Options const&) in money.o
>>>>     "Gecode::BaseOptions::help()", referenced from:
>>>>         vtable for Gecode::Options in money.o
>>>>     "Gecode::BaseOptions::parse(int&, char**)", referenced from:
>>>>         _main in money.o
>>>>     "Gecode::BaseOptions::~BaseOptions()", referenced from:
>>>>         Gecode::Options::~Options() in money.o
>>>>     "Gecode::rel(Gecode::Home, Gecode::BoolExpr const&,
>>>> Gecode::IntConLevel)", referenced from:
>>>>         Money::Money(Gecode::Options const&) in money.o
>>>>     "Gecode::Driver::BaseOption::~BaseOption()", referenced from:
>>>>         Gecode::Options::~Options() in money.o
>>>>     "Gecode::Driver::CombinedStop::sigint", referenced from:
>>>>         void Gecode::Driver::ScriptBase<Gecode::Space>::runMeta<Money,
>>>> Gecode::DFS, Gecode::Options,
>>>> Gecode::Driver::EngineToMeta>(Gecode::Options const&, Money*) in money.o
>>>>         void Gecode::Driver::ScriptBase<Gecode::Space>::runMeta<Money,
>>>> Gecode::DFS, Gecode::Options, Gecode::RBS>(Gecode::Options const&,
>>>> Money*) in money.o
>>>>         Gecode::Driver::CombinedStop::interrupt(int) in money.o
>>>>         Gecode::Driver::CombinedStop::CombinedStop(unsigned int,
>>>> unsigned int, unsigned int) in money.o
>>>> Gecode::Driver::CombinedStop::stop(Gecode::Search::Statistics
>>>> const&, Gecode::Search::Options const&) in money.o
>>>>     "Gecode::Driver::StringOption::add(int, char const*, char
>>>> const*)", referenced from:
>>>>         _main in money.o
>>>>     "Gecode::Driver::StringOption::~StringOption()", referenced from:
>>>>         Gecode::Options::~Options() in money.o
>>>> "Gecode::Driver::StringValueOption::~StringValueOption()",
>>>> referenced
>>>> from:
>>>>         Gecode::Options::~Options() in money.o
>>>>     "Gecode::Driver::am(double*, int)", referenced from:
>>>>         void Gecode::Driver::ScriptBase<Gecode::Space>::runMeta<Money,
>>>> Gecode::DFS, Gecode::Options,
>>>> Gecode::Driver::EngineToMeta>(Gecode::Options const&, Money*) in money.o
>>>>         void Gecode::Driver::ScriptBase<Gecode::Space>::runMeta<Money,
>>>> Gecode::DFS, Gecode::Options, Gecode::RBS>(Gecode::Options const&,
>>>> Money*) in money.o
>>>>     "Gecode::Driver::dev(double*, int)", referenced from:
>>>>         void Gecode::Driver::ScriptBase<Gecode::Space>::runMeta<Money,
>>>> Gecode::DFS, Gecode::Options,
>>>> Gecode::Driver::EngineToMeta>(Gecode::Options const&, Money*) in money.o
>>>>         void Gecode::Driver::ScriptBase<Gecode::Space>::runMeta<Money,
>>>> Gecode::DFS, Gecode::Options, Gecode::RBS>(Gecode::Options const&,
>>>> Money*) in money.o
>>>>     "Gecode::Driver::stop(Gecode::Support::Timer&, std::ostream&)",
>>>> referenced from:
>>>>         void Gecode::Driver::ScriptBase<Gecode::Space>::runMeta<Money,
>>>> Gecode::DFS, Gecode::Options,
>>>> Gecode::Driver::EngineToMeta>(Gecode::Options const&, Money*) in money.o
>>>>         void Gecode::Driver::ScriptBase<Gecode::Space>::runMeta<Money,
>>>> Gecode::DFS, Gecode::Options, Gecode::RBS>(Gecode::Options const&,
>>>> Money*) in money.o
>>>>     "Gecode::branch(Gecode::Home, Gecode::IntVarArgs const&,
>>>> Gecode::IntVarBranch, Gecode::IntValBranch, bool (*)(Gecode::Space
>>>> const&, Gecode::IntVar, int), void (*)(Gecode::Space const&,
>>>> Gecode::BrancherHandle const&, unsigned int, Gecode::IntVar, int, int
>>>> const&, std::ostream&))", referenced from:
>>>>         Money::Money(Gecode::Options const&) in money.o
>>>>     "Gecode::Options::Options(char const*)", referenced from:
>>>>         _main in money.o
>>>>     "Gecode::BoolExpr::BoolExpr(Gecode::LinIntRel const&)", referenced
>>> from:
>>>>         Money::Money(Gecode::Options const&) in money.o
>>>>     "Gecode::BoolExpr::~BoolExpr()", referenced from:
>>>>         Money::Money(Gecode::Options const&) in money.o
>>>>     "Gecode::operator==(Gecode::LinIntExpr const&, Gecode::LinIntExpr
>>>> const&)", referenced from:
>>>>         Money::Money(Gecode::Options const&) in money.o
>>>>     "Gecode::operator==(Gecode::IntVar const&, Gecode::IntVar
>>>> const&)", referenced from:
>>>>         Money::Money(Gecode::Options const&) in money.o
>>>>     "Gecode::operator*(int, Gecode::IntVar const&)", referenced from:
>>>>         Money::Money(Gecode::Options const&) in money.o
>>>>     "Gecode::operator+(Gecode::LinIntExpr const&, Gecode::IntVar
>>>> const&)", referenced from:
>>>>         Money::Money(Gecode::Options const&) in money.o
>>>>     "Gecode::operator+(Gecode::LinIntExpr const&, Gecode::LinIntExpr
>>>> const&)", referenced from:
>>>>         Money::Money(Gecode::Options const&) in money.o
>>>>     "Gecode::operator+(Gecode::IntVar const&, Gecode::LinIntExpr
>>>> const&)", referenced from:
>>>>         Money::Money(Gecode::Options const&) in money.o
>>>>     "Gecode::operator+(Gecode::IntVar const&, Gecode::IntVar const&)",
>>>> referenced from:
>>>>         Money::Money(Gecode::Options const&) in money.o
>>>>     "typeinfo for Gecode::BaseOptions", referenced from:
>>>>         typeinfo for Gecode::Options in money.o
>>>> ld: symbol(s) not found for architecture x86_64
>>>> clang: error: linker command failed with exit code 1 (use -v to see
>>>> invocation)
>>>> bash-3.2$
>>>> 
>>>> _______________________________________________
>>>> Gecode users mailing list
>>>> users at gecode.org
>>>> https://www.gecode.org/mailman/listinfo/gecode-users
>>>> 
>>>> 
>>> 
>>> _______________________________________________
>>> Gecode users mailing list
>>> users at gecode.org
>>> https://www.gecode.org/mailman/listinfo/gecode-users
>>> 
>>> 
>> 
>> 
>> _______________________________________________
>> Gecode users mailing list
>> users at gecode.org
>> https://www.gecode.org/mailman/listinfo/gecode-users
>> 
> 
> 
> _______________________________________________
> Gecode users mailing list
> users at gecode.org
> https://www.gecode.org/mailman/listinfo/gecode-users

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.gecode.org/pipermail/users/attachments/20141013/98a82c39/attachment-0001.html>


More information about the users mailing list