I have a program that runs correctly when using .png files.
I'm trying to convert it to support OpenEXR.
The program is compiled with macports g++-mp-4.5, and links against macports's openexr1.7.
Relevant parts of the compile line:
/opt/local/bin/g++-mp-4.5 ... -I/opt/local/include/OpenEXR -I/opt/local/include/OpenEXR file.cc ...
-L/opt/local/lib -lIlmImf -lHalf ...
When run, it does this when it tries to call the exr library:
libc++abi.dylib: terminate called throwing an exception
When it is changed to link with the .a files
/opt/local/lib/libIlmImf.a /opt/local/lib/libHalf.a
it gives a link error
Undefined symbols for architecture x86_64:
"Iex::throwErrnoExc(std::basic_string, std::allocator > const&)", referenced from:
Imf::(anonymous namespace)::writeLineOffsets(Imf::OStream&, std::vector > const&) in libIlmImf.a(ImfOutputFile.o)
Imf::StdIFStream::StdIFStream(char const*) in libIlmImf.a(ImfStdIO.o)
Imf::(anonymous namespace)::checkError(std::basic_istream >&, long) in libIlmImf.a(ImfStdIO.o)
After searching, it seems that this (*undefined symbols for x86_64*) is a common problem for linux-style mac development, and does not appear to be specific
to openexr. However after reading various posts, I still do not understand what the solution is!
Here is a post on the exact problem, however the solution is not explained in enough detail for me to understand:
http://lists.nongnu.org/archive/html/openexr-devel/2011-08/msg00007.html
Related
I am trying to link Open Source Routing Machine (OSRM) code with a basic command-line application in XCode and run the code provided in Example.cpp (from osrm-master directory) as the main function. I am able to link header files from OSRM 'include' as well as all other required libraries, so within the code, there are no identified errors. However, when I run the project, I get the following error:
Undefined symbols for architecture x86_64: "osrm::OSRM::OSRM(osrm::engine::EngineConfig&)", referenced from: _main in main.o "osrm::OSRM::~OSRM()", referenced from: _main in main.o "osrm::OSRM::Route(osrm::engine::api::RouteParameters const&, osrm::util::json::Object&) const", referenced from: _main in main.o ld: symbol(s) not found for architecture x86_64
Why might this be and how could I approach solving this error? Is there a way you could recommend to link OSRM file system into my application? I don't want to link the library itself (libosrm.a), but the actual source code files.
About a week ago I moved from Windows and Visual Studio to Mac and Xcode. I want to be able to work on my project on Mac, so I decided to port it.
First of all I need test to work on Mac and Google provides instructions about how to do so. After I build test with my Xcode, I can see three files in the output directory: test.framework, libgtest_main.a and libgtest.a.
Documentation says I need to link test.framework with my project. So, I create new console app project and link it with test.framework file.
Unfortunately my build fails with about 70+ issues. After I link librettist.a to my project, it fails with only 2 issues. Here they are:
Undefined symbols for architecture x86_64:
"testing::internal::EqFailure(char const*, char const*,
std::__1::basic_string,
std::__1::allocator > const&, std::__1::basic_string, std::__1::allocator > const&,
bool)", referenced from:
testing::AssertionResult testing::internal::CmpHelperEQ(char const*, char const*, int const&, int const&) in main.o ld:
symbol(s) not found for architecture x86_64 clang: error: linker
command failed with exit code 1 (use -v to see invocation)
As I understood, linker cannot resolve symbols. If I link my project with libgtest_main.a it changes nothing and this error is still here. So, how can I fix it?
I had the same problem and was unable to figure out why this isn't being created. It does work fine on some 32 bit code, so I'm equally puzzled.
That said, the sample in the gtest package has the following comment:
EXPECT_EQ(expected, actual) is the same as EXPECT_TRUE((expected) ==
(actual)) except that it will print both the expected value and the
actual value when the assertion fails. This is very helpful for
debugging. Therefore in this case EXPECT_EQ is preferred.
and the same is true for ASSERT_EQ and ASSERT_TRUE. So if you make the substitution, you lose some information in the case of failure, but at least you can use it.
I have been forced to return to an old bugbear lately: compiling a fortran script to run under Matlab on Mac. I have managed to compile the example c file to mex but the Fortran file refuses unless I use -c and the object of my desire, kt3d.for, throws up a whole list of fun but all linked to the same error (I guess).
I'm running Matlab R2011b on OSX 10.7.5 with XCode 4.6.1.
I've patched Matlab according http://www.mathworks.se/support/solutions/en/data/1-FR6LXJ/
Got a Fortran compiler running according to https://sites.google.com/site/dwhipp/tutorials/mac_compilers
I altered the mex file to call bash rather than sh but still no joy. Getting tired of having to boot up my old XP machine every time I want to run a kriging package so I would really like to compile these things for OSX.
Below is the error, it looks like an architecture issue but I cant figure out how to fix it.
>> mex kt3d.for
Undefined symbols for architecture x86_64:
"_chknam_", referenced from:
_readparm_ in kt3d.o
"_cova3_", referenced from:
_kt3d_ in kt3d.o
"_ktsol_", referenced from:
_kt3d_ in kt3d.o
"_mexfunction_", referenced from:
-exported_symbol[s_list] command line option
"_picksup_", referenced from:
_kt3d_ in kt3d.o
"_setrot_", referenced from:
_kt3d_ in kt3d.o
"_setsupr_", referenced from:
_kt3d_ in kt3d.o
"_srchsupr_", referenced from:
_kt3d_ in kt3d.o
ld: symbol(s) not found for architecture x86_64
collect2: ld returned 1 exit status
mex: link of ' "kt3d.mexmaci64"' failed.
Error using mex (line 206)
Unable to complete successfully.
I believe those symbols are found in GSLIB. Assuming you have this installed and somewhere that your compiler can find it, you may need to add something like "-lgslib" to your mex command to get it to link the library for you.
I'm using Qt4.8 on OSX Leopard and instead of qmake+QtCreator I want to compile a very simple project using CMake on OSX to understand how to do a package.
While the very same project compiles and links smoothly under Linux, under my OSX box, this is the error message I always get in the linking phase:
ld warning: in /Library/Frameworks//QtGui.framework/QtGui, file is not of required architecture
ld warning: in /Library/Frameworks//QtCore.framework/QtCore, file is not of required architecture
Undefined symbols:
"QWidget::mousePressEvent(QMouseEvent*)", referenced from:
vtable for TestFormin moc_TestForm.cxx.o
"QObject::childEvent(QChildEvent*)", referenced from:
vtable for TestFormin moc_TestForm.cxx.o
"QWidget::actionEvent(QActionEvent*)", referenced from:
vtable for TestFormin moc_TestForm.cxx.o
"QCoreApplication::translate(char const*, char const*, char const*, QCoreApplication::Encoding)", referenced from:
etcetera etcetera.
This happens for every project I want to compile with cmake.
Any idea of what's going on?
Check what architecture (i386,x86_64) is being used by cmake (CMAKE_OSX_ARCHITECTURES). Try suggesting the architecture to cmake:
cmake -DCMAKE_OSX_ARCHITECTURES=x86_64
I'm probably missing something simple, but I'm getting the following linker error when trying to build:
Undefined symbols for architecture i386:
"CAStreamBasicDescription::CAStreamBasicDescription()", referenced from:
-[AudioController initializeAUGraph] in AudioController.o
-[AudioController .cxx_construct] in AudioController.o
"CAStreamBasicDescription::AsString(char*, unsigned long) const", referenced from:
CAStreamBasicDescription::PrintFormat(__sFILE*, char const*, char const*) const in AudioController.o
ld: symbol(s) not found for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)
I can't figure out what's going on here as the compiler is finding CAStreamBasicDescription.h just fine. I've seen suggestions of clearing the framework search path when encountering this type of error, but there's nothing in that path. Probably something simple, but I feel like I'm drinking from a fire hose. Thanks!
Have you added CAStreamBasicDescription.cpp to your project also? It's part of the unofficial Core Audio SDK, so it isn't available unless you compile it yourself.