Hi Guido --

I had the -stdlib=libstdc++ line in there only because you had suggested that it be so in http://www.gecode.org/pipermail/users/2014-April/004368.html :-)

So I went back and redid everything without Qt, to see what I would get.

This time I was able to get the following to work. So perhaps I had just gotten myself confused earlier... Any case, glad to have it working now! (Note: unlike what the manual said, I did need to include the -I/usr/local/include arg.)

 g++ -I/usr/local/include -O3  -c -o money.o  money.cpp
bash-3.2$ g++ -o money money.o -L/usr/local/lib -O3 -lgecodeflatzinc -lgecodedriver -lgecodesearch -lgecodeminimodel -lgecodeset -lgecodefloat -lgecodeint -lgecodekernel -lgecodesupport
bash-3.2$ ./money
SEND+MORE=MONEY
    {9, 5, 6, 7, 1, 0, 8, 2}

Initial
    propagators: 2
    branchers:   1

Summary
    runtime:      0.000 (0.252 ms)
    solutions:    1
    propagations: 14
    nodes:        7
    failures:     3
    restarts:     0
    no-goods:     0
    peak depth:   1

bash-3.2$

On 10/13/14, 2:54 PM, Guido Tack wrote:
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/ <http://www.csse.monash.edu/%7Eguidot/>



On 13 Oct 2014, at 8:51 pm, Vijay Saraswat <vi...@saraswat.org <mailto:vi...@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/ <http://www.gecode.org/%7Eschulte/>


-----Original Message-----
From: users-boun...@gecode.org [mailto:users-boun...@gecode.org] On Behalf
Of Vijay Saraswat
Sent: Monday, October 13, 2014 5:11 PM
To: cschu...@kth.se; users@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-boun...@gecode.org [mailto:users-boun...@gecode.org] On
Behalf Of Vijay Saraswat
Sent: Monday, October 13, 2014 4:51 PM
To: users@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@gecode.org
https://www.gecode.org/mailman/listinfo/gecode-users



_______________________________________________
Gecode users mailing list
users@gecode.org
https://www.gecode.org/mailman/listinfo/gecode-users




_______________________________________________
Gecode users mailing list
users@gecode.org <mailto:users@gecode.org>
https://www.gecode.org/mailman/listinfo/gecode-users



_______________________________________________
Gecode users mailing list
users@gecode.org <mailto:users@gecode.org>
https://www.gecode.org/mailman/listinfo/gecode-users


_______________________________________________
Gecode users mailing list
users@gecode.org
https://www.gecode.org/mailman/listinfo/gecode-users

Reply via email to