Login  Register

Re: mac install

Posted by bo.zhao on Jul 22, 2014; 3:23pm
URL: http://quantlib.414.s1.nabble.com/mac-install-tp15629p15637.html

Dear Sakeeb,

I compared your command with the one I was using when I was testing Quantlib on Mac, which is

>> g++ -I/opt/local/include/ -I/opt/local/include/boost BermudanSwaption.cpp -o bermudanswaption -L/opt/local/lib/ -lQuantLib

, and they seems the same to me. 

I also tried to compile the example in Xcode, and it works as well. If you want to try it in Xcode, here is a note I have written to record what I have done:

If one wants to build an example in Xcode, he needs to follow the steps given below. Here it is assumed that Xcode has been configured in that C++ coding is supported.

1. Create a Xcode project

2. Add the example cpp file to this project.

3. Important: - setting path for other Quantlib and Boost headers and Quantlib libraries.

  1) Go to Build Settings of the project. Under Search Paths, add path /opt/local/include/ and path /opt/local/include/boost to Header Search Paths.

   2) Also under Search Paths, add path /opt/local/lib/ to Library Search Paths.

   3) For all the three paths, select non-recursive when each of them is added.

   4) Go to Linking. Add -lQuantLib to Other Linker Flags.

Then, the example will be able to built and run in Xcode.


Hope it helps.


Regards,


Bo





On 22 July 2014 16:11, Sakeeb Zaman <[hidden email]> wrote:
Thanks for the responses.

Bo, I think compiling c++ is ok, because I can compile a simple program in Xcode and using command line tool.

Cheng, Is that a flag I have to add to the compilation command? If so could you please tell me know I should write?

Thanks, Sakeeb 


On 22 Jul 2014, at 08:40, Cheng Li <[hidden email]> wrote:

Seems the error message complains boost unit test lib can't be linked. You have to explicitly tell compiler you want to link with boost unit test lib in your last step.

But I am a little wondering why example bermudanswaption has to use unit test lib? Maybe my answer is not right... I have no experience on Mac.

发自我的 iPad

在 2014年7月22日,11:40,Sakeeb Zaman <[hidden email]> 写道:

Hi, I have tried following the instructions on http://quantlib.org/install/macosx.shtml. I’m on OS 10.9.4. I am completely new to all of this so not knowing what info is useful, I listed all the steps I took below. Please could you help me get this working? Thanks in advance for any help. 

1) Got macports

2) sudo port install boost
- first time it did a bunch of stuff, now when I tried it again it returns:
--->  Computing dependencies for boost
--->  Cleaning boost
--->  Scanning binaries for linking errors
--->  No broken files found.

3) From sourceforge I downloaded QuantLib-1.4.tar.gz … it saved in my Downloads directory

4) In Downloads I ran tar xzvf QuantLib-1.4.tar.gz

5) Then there was a QuantLib-1.4 directory within Downloads

6) In the QuantLib-1.4 directory:  ./configure --enable-static --with-boost-include=/opt/local/include/ \
            --with-boost-lib=/opt/local/lib/ --prefix=/opt/local/

Note: I also tried doing: 
./configure --enable-static --with-boost-include=/opt/local/include/ \
            --with-boost-lib=/opt/local/lib/ --prefix=/opt/local/ \
            CXXFLAGS="-stlib=libstdc++ -mmacosx-version-min=10.6" \
            LDFLAGS="-stlib=libstdc++ -mmacosx-version-min=10.6”

But this doesn’t do much, returning: 

checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... config/install-sh -c -d
checking for gawk... no
checking for mawk... no
checking for nawk... no
checking for awk... awk
checking whether make sets $(MAKE)... yes
checking whether make supports nested variables... yes
checking for gawk... (cached) awk
checking for gcc... gcc
checking whether the C compiler works... no
configure: error: in `/Users/myname/Downloads/QuantLib-1.4':
configure: error: C compiler cannot create executables
See `config.log' for more details
6) make && sudo make install

7) runs for about 90mins and asks for my password once while doing so

8) Finally when I try compiling within ~/Downloads/QuantLib-1.4/test-suite directory with: g++ -I/opt/local/include/ -I/opt/local/include/boost BermudanSwaption.cpp \
    -o bermudanswaption -L/opt/local/lib/ -lQuantLib

I get:

