Re: Has anyone solved linking to quantlib in Xcode?

Posted by Bart Mosley, bondgeek.com on
URL: http://quantlib.414.s1.nabble.com/Has-anyone-solved-linking-to-quantlib-in-Xcode-tp6662p6666.html

Thanks, Tamas.     That let's me run in Debug mode without the  
offending flag, or any adverse side-effects (so far).   Also,  
wondering if a different flag could be set in compiling QL, but I'm  
not smart nor patient enough to figure that one out.

Thanks also to Chris Kenyon for the heads-up on the -fvisibility flag  
setting.

        • Issue: RelativeDateHelper's do not link correctly (inconsistently)  
with Settings::instance().evaluationDate() using Xcode.
        • Effects:
                • Settings::instance().evaluationDate() has no effect on relative  
date helpers.
                • You cannot build yield curves correctly for any date except the  
present day (base dates are silently changed).
        • Cause: setting -fvisibility=hidden in the compile step. (possibly  
also -fvisibility-inlines-hidden and -mfixandcontinue)

Note that to get rid of the visibility settings you need to check  
Xcode's "Fix & Continue" flag AND uncheck "Symbols Hidden by Default".


_________________________
Bart Mosley
www.bondgeek.com
[hidden email]




On Dec 18, 2008, at 1:07 PM, Tamas Sashalmi wrote:

