I am trying to build a software package from source with make in Centos 6.5 which was successfully built in Fedora 8.
I made a few changes to the files and downgrade a few dependencies in Centos.
When I do make, I get a linker error:
/home/wjn/Desktop/samPro/src/graphEdit.o:
In function `GW::graphEdit::setPoints(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)': graphEdit.cpp:(.text+0x88): undefined reference to `bool GW::GraphUtils::create<GW::MathVector<double, 3, GW::MathVectorColumn>
>(GW::Graph<double, 3, GW::GraphColumn>&, std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, char, char, char)' collect2: ld returned 1 exit status
I checked the gcc command initiated by make, it is:
/usr/bin/g++ -D_GNU_SOURCE -O3 -mfpmath=sse -finline-limit=1000 -shared -Xlinker --no-undefined -Wl,-soname,libGraphImg.so
-o /home/wjn/Desktop/samPro/lib/graphImg.so /home/wjn/Desktop/samPro/src/graphType.o
/home/wjn/Desktop/samPro/src/graphCalibration.o
/home/wjn/Desktop/samPro/src/graphEdit.o
/home/wjn/Desktop/samPro/src/imgMorph.o
-L/home/wjn/Desktop/samPro/lib -Wl,
-rpath-link=/home/wjn/Desktop/samPro/lib -Wl,
-Bdynamic -lpthread -lm -lc
So I check graphUtils.h and graphUtils.cpp, bool GW::GraphUtils::create is properly defined but there is no graphUtils.o.
It is perfectly built in Fedora 8, so I am guessing it is a compiler version problem?
Centos has GCC 4.4.7 and Fedora has 4.1.2, could this be the problem? What can I do to solve this if I don't want to use the old GCC to build it.
Related
I have a library (let's call it libmylib.so) which was meant to be built using a docker running Ubuntu 16. I would like to use this library in a program (let's call it myapp) I wish to compile on my raspberry Pi running Raspbian.
When compiling, I get an output log of this form:
[25%] Building CXX object example1.cpp.o
[50%] Building CXX object example2.cpp.o
[75%] Building CXX object example3.cpp.o
[100%] Linking CXX executable target
And then a bunch of error of the form:
undefined reference to `VTT for std::__cxx11::basic_stringstream<char, std::char_traits<char>, std::allocator<char> >#GLIBCXX_3.4.21'
undefined reference to `std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_assign(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)#GLIBCXX_3.4.21'
collect2: error: ld returned 1 exit status
From what I could find on the web, this seems due to the fact that I am not compiling libmylib.so and myapp with the same compiler.
I am using g++ in both cases, but not the same version, as can be seen when I call g++ --version on both device.
From my docker:
root#3ea34286736e:/usr/bin# g++ --version
g++ (Ubuntu 5.4.0-6ubuntu1~16.04.6) 5.4.0 20160609
From my raspberry PI
pi#raspberrypi:/usr/bin $ g++ --version
g++ (Raspbian 4.9.2-10+deb8u1) 4.9.2
Is this a complete deal breaker or is there a way to make it work?
EDIT: Here is what I read that makes me assume it is a compiler version problem.
This and this seemed to be similar errors, to which the fix was to add to the cmake of myapp:
add_definitions(-D_GLIBCXX_USE_CXX11_ABI=0)
which did not work.
Adding this flag to the compile options of libmylib.so reduced the number of undefined reference errors from 10 to 1. More precisely:
undefined reference to `std::invalid_argument::invalid_argument(char const*)#GLIBCXX_3.4.21'
Compiling libmylib as a static library rather than shared somehow fixed the problem.
I installed a fresh version of Ubuntu 16.04.4 LTS and was able to compile my project with cmake . and make and this g++-5 command
g++-5 src/*.cpp -pthread -I extern/sleepy-discord/include -I
extern/poco-1.9.0/Foundation/include -I extern/poco-1.9.0/JSON/include
-I extern/poco-1.9.0/Net/include -I extern/poco-1.9.0/Util/include -L extern/sleepy-discord/lib/linux -L extern/poco-1.9.0/lib/linux
-std=c++11 -o bin/tipbot -lPocoJSON -lPocoUtil -lPocoNet -lPocoFoundation -lsleepy_discord -lcurl -lssl -lcrypto
Everything built successfully without error but on Travis CI it gives hundreds of linker errors
Travis.yml:
dist: trusty
sudo: false
language: cpp
addons:
apt:
sources:
- ubuntu-toolchain-r-test
packages:
- g++-5
- libcurl4-openssl-dev
- openssl
script:
- ls extern/sleepy-discord/lib/linux
- ls extern/poco-1.9.0/lib/linux
- g++-5 src/*.cpp -pthread -I extern/sleepy-discord/include -I extern/poco-1.9.0/Foundation/include -I extern/poco-1.9.0/JSON/include -I extern/poco-1.9.0/Net/include -I extern/poco-1.9.0/Util/include -L extern/sleepy-discord/lib/linux -L extern/poco-1.9.0/lib/linux -std=c++11 -o bin/tipbot -lPocoJSON -lPocoUtil -lPocoNet -lPocoFoundation -lsleepy_discord -lcurl -lssl -lcrypto
This is the error, it obviously found the libPocoJSON.a file but I don't understand why it says "undefined reference to" if it found the .a file and it found the C++11 template libraries.
extern/poco-1.9.0/lib/linux/libPocoJSON.a(ParserImpl.o): In function
Poco::JSON::ParserImpl::stripComments(std::__cxx11::basic_string<char,
std::char_traits<char>, std::allocator<char> >&) [clone .part.23]':
ParserImpl.cpp:(.text+0x91): undefined reference to
std::__cxx11::basic_string,
std::allocator >::_M_erase(unsigned long, unsigned long)'
extern/poco-1.9.0/lib/linux/libPocoJSON.a(ParserImpl.o): In function
void std::__cxx11::basic_string<char, std::char_traits<char>,
std::allocator<char> >::_M_construct<char*>(char*, char*,
std::forward_iterator_tag) [clone .isra.68]':
ParserImpl.cpp:(.text+0x1f9): undefined reference to
std::__cxx11::basic_string,
std::allocator >::_M_create(unsigned long&, unsigned long)'
extern/poco-1.9.0/lib/linux/libPocoJSON.a(ParserImpl.o): In function
`Poco::JSON::ParserImpl::handle()':
Full Travis report:
https://travis-ci.org/Brandantl/IntenseCoin-TipBot/builds/363978290?utm_source=github_status&utm_medium=notification
Repo:
https://github.com/Brandantl/IntenseCoin-TipBot
Can also compile with cmake .;make
The problem is that you mixed use the c++11 string with the c++03 string, which have different implementation.
Maybe, the poco library or other library on your Travis CI server is not compiled with c++11 flag. Recompile it with -std=c++11 or replace it with the one on your local machine.
I have tried building poco (poco-1.4.6p4) in several ways, all seem to build fine. However, when linking against it, all the different ways I have tried to build poco give error below. No matter what I choose, it appears that poco is being built with the clang++.
What is strange is that before I upgraded from Mountain Lion to Mavericks, none of this happened.
./configure --Darwin64 --shared
and
./configure --Darwin64-gcc --shared --no-tests
and
./configure --Darwin64-clang-libc++ --shared --no-tests
All the above seem to build fine.
But when I link against any of them, they all give the error below when linking against it.
Making all in compiler
/bin/sh ../libtool --tag=CXX --mode=link g++ -g -O2 -Wall -lfix8 -lPocoFoundation -lPocoNet -lPocoUtil -L../runtime -lz -o f8c f8c.o f8cutils.o f8precomp.o
libtool: link: g++ -g -O2 -Wall -o .libs/f8c f8c.o f8cutils.o f8precomp.o -Wl,-bind_at_load /Users/ivanfigueredo/Downloads/fix8/runtime/.libs/libfix8.dylib -lpthread -lPocoFoundation -lPocoNet -lPocoUtil -L../runtime -lz
Undefined symbols for architecture x86_64:
"Poco::RegularExpression::RegularExpression(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, int, bool)", referenced from:
FIX8::RegExp::RegExp(char const*, int) in f8c.o
"Poco::RegularExpression::match(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, unsigned long, std::vector<Poco::RegularExpression::Match, std::allocator<Poco::RegularExpression::Match> >&, int) const", referenced from:
_main in f8c.o
ld: symbol(s) not found for architecture x86_64
collect2: error: ld returned 1 exit status
make[1]: *** [f8c] Error 1
make: *** [all-recursive] Error 1
Configure generally will pay attention to CC and CXX environment variables to allow you to change compilers the software will build with. Try and adjust these settings.
I want to compile a very simple C++ program. On the first machine the compilation process works fine and also the program runs fine. However, on the second linux machine I have some libraries not found problems. The compilation process looks like this:
gcc -o WebPageCrawler -lawesomium-1-7 -Wall WebPageCrawler.cc
/tmp/ccoLVzvo.o: In function `main':
WebPageCrawler.cc:(.text+0x28): undefined reference to `std::cout'
WebPageCrawler.cc:(.text+0x2d): undefined reference to `std::basic_ostream<char, std::char_traits<char> >& std::operator<< <std::char_traits<char> >(std::basic_ostream<char, std::char_traits<char> >&, char const*)'
...even more errors...
As you can see the compiler even cannot find stdlibs and the other referenced library awesomium (a headless browser) is also not available. However, the corresponding libs can all be found in /usr/lib. So, there must be something else wrong but I don't know what it might be.
My linux version is
uname -a
Linux Ubuntu-1204-precise-64-minimal 3.2.0-39-generic
I'd appriciate any help. Thx.
UPDATE:
When using g++ I get:
g++ -o WebPageCrawler -lawesomium-1-7 -Wall WebPageCrawler.cc
Unable to exec g++.real: No such file or directory
However, on the other machine I used gcc instead of g++ and it works fine there.
UPDATE2:
Okay, now I'm able to get a least the problem of the stdlibs resolved. I did this by further installing:
apt-get install build-essential g++
However, now the awesomium libs are still not found:
/opt/AwesomiumCrawler # g++ -v -o WebPageCrawler -lawesomium-1-7 -Wall WebPageCrawler.cc
Using built-in specs.
COLLECT_GCC=g++.real
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/4.6/lto-wrapper
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Ubuntu/Linaro 4.6.3-1ubuntu5' --with-bugurl=file:///usr/share/doc/gcc-4.6/README.Bugs --enable-languages=c,c++,fortran,objc,obj-c++ --prefix=/usr --program-suffix=-4.6 --enable-shared --enable-linker-build-id --with-system-zlib --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --with-gxx-include-dir=/usr/include/c++/4.6 --libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --enable-gnu-unique-object --enable-plugin --enable-objc-gc --disable-werror --with-arch-32=i686 --with-tune=generic --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu
Thread model: posix
gcc version 4.6.3 (Ubuntu/Linaro 4.6.3-1ubuntu5)
COLLECT_GCC_OPTIONS='-v' '-o' 'WebPageCrawler' '-Wall' '-shared-libgcc' '-mtune=generic' '-march=x86-64'
/usr/lib/gcc/x86_64-linux-gnu/4.6/cc1plus -quiet -v -imultilib . -imultiarch x86_64-linux-gnu -D_GNU_SOURCE WebPageCrawler.cc -quiet -dumpbase WebPageCrawler.cc -mtune=generic -march=x86-64 -auxbase WebPageCrawler -Wall -version -fstack-protector -o /tmp/ccGGfqAI.s
GNU C++ (Ubuntu/Linaro 4.6.3-1ubuntu5) version 4.6.3 (x86_64-linux-gnu)
compiled by GNU C version 4.6.3, GMP version 5.0.2, MPFR version 3.1.0-p3, MPC version 0.9
GGC heuristics: --param ggc-min-expand=98 --param ggc-min-heapsize=127439
ignoring nonexistent directory "/usr/local/include/x86_64-linux-gnu"
ignoring nonexistent directory "/usr/lib/gcc/x86_64-linux-gnu/4.6/../../../../x86_64-linux-gnu/include"
#include "..." search starts here:
#include <...> search starts here:
/usr/include/c++/4.6
/usr/include/c++/4.6/x86_64-linux-gnu/.
/usr/include/c++/4.6/backward
/usr/lib/gcc/x86_64-linux-gnu/4.6/include
/usr/local/include
/usr/lib/gcc/x86_64-linux-gnu/4.6/include-fixed
/usr/include/x86_64-linux-gnu
/usr/include
End of search list.
GNU C++ (Ubuntu/Linaro 4.6.3-1ubuntu5) version 4.6.3 (x86_64-linux-gnu)
compiled by GNU C version 4.6.3, GMP version 5.0.2, MPFR version 3.1.0-p3, MPC version 0.9
GGC heuristics: --param ggc-min-expand=98 --param ggc-min-heapsize=127439
Compiler executable checksum: 65b5171ac1bd7b3f07dbea6bdb24be3d
COLLECT_GCC_OPTIONS='-v' '-o' 'WebPageCrawler' '-Wall' '-shared-libgcc' '-mtune=generic' '-march=x86-64'
as --64 -o /tmp/cctijQGE.o /tmp/ccGGfqAI.s
COMPILER_PATH=/usr/lib/gcc/x86_64-linux-gnu/4.6/:/usr/lib/gcc/x86_64-linux-gnu/4.6/:/usr/lib/gcc/x86_64-linux-gnu/:/usr/lib/gcc/x86_64-linux-gnu/4.6/:/usr/lib/gcc/x86_64-linux-gnu/
LIBRARY_PATH=/usr/lib/gcc/x86_64-linux-gnu/4.6/:/usr/lib/gcc/x86_64-linux-gnu/4.6/../../../x86_64-linux-gnu/:/usr/lib/gcc/x86_64-linux-gnu/4.6/../../../../lib/:/lib/x86_64-linux-gnu/:/lib/../lib/:/usr/lib/x86_64-linux-gnu/:/usr/lib/../lib/:/usr/lib/gcc/x86_64-linux-gnu/4.6/../../../:/lib/:/usr/lib/
COLLECT_GCC_OPTIONS='-v' '-o' 'WebPageCrawler' '-Wall' '-shared-libgcc' '-mtune=generic' '-march=x86-64'
/usr/lib/gcc/x86_64-linux-gnu/4.6/collect2 --sysroot=/ --build-id --no-add-needed --as-needed --eh-frame-hdr -m elf_x86_64 --hash-style=gnu -dynamic-linker /lib64/ld-linux-x86-64.so.2 -z relro -o WebPageCrawler /usr/lib/gcc/x86_64-linux-gnu/4.6/../../../x86_64-linux-gnu/crt1.o /usr/lib/gcc/x86_64-linux-gnu/4.6/../../../x86_64-linux-gnu/crti.o /usr/lib/gcc/x86_64-linux-gnu/4.6/crtbegin.o -L/usr/lib/gcc/x86_64-linux-gnu/4.6 -L/usr/lib/gcc/x86_64-linux-gnu/4.6/../../../x86_64-linux-gnu -L/usr/lib/gcc/x86_64-linux-gnu/4.6/../../../../lib -L/lib/x86_64-linux-gnu -L/lib/../lib -L/usr/lib/x86_64-linux-gnu -L/usr/lib/../lib -L/usr/lib/gcc/x86_64-linux-gnu/4.6/../../.. -lawesomium-1-7 /tmp/cctijQGE.o -lstdc++ -lm -lgcc_s -lgcc -lc -lgcc_s -lgcc /usr/lib/gcc/x86_64-linux-gnu/4.6/crtend.o /usr/lib/gcc/x86_64-linux-gnu/4.6/../../../x86_64-linux-gnu/crtn.o
/tmp/cctijQGE.o: In function `main':
WebPageCrawler.cc:(.text+0x8d): undefined reference to `Awesomium::WebConfig::WebConfig()'
WebPageCrawler.cc:(.text+0xc7): undefined reference to `Awesomium::WebString::operator=(Awesomium::WebString const&)'
WebPageCrawler.cc:(.text+0xd6): undefined reference to `Awesomium::WebString::~WebString()'
WebPageCrawler.cc:(.text+0xe5): undefined reference to `Awesomium::WebCore::Initialize(Awesomium::WebConfig const&)'
WebPageCrawler.cc:(.text+0x140): undefined reference to `Awesomium::WebURL::WebURL(Awesomium::WebString const&)'
WebPageCrawler.cc:(.text+0x14c): undefined reference to `Awesomium::WebString::~WebString()'
WebPageCrawler.cc:(.text+0x1ed): undefined reference to `Awesomium::WebString::CreateFromUTF8(char const*, unsigned int)'
WebPageCrawler.cc:(.text+0x203): undefined reference to `Awesomium::WebString::CreateFromUTF8(char const*, unsigned int)'
WebPageCrawler.cc:(.text+0x23c): undefined reference to `Awesomium::JSValue::ToString() const'
WebPageCrawler.cc:(.text+0x259): undefined reference to `Awesomium::WebString::~WebString()'
WebPageCrawler.cc:(.text+0x27b): undefined reference to `Awesomium::WebCore::Shutdown()'
WebPageCrawler.cc:(.text+0x28c): undefined reference to `Awesomium::JSValue::~JSValue()'
WebPageCrawler.cc:(.text+0x298): undefined reference to `Awesomium::WebString::~WebString()'
WebPageCrawler.cc:(.text+0x2a4): undefined reference to `Awesomium::WebString::~WebString()'
WebPageCrawler.cc:(.text+0x2b0): undefined reference to `Awesomium::WebURL::~WebURL()'
WebPageCrawler.cc:(.text+0x2dd): undefined reference to `Awesomium::WebString::~WebString()'
WebPageCrawler.cc:(.text+0x2ee): undefined reference to `Awesomium::WebString::~WebString()'
WebPageCrawler.cc:(.text+0x2ff): undefined reference to `Awesomium::WebString::~WebString()'
WebPageCrawler.cc:(.text+0x310): undefined reference to `Awesomium::JSValue::~JSValue()'
WebPageCrawler.cc:(.text+0x321): undefined reference to `Awesomium::WebString::~WebString()'
WebPageCrawler.cc:(.text+0x332): undefined reference to `Awesomium::WebString::~WebString()'
WebPageCrawler.cc:(.text+0x343): undefined reference to `Awesomium::WebURL::~WebURL()'
/tmp/cctijQGE.o: In function `Update(int)':
WebPageCrawler.cc:(.text+0x372): undefined reference to `Awesomium::WebCore::instance()'
/tmp/cctijQGE.o: In function `Awesomium::ToString(Awesomium::WebString const&)':
WebPageCrawler.cc:(.text._ZN9Awesomium8ToStringERKNS_9WebStringE[Awesomium::ToString(Awesomium::WebString const&)]+0x25): undefined reference to `Awesomium::WebString::IsEmpty() const'
WebPageCrawler.cc:(.text._ZN9Awesomium8ToStringERKNS_9WebStringE[Awesomium::ToString(Awesomium::WebString const&)]+0x4d): undefined reference to `Awesomium::WebString::ToUTF8(char*, unsigned int) const'
WebPageCrawler.cc:(.text._ZN9Awesomium8ToStringERKNS_9WebStringE[Awesomium::ToString(Awesomium::WebString const&)]+0x75): undefined reference to `Awesomium::WebString::ToUTF8(char*, unsigned int) const'
/tmp/cctijQGE.o: In function `Awesomium::WSLit(char const*)':
WebPageCrawler.cc:(.text._ZN9Awesomium5WSLitEPKc[Awesomium::WSLit(char const*)]+0x2d): undefined reference to `Awesomium::WebString::CreateFromUTF8(char const*, unsigned int)'
/tmp/cctijQGE.o: In function `Awesomium::WebConfig::~WebConfig()':
WebPageCrawler.cc:(.text._ZN9Awesomium9WebConfigD2Ev[_ZN9Awesomium9WebConfigD5Ev]+0x19): undefined reference to `Awesomium::WebStringArray::~WebStringArray()'
WebPageCrawler.cc:(.text._ZN9Awesomium9WebConfigD2Ev[_ZN9Awesomium9WebConfigD5Ev]+0x29): undefined reference to `Awesomium::WebString::~WebString()'
WebPageCrawler.cc:(.text._ZN9Awesomium9WebConfigD2Ev[_ZN9Awesomium9WebConfigD5Ev]+0x39): undefined reference to `Awesomium::WebString::~WebString()'
WebPageCrawler.cc:(.text._ZN9Awesomium9WebConfigD2Ev[_ZN9Awesomium9WebConfigD5Ev]+0x49): undefined reference to `Awesomium::WebString::~WebString()'
WebPageCrawler.cc:(.text._ZN9Awesomium9WebConfigD2Ev[_ZN9Awesomium9WebConfigD5Ev]+0x59): undefined reference to `Awesomium::WebString::~WebString()'
WebPageCrawler.cc:(.text._ZN9Awesomium9WebConfigD2Ev[_ZN9Awesomium9WebConfigD5Ev]+0x69): undefined reference to `Awesomium::WebString::~WebString()'
/tmp/cctijQGE.o:WebPageCrawler.cc:(.text._ZN9Awesomium9WebConfigD2Ev[_ZN9Awesomium9WebConfigD5Ev]+0x79): more undefined references to `Awesomium::WebString::~WebString()' follow
collect2: ld returned 1 exit status
As already mentioned the libs lie in
/usr/lib # ls -l *awe*
-rwxr-xr-x 1 root root 8032 Feb 12 18:49 awesomium_process
lrwxrwxrwx 1 root root 21 Feb 12 18:49 libawesomium-1-7.so -> libawesomium-1-7.so.2
lrwxrwxrwx 1 root root 23 Feb 12 18:49 libawesomium-1-7.so.2 -> libawesomium-1-7.so.2.0
-rwxr-xr-x 1 root root 63475481 Feb 12 18:49 libawesomium-1-7.so.2.0
The command to compile C++ code is g++, not gcc.
They're both part of the same collection, but the g++ command adds some extra options; in particular, it implicitly links the C++ standard library.
When compiling with -c, to generate just an object file and not invoke the linker, it may not matter -- but you're generating an executable, which means the linker needs to know about the dependency on the C++ standard library.
UPDATE: And now that you've updated the question: You may need to install g++ (on your system, apt-get install build-essential g++).
And now you have a different problem: g++ can't find the "awesomium" libraries. The libraries are in /usr/lib, so you shouldn't need to specify a -L option. The problem is that the -l option needs to follow the file that depends on it.
The linker processes its command-line arguments in order, keeping track of which symbols still need to be resolved and resolving any unresolved symbols in objects or libraries that it processes later.
So rather than:
g++ -o WebPageCrawler -lawesomium-1-7 -Wall WebPageCrawler.cc
try:
g++ -Wall WebPageCrawler.cc -lawesomium-1-7 -o WebPageCrawler
That specific order isn't mandatory, but it should work.
i am getting the following linker error when compiling our Qt project.
We do not use qmake. We use autoconf & automake..
Now porting to Mac brings the follwoing error:
I have tried using Qt-SDK and by compiling Qt by myself... Neither worked :(
Maybe somebody has an idea?
/bin/sh ../../libtool --tag=CXX --mode=link clang++ -g -O2 -Wl,-rpath -
Wl,/space/dev-libs/instantclient_10_2 -Wl,-rpath -Wl,/space/dev-libs/boost_1_53/lib -v -o showtime showtime-application_resources.o showtime-main.o cmdline.o ../../atcaf/atcafgui/libatcafgui.la
libtool: link: clang++ -g -O2 -Wl,-rpath -Wl,/space/dev-libs/instantclient_10_2 -Wl,-rpath -Wl,/space/dev-libs/boost_1_53/lib -v -o showtime showtime-application_resources.o showtime-main.o cmdline.o -Wl,-bind_at_load ../../atcaf/atcafgui/.libs/libatcafgui.a -L/usr/local/Qt-5.0.1/lib /usr/local/Qt-5.0.1/lib/libQt5Widgets.dylib /usr/local/Qt-5.0.1/lib/libQt5Gui.dylib /usr/local/Qt-5.0.1/lib/libQt5Sql.dylib /usr/local/Qt-5.0.1/lib/libQt5Xml.dylib /usr/local/Qt-5.0.1/lib/libQt5XmlPatterns.dylib /usr/local/Qt-5.0.1/lib/libQt5Network.dylib /usr/local/Qt-5.0.1/lib/libQt5Core.dylib -L/space/dev-libs/log4cxx-dfs/lib /space/dev-libs/log4cxx-dfs/lib/liblog4cxx.dylib -L/usr/lib -laprutil-1 -lexpat -liconv -lpq -lsqlite3 -lldap -llber -lapr-1 -lpthread -L/space/dev-libs/boost_1_53/lib -lboost_python -lpython2.6 -L/space/dev-libs/instantclient_10_2 -lclntsh -lz
Apple clang version 3.1 (tags/Apple/clang-318.0.58) (based on LLVM 3.1svn)
Target: x86_64-apple-darwin11.4.2
Thread model: posix
"/usr/bin/ld" -demangle -dynamic -arch x86_64 -macosx_version_min 10.7.4 -o showtime -lcrt1.10.6.o -L/usr/local/Qt-5.0.1/lib -L/space/dev-libs/log4cxx-dfs/lib -L/usr/lib -L/space/dev-libs/boost_1_53/lib -L/space/dev-libs/instantclient_10_2 -rpath /space/dev-libs/instantclient_10_2 -rpath /space/dev-libs/boost_1_53/lib showtime-application_resources.o showtime-main.o cmdline.o -bind_at_load ../../atcaf/atcafgui/.libs/libatcafgui.a /usr/local/Qt-5.0.1/lib/libQt5Widgets.dylib /usr/local/Qt-5.0.1/lib/libQt5Gui.dylib /usr/local/Qt-5.0.1/lib/libQt5Sql.dylib /usr/local/Qt-5.0.1/lib/libQt5Xml.dylib /usr/local/Qt-5.0.1/lib/libQt5XmlPatterns.dylib /usr/local/Qt-5.0.1/lib/libQt5Network.dylib /usr/local/Qt-5.0.1/lib/libQt5Core.dylib /space/dev-libs/log4cxx-dfs/lib/liblog4cxx.dylib -laprutil-1 -lexpat -liconv -lpq -lsqlite3 -lldap -llber -lapr-1 -lpthread -lboost_python -lpython2.6 -lclntsh -lz -lstdc++ -lSystem /usr/bin/../lib/clang/3.1/lib/darwin/libclang_rt.osx.a
Undefined symbols for architecture x86_64:
"QApplication::palette()", referenced from:
_main in showtime-main.o
"QApplication::commitData(QSessionManager&)", referenced from:
vtable for Application in libatcafgui.a(libatcafgui_la-Application.o)
"QApplication::saveState(QSessionManager&)", referenced from:
vtable for Application in libatcafgui.a(libatcafgui_la-Application.o)
"QAbstractItemView::dataChanged(QModelIndex const&, QModelIndex const&)", referenced from:
vtable for LogTableWWU in libatcafgui.a(libatcafgui_la-moc_LogTableWWU.o)
"QWidget::styleChange(QStyle&)", referenced from:
I had a similar problem when porting from Qt 4 to Qt 5. There were missing functions for QApplication::commitData() and QApplication::saveState().
I had derived a class from QApplication, in the header file I changed
#include <QtGui/QApplication>
to
#include <QApplication>
and this solved the problem.
I had the same problem, although mine was related to QWidget functions (e.g. QWidget::styleChange(QStyle&) or QWidget::fontChange(QFont const&)) rather than QApplication.
As suggested by koan, I looked for all the occurrences of
#include <QtGui/
in my project and replaced them with
#include <
which solved the problem. I tested this with both clang and g++ versions (5.0.1 and 5.0.2) and they both seem to work.
Note:
A number of solutions found on the web proposed to add
QT += widgets
to the qmake project (.pro) file, as this might be related to an existing bug. While I don't think that adding this is a problem, it did not solve this specific issue.