Undefined symbols for architecture x86_64:
  "boost::test_tools::tt_detail::check_impl(boost::test_tools::predicate_result const&, boost::unit_test::lazy_ostream const&, boost::unit_test::basic_cstring<char const>, unsigned long, boost::test_tools::tt_detail::tool_level, boost::test_tools::tt_detail::check_type, unsigned long, ...)", referenced from:
      BermudanSwaptionTest::testCachedValues() in BermudanSwaption-7aa50d.o
      QuantLib::detail::quantlib_test_case::operator()() const in BermudanSwaption-7aa50d.o
  "boost::unit_test::test_suite::add(boost::unit_test::test_unit*, unsigned long, unsigned int)", referenced from:
      BermudanSwaptionTest::suite() in BermudanSwaption-7aa50d.o
  "boost::unit_test::test_suite::test_suite(boost::unit_test::basic_cstring<char const>)", referenced from:
      BermudanSwaptionTest::suite() in BermudanSwaption-7aa50d.o
  "boost::unit_test::unit_test_log_t::set_checkpoint(boost::unit_test::basic_cstring<char const>, unsigned long, boost::unit_test::basic_cstring<char const>)", referenced from:
      BermudanSwaptionTest::testCachedValues() in BermudanSwaption-7aa50d.o
      QuantLib::detail::quantlib_test_case::operator()() const in BermudanSwaption-7aa50d.o
  "boost::unit_test::unit_test_log_t::operator()(boost::unit_test::log_level)", referenced from:
      BermudanSwaptionTest::testCachedValues() in BermudanSwaption-7aa50d.o
  "boost::unit_test::unit_test_log_t::operator<<(boost::unit_test::log::begin const&)", referenced from:
      BermudanSwaptionTest::testCachedValues() in BermudanSwaption-7aa50d.o
  "boost::unit_test::test_case::test_case(boost::unit_test::basic_cstring<char const>, boost::unit_test::callback0<boost::unit_test::ut_detail::unused> const&)", referenced from:
      boost::unit_test::make_test_case(boost::unit_test::callback0<boost::unit_test::ut_detail::unused> const&, boost::unit_test::basic_cstring<char const>) in BermudanSwaption-7aa50d.o
  "boost::unit_test::ut_detail::entry_value_collector::~entry_value_collector()", referenced from:
      BermudanSwaptionTest::testCachedValues() in BermudanSwaption-7aa50d.o
  "boost::unit_test::ut_detail::normalize_test_case_name(boost::unit_test::basic_cstring<char const>)", referenced from:
      boost::unit_test::make_test_case(boost::unit_test::callback0<boost::unit_test::ut_detail::unused> const&, boost::unit_test::basic_cstring<char const>) in BermudanSwaption-7aa50d.o
  "QuantLib::flatRate(QuantLib::Date const&, double, QuantLib::DayCounter const&)", referenced from:
      BermudanSwaptionTest::testCachedValues() in BermudanSwaption-7aa50d.o
  "boost::unit_test::ut_detail::entry_value_collector::operator<<(boost::unit_test::lazy_ostream const&) const", referenced from:
      BermudanSwaptionTest::testCachedValues() in BermudanSwaption-7aa50d.o
  "vtable for boost::unit_test::unit_test_log_t", referenced from:
      boost::unit_test::unit_test_log_t::unit_test_log_t() in BermudanSwaption-7aa50d.o
  NOTE: a missing vtable usually means the first non-inline virtual member function has no definition.
  "_main", referenced from:
     implicit entry/start for main executable
ld: symbol(s) not found for architecture x86_64
------------------------------------------------------------------------------
Want fast and easy access to all the code in your enterprise? Index and
search up to 200,000 lines of code with a free copy of Black Duck
Code Sight - the same software that powers the world's largest code
search on Ohloh, the Black Duck Open Hub! Try it now.
http://p.sf.net/sfu/bds
_______________________________________________
QuantLib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-users


------------------------------------------------------------------------------
Want fast and easy access to all the code in your enterprise? Index and
search up to 200,000 lines of code with a free copy of Black Duck
Code Sight - the same software that powers the world's largest code
search on Ohloh, the Black Duck Open Hub! Try it now.
http://p.sf.net/sfu/bds
_______________________________________________
QuantLib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-users



------------------------------------------------------------------------------
Want fast and easy access to all the code in your enterprise? Index and
search up to 200,000 lines of code with a free copy of Black Duck
Code Sight - the same software that powers the world's largest code
search on Ohloh, the Black Duck Open Hub! Try it now.
http://p.sf.net/sfu/bds
_______________________________________________
QuantLib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-users