> Hi,
>
> the answer for your 2nd question:
>
> double click on your Targets (name of your binary)on the left side  
> panel to get the info panel. Then select build. Here you can set up  
> many things as well as GCC 4.0 -- Preprocessing where you will find  
> Preprocessor Macros _GLIBCXX_DEBUG=1..
>
> well I am also interested in the answer #3...
>
> Best,
>
> TRS
>
>
> On 18 Dec 2008, at 16:51, Bart Mosley, bondgeek.com wrote:
>
>> I've narrowed it down further.
>>
>> -D_GLIBCXX_DEBUG=1
>>
>> Xcode generates the following compile statement (with some  
>> extraneous '-I' flags remove for readability):
>>
>> > /Developer/usr/bin/gcc-4.0 -x c++ -arch i386 -fmessage-length=0 -
>> pipe -Wno-trigraphs -fpascal-strings -fasm-blocks -O0 -Wreturn-type  
>> -Wunused-variable -D_GLIBCXX_DEBUG=1 -D_GLIBCXX_DEBUG_PEDANTIC=1 -I/
>> usr/local/include -c main.cpp -o /Users/me/sandbox/QLtest/build/
>> QLtest.build/Debug/QLtest.build/Objects-normal/i386/main.o
>>
>> then linking, with the linking statement Xcode generates, leads to  
>> build errors, whereas:
>>
>> > /Developer/usr/bin/gcc-4.0 -x c++ -arch i386 -fmessage-length=0 -
>> pipe -Wno-trigraphs -fpascal-strings -fasm-blocks -O0 -Wreturn-type  
>> -Wunused-variable  -D_GLIBCXX_DEBUG_PEDANTIC=1 -I/usr/local/include  
>> -c main.cpp -o /Users/me/sandbox/QLtest/build/QLtest.build/Debug/
>> QLtest.build/Objects-normal/i386/main.o
>>
>> is successful.
>>
>> So the question is now:
>> 1) what is -D_GLIBCXX_DEBUG=1 ?
>> 2) how to get XCode to drop the -D_GLIBCXX_DEBUG=1 ?
>> 3) I suppose an alternative question is if there is some in  
>> QuantLib that is interferring with whatever this flag is supposed  
>> to do, because adding the flag to the compile of other code doesn't  
>> seem to generate the same problem.
>>
>> Thank you.
>>
>> Bart.
>>
>>
>>
>>
>> On Dec 18, 2008, at 10:27 AM, Bart Mosley, bondgeek.com wrote:
>>
>>> Here are the errors:
>>> ________________________________________
>>> Undefined symbols:
>>> "QuantLib::ExerciseAdapter::nextTimeStep(QuantLib::CurveState
>>> const&, __gnu_debug_def::vector<unsigned long,  
>>> std::allocator<unsigned
>>> long> >&,
>>> __gnu_debug_def
>>> ::vector
>>> <
>>> __gnu_debug_def::vector<QuantLib::MarketModelMultiProduct::CashFlow,
>>> std::allocator<QuantLib::MarketModelMultiProduct::CashFlow> >,
>>> std
>>> ::allocator
>>> <
>>> __gnu_debug_def::vector<QuantLib::MarketModelMultiProduct::CashFlow,
>>> std::allocator<QuantLib::MarketModelMultiProduct::CashFlow> > >  
>>> >&)",
>>> referenced from:
>>>     vtable for QuantLib::ExerciseAdapterin main.o
>>> ...
>>> [then similar errors for the following functions
>>> QuantLib::ExerciseAdapter::nextTimeStep
>>> QuantLib::MultiStepCoinitialSwaps::nextTimeStep
>>> QuantLib::MultiStepCoterminalSwaps::nextTimeStep
>>> QuantLib::MultiStepCoterminalSwaptions::nextTimeStep
>>> QuantLib::MultiStepForwards::nextTimeStep
>>> QuantLib::MultiStepNothing::nextTimeStep
>>> QuantLib::MultiStepOptionlets::nextTimeStep
>>> QuantLib::MultiStepPeriodCapletSwaptions::nextTimeStep
>>> QuantLib::MultiStepRatchet::nextTimeStep
>>> QuantLib::MultiStepSwap::nextTimeStep
>>> QuantLib::MultiStepSwaption::nextTimeStep
>>> QuantLib::OneStepCoinitialSwaps::nextTimeStep
>>> QuantLib::OneStepCoterminalSwaps::nextTimeStep
>>> QuantLib::OneStepForwards::nextTimeStep
>>> QuantLib::OneStepOptionlets::nextTimeStep
>>> ] ....
>>>
>>> ld: symbol(s) not found
>>> collect2: ld returned 1 exit status
>>> __________________________________________
>>>
>>>
>>>
>>>
>>>
>>>
>>> On Dec 18, 2008, at 3:28 AM, Luigi Ballabio wrote:
>>>
>>>> On Wed, 2008-12-17 at 15:35 -0500, Bart Mosley, bondgeek.com wrote:
>>>>> If the following command line compile/link  works (note this is  
>>>>> run
>>>>> in
>>>>> the project directory for Xcode and main.cpp is just a "Hello,  
>>>>> World"
>>>>> with  #include<ql/quantlib.hpp> added to it) :
>>>>>
>>>>>   c++ main.cpp -o tql -L/usr/local/lib -lQuantLib
>>>>>
>>>>> Then why does Xcode get 15 (and only 15) build errors?
>>>>
>>>> What are the errors?
>>>>
>>>> Luigi
>>>>
>>>>
>>>> --
>>>>
>>>> Call on God, but row away from the rocks.
>>>> -- Indian proverb
>>>>
>>>>
>>>
>>>
>>> ------------------------------------------------------------------------------
>>> SF.Net email is Sponsored by MIX09, March 18-20, 2009 in Las  
>>> Vegas, Nevada.
>>> The future of the web can't happen without you.  Join us at MIX09  
>>> to help
>>> pave the way to the Next Web now. Learn more and register at
>>> http://ad.doubleclick.net/clk;208669438;13503038;i?http://2009.visitmix.com/
>>> _______________________________________________
>>> QuantLib-users mailing list
>>> [hidden email]
>>> https://lists.sourceforge.net/lists/listinfo/quantlib-users
>>>
>>
>> =  
>> ------------------------------------------------------------------------------
>> SF.Net email is Sponsored by MIX09, March 18-20, 2009 in Las Vegas,  
>> Nevada.
>> The future of the web can't happen without you.  Join us at MIX09  
>> to help
>> pave the way to the Next Web now. Learn more and register at
>> http://ad.doubleclick.net/clk;208669438;13503038;i?http://2009.visitmix.com/
>> _______________________________________________
>> QuantLib-users mailing list
>> [hidden email]
>> https://lists.sourceforge.net/lists/listinfo/quantlib-users
>
>


------------------------------------------------------------------------------
SF.Net email is Sponsored by MIX09, March 18-20, 2009 in Las Vegas, Nevada.
The future of the web can't happen without you.  Join us at MIX09 to help
pave the way to the Next Web now. Learn more and register at
http://ad.doubleclick.net/clk;208669438;13503038;i?http://2009.visitmix.com/
_______________________________________________
QuantLib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-users