Have just installed Quantlib on Mac

now trying SWIG for Python but get below error

g++ -bundle -undefined dynamic_lookup -arch i386 -arch x86_64 -Wl,-F. build/temp.macosx-10.11-intel-2.7/QuantLib/quantlib_wrap.o -L/opt/local/lib -L/opt/local/lib -lQuantLib -o build/lib.macosx-10.11-intel-2.7/QuantLib/_QuantLib.so
ld: warning: ignoring file /opt/local/lib/libQuantLib.dylib, file was built for x86_64 which is not the architecture being linked (i386): /opt/local/lib/libQuantLib.dylib

what am i missing?

  • $\begingroup$ Is this an error or just a warning? Did the compiler create the Python module, and have you tried using it? $\endgroup$ – Luigi Ballabio Jul 31 '16 at 16:25
  • $\begingroup$ yes.. the make -C Python check fails with the following error $\endgroup$ – M M Aug 1 '16 at 21:30

The message is very clear; you are trying to link the wrong architecture.

/opt/local/lib/libQuantLib.dylib you installed was compiled for the x86_64 architecture, but you're trying to link with i386.

i386 is 32 bits and x86_64 is 64 bits, they can't be used together. You should compile SWIG with x86_64, unless you have a 32 bits (very old) machine.

  • $\begingroup$ i didn't give any instruction differently my configure for QuantLib and QuantLib-SWIG... then where is it picking up this difference. i'm on a mac pro with OS X El Captain. what environment variable have i not set or have i incorrectly set for SWIG to think that i'm not in a x86_64 env!!! $\endgroup$ – M M Aug 1 '16 at 21:27

problem was with python

sudo port select --set python python27


sudo port select --set python2 python27

fixed the architecture to the right one x86_64 in the build and i stopped getting the linking error.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.