Compiling wtwithqt example with QtCreator(qmake) - c++

I am working on a network management application with Qt and I chose to use Wt for UI, because with it I will not have to deal with any of web parts (PHP, AJAX, HTML/CSS) and it'll be usable on all platforms.
I successfully managed to compile and run examples using cmake. Although I am used to QtCreator IDE and qmake I would rather use that for development and compiling.
I got stuck trying to compile "wtwithqt" example in QtCreator(qmake). I've been searching everywhere for some guide how to compile it with qmake. However I found nothing helpful.
Here is my .pro file.
testWt.pro
QT += core
QT -= gui
TARGET = helloqt
CONFIG += console no_keywords
CONFIG -=app_bundle
TEMPLATE = app
INCLUDEPATH += lib
LIBS += -lwt -lwthttp -lboost_signals -lboost_system -lboost_regex
QMAKE_CXXFLAGS += -DNDEBUG
HEADERS += \
QtObject.h \
HelloApplication.h
SOURCES += \
hello.cpp \
QtObject.cpp
Compile ouput
13:28:15: Running build steps for project testWt...
13:28:15: Starting: "/usr/bin/make" clean -w
make: Entering directory `/home/nms-development/QtProject/testWt-build-desktop-Qt_4_8_1_in_PATH__System__Debug'
/usr/bin/qmake-qt4 -spec /usr/share/qt4/mkspecs/linux-g++ CONFIG+=debug CONFIG+=declarative_debug -o Makefile ../testWt/testWt.pro
make: Leaving directory `/home/nms-development/QtProject/testWt-build-desktop-Qt_4_8_1_in_PATH__System__Debug'
make: Entering directory `/home/nms-development/QtProject/testWt-build-desktop-Qt_4_8_1_in_PATH__System__Debug'
rm -f moc_QtObject.cpp
rm -f hello.o QtObject.o moc_QtObject.o
rm -f *~ core *.core
make: Leaving directory `/home/nms-development/QtProject/testWt-build-desktop-Qt_4_8_1_in_PATH__System__Debug'
13:28:15: The process "/usr/bin/make" exited normally.
13:28:15: Configuration unchanged, skipping qmake step.
13:28:15: Starting: "/usr/bin/make" -w
make: Entering directory `/home/nms-development/QtProject/testWt-build-desktop-Qt_4_8_1_in_PATH__System__Debug'
g++ -c -pipe -DNDEBUG -g -Wall -W -D_REENTRANT -DQT_WEBKIT -DQT_NO_KEYWORDS -DQT_CORE_LIB -DQT_SHARED -I/usr/share/qt4/mkspecs/linux-g++ -I../testWt -I/usr/include/qt4/QtCore -I/usr/include/qt4 -I../testWt/lib -I. -I../testWt -I. -o hello.o ../testWt/hello.cpp
g++ -c -pipe -DNDEBUG -g -Wall -W -D_REENTRANT -DQT_WEBKIT -DQT_NO_KEYWORDS -DQT_CORE_LIB -DQT_SHARED -I/usr/share/qt4/mkspecs/linux-g++ -I../testWt -I/usr/include/qt4/QtCore -I/usr/include/qt4 -I../testWt/lib -I. -I../testWt -I. -o QtObject.o ../testWt/QtObject.cpp
/usr/bin/moc-qt4 -DQT_WEBKIT -DQT_NO_KEYWORDS -DQT_CORE_LIB -DQT_SHARED -I/usr/share/qt4/mkspecs/linux-g++ -I../testWt -I/usr/include/qt4/QtCore -I/usr/include/qt4 -I../testWt/lib -I. -I../testWt -I. ../testWt/QtObject.h -o moc_QtObject.cpp
g++ -c -pipe -DNDEBUG -g -Wall -W -D_REENTRANT -DQT_WEBKIT -DQT_NO_KEYWORDS -DQT_CORE_LIB -DQT_SHARED -I/usr/share/qt4/mkspecs/linux-g++ -I../testWt -I/usr/include/qt4/QtCore -I/usr/include/qt4 -I../testWt/lib -I. -I../testWt -I. -o moc_QtObject.o moc_QtObject.cpp
g++ -o helloqt hello.o QtObject.o moc_QtObject.o -L/usr/lib/i386-linux-gnu -lwt -lwthttp -lboost_signals -lboost_system -lboost_regex -lQtCore -lpthread
hello.o: In function `HelloApplication':
/home/nms-development/QtProject/testWt-build-desktop-Qt_4_8_1_in_PATH__System__Debug/../testWt/hello.cpp:43: undefined reference to `Wt::WQApplication::WQApplication(Wt::WEnvironment const&, bool)'
hello.o: In function `HelloApplication::propagateGreet()':
/home/nms-development/QtProject/testWt-build-desktop-Qt_4_8_1_in_PATH__System__Debug/../testWt/hello.cpp:87: undefined reference to `Wt::toQString(Wt::WString const&)'
hello.o: In function `HelloApplication::doGreet(QString const&)':
/home/nms-development/QtProject/testWt-build-desktop-Qt_4_8_1_in_PATH__System__Debug/../testWt/hello.cpp:92: undefined reference to `Wt::toWString(QString const&)'
hello.o: In function `~WQApplication':
/home/nms-development/QtProject/testWt-build-desktop-Qt_4_8_1_in_PATH__System__Debug/../testWt/lib/WQApplication:82: undefined reference to `vtable for Wt::WQApplication'
hello.o:(.rodata._ZTV16HelloApplication[vtable for HelloApplication]+0x3c): undefined reference to `Wt::WQApplication::initialize()'
hello.o:(.rodata._ZTV16HelloApplication[vtable for HelloApplication]+0x40): undefined reference to `Wt::WQApplication::finalize()'
hello.o:(.rodata._ZTV16HelloApplication[vtable for HelloApplication]+0x44): undefined reference to `Wt::WQApplication::notify(Wt::WEvent const&)'
hello.o:(.rodata._ZTV16HelloApplication[vtable for HelloApplication]+0x5c): undefined reference to `Wt::WQApplication::realNotify(Wt::WEvent const&)'
hello.o:(.rodata._ZTI16HelloApplication[typeinfo for HelloApplication]+0x8): undefined reference to `typeinfo for Wt::WQApplication'
collect2: ld returned 1 exit status
make: Leaving directory `/home/nms-development/QtProject/testWt-build-desktop-Qt_4_8_1_in_PATH__System__Debug'
make: *** [helloqt] Error 1
13:28:28: The process "/usr/bin/make" exited with code 2.
Error while building project testWt (target: Desktop)
When executing build step 'Make'
Any help is appreciated! Thanks in advance!

Your makefile is pretty much sound, but I think you've forgotten to link the wtwitqt interop layer. Add -lwtwithqt to the LIBS line,

Related

QtTest/QtTest: No such file or directory

I try to perform Qt unit test app from Qt example (.../Qt/Examples/Qt-5.14.2/qtestlib/tutorial1/)
I do:
qmake -o Makefile tutorial1.pro
make
I get:
g++ -c -m64 -pipe -O2 -Wall -W -D_REENTRANT -DQT_NO_DEBUG -DQT_TESTLIB_LIB -DQT_GUI_LIB -DQT_CORE_LIB -I/usr/share/qt4/mkspecs/linux-g++-64 -I. -I/usr/include/qt4/QtCore -I/usr/include/qt4/QtGui -I/usr/include/qt4/QtTest -I/usr/include/qt4 -I. -I. -o testqstring.o testqstring.cpp
testqstring.cpp:52:10: fatal error: QtTest/QtTest: No such file or directory
#include <QtTest/QtTest>
^~~~~~~~~~~~~~~
compilation terminated.
Makefile:205: recipe for target 'testqstring.o' failed
make: *** [testqstring.o] Error 1
What is wrong? I use xubuntu 18.04
Try calling qmake from Qt installation folder with:
<QT-PATH>/Qt/Qt-5.14.2/gcc_64/bin/qmake

Cross compiling linker error

I am cross compiling a small c++ script for Windows on Linux.
It's made with Qt and uses curl, I compiled qt and curl via mxe (make qt5 and make curl).
I then run these commands:
$MXE/usr/i686-w64-mingw32.static/qt5/bin/qmake
make
Which gives me these errors:
release/main.o:main.cpp:(.text.startup+0x4b7): undefined reference to `_imp__curl_easy_init'
release/main.o:main.cpp:(.text.startup+0x6a8): undefined reference to `_imp__curl_easy_setopt'
release/main.o:main.cpp:(.text.startup+0x781): undefined reference to `_imp__curl_easy_perform'
release/main.o:main.cpp:(.text.startup+0x874): undefined reference to `_imp__curl_easy_cleanup'
When I compile it for Linux, there are no errors.
Here is my .pro file:
QT += core
QT -= gui
QT += network
CONFIG += c++11
TARGET = add_feeds
CONFIG += console
CONFIG -= app_bundle
TEMPLATE = app
SOURCES += main.cpp
LIBS += -lcurl
Any help appreciated.
If you need any other info, feel free to ask.
EDIT:
Output of make VERBOSE=1
make -f Makefile.Release
make[1]: Entering directory `/root/compile/add_feeds'
i686-w64-mingw32.static-g++ -c -pipe -fno-keep-inline-dllexport -O2 -std=gnu++0x -frtti -Wall -Wextra -fexceptions -mthreads -DUNICODE -DQT_NO_DEBUG -DQT_NETWORK_LIB -DQT_CORE_LIB -I. -I../mxe/usr/i686-w64-mingw32.static/qt5/include -I../mxe/usr/i686-w64-mingw32.static/qt5/include/QtNetwork -I../mxe/usr/i686-w64-mingw32.static/qt5/include/QtCore -Irelease -I../mxe/usr/i686-w64-mingw32.static/qt5/mkspecs/win32-g++ -o release/main.o main.cpp
i686-w64-mingw32.static-g++ -c -pipe -fno-keep-inline-dllexport -O2 -std=gnu++0x -frtti -Wall -Wextra -fexceptions -mthreads -DUNICODE -DQT_NO_DEBUG -DQT_NETWORK_LIB -DQT_CORE_LIB -I. -I../mxe/usr/i686-w64-mingw32.static/qt5/include -I../mxe/usr/i686-w64-mingw32.static/qt5/include/QtNetwork -I../mxe/usr/i686-w64-mingw32.static/qt5/include/QtCore -Irelease -I../mxe/usr/i686-w64-mingw32.static/qt5/mkspecs/win32-g++ -o release/add_feeds_plugin_import.o add_feeds_plugin_import.cpp
i686-w64-mingw32.static-g++ -Wl,-s -Wl,-subsystem,console -mthreads -o release/add_feeds.exe release/main.o release/add_feeds_plugin_import.o -lcurl -L/root/compile/mxe/usr/i686-w64-mingw32.static/qt5/lib -L/root/compile/mxe/usr/i686-w64-mingw32.static/qt5/plugins/bearer /root/compile/mxe/usr/i686-w64-mingw32.static/qt5/plugins/bearer/libqgenericbearer.a /root/compile/mxe/usr/i686-w64-mingw32.static/qt5/plugins/bearer/libqnativewifibearer.a /root/compile/mxe/usr/i686-w64-mingw32.static/qt5/lib/libQt5Network.a -ldnsapi -liphlpapi -lssl -lcrypto -lgdi32 -lcrypt32 /root/compile/mxe/usr/i686-w64-mingw32.static/qt5/lib/libQt5Core.a -lole32 -luuid -lws2_32 -ladvapi32 -lshell32 -luser32 -lkernel32 -lmpr -lz -lpcre16
release/main.o:main.cpp:(.text.startup+0x4b7): undefined reference to `_imp__curl_easy_init'
release/main.o:main.cpp:(.text.startup+0x6a8): undefined reference to `_imp__curl_easy_setopt'
release/main.o:main.cpp:(.text.startup+0x781): undefined reference to `_imp__curl_easy_perform'
release/main.o:main.cpp:(.text.startup+0x874): undefined reference to `_imp__curl_easy_cleanup'
collect2: error: ld returned 1 exit status
make[1]: *** [release/add_feeds.exe] Error 1
make[1]: Leaving directory `/root/compile/add_feeds'
make: *** [release] Error 2
This problem comes from QT, when static compiling it.
Which QT Version do you have?QT Static compile bug report with Qt 5.13.0
I filed this bug report which had similar call to requqested functions.

Issue with arm and x86 in blackberry10 wikitude app

I am working on a Blackberry 10 app using wikitude SDK. I am using the documentation on the website and adding the libraries to the project . When the project is built , I am getting an error with "ntox86-ld" . I am new to this and cannot debug the error. The error is:
19:53:36 **** Build of configuration Simulator-Debug for project ARCascadesProject ****
make -j4 Simulator-Debug
make -C .//translations -f Makefile update
cd x86 && D:/bbndk/host_10_2_0_15/win32/x86/usr/bin/qmake -spec blackberry-x86-qcc ../ARCascadesProject.pro CONFIG+=debug_and_release CONFIG+=simulator
make[1]: Entering directory `D:/BB_10_Workspace/ARCascadesProject/translations'
D:/bbndk/host_10_2_0_15/win32/x86/usr/bin/lupdate ARCascadesProject.pro
Updating 'ARCascadesProject.ts'...
Found 1 source text(s) (0 new and 1 already existing)
make[1]: Leaving directory `D:/BB_10_Workspace/ARCascadesProject/translations'
make -C .//translations -f Makefile release
make[1]: Entering directory `D:/BB_10_Workspace/ARCascadesProject/translations'
D:/bbndk/host_10_2_0_15/win32/x86/usr/bin/lrelease ARCascadesProject.pro
Updating 'D:/BB_10_Workspace/ARCascadesProject/translations/ARCascadesProject.qm'...
Generated 0 translation(s) (0 finished and 0 unfinished)
Ignored 1 untranslated source text(s)
make[1]: Leaving directory `D:/BB_10_Workspace/ARCascadesProject/translations'
make -C ./x86 -f Makefile debug
make[1]: Entering directory `D:/BB_10_Workspace/ARCascadesProject/x86'
make -f Makefile.Debug
make[2]: Entering directory `D:/BB_10_Workspace/ARCascadesProject/x86'
D:/bbndk/host_10_2_0_15/win32/x86/usr/bin/moc.exe -DQT_NO_IMPORT_QT47_QML -DQ_OS_BLACKBERRY -DQT_DECLARATIVE_DEBUG -DQT_DECLARATIVE_LIB -DQT_CORE_LIB -DQT_SHARED -I../../../bbndk/target_10_2_0_1155/qnx6/usr/share/qt4/mkspecs/blackberry-x86-qcc -I../../ARCascadesProject -I../../../bbndk/target_10_2_0_1155/qnx6/usr/include/qt4/QtCore -I../../../bbndk/target_10_2_0_1155/qnx6/usr/include/qt4/QtDeclarative -I../../../bbndk/target_10_2_0_1155/qnx6/usr/include/qt4 -I../src -Io-g/.moc -I../../../bbndk/target_10_2_0_1155/qnx6/usr/include -I../../../bbndk/target_10_2_0_1155/qnx6/usr/include/freetype2 -I. -D__QNXNTO__ ../src/applicationui.hpp -o o-g/.moc/moc_applicationui.cpp
qcc -Vgcc_ntox86 -Wno-psabi -lang-c++ -fstack-protector -fstack-protector-all -g -Wno-psabi -Wall -W -D_REENTRANT -DQT_NO_IMPORT_QT47_QML -DQ_OS_BLACKBERRY -DQT_DECLARATIVE_DEBUG -DQT_DECLARATIVE_LIB -DQT_CORE_LIB -DQT_SHARED -I../../../bbndk/target_10_2_0_1155/qnx6/usr/share/qt4/mkspecs/blackberry-x86-qcc -I../../ARCascadesProject -I../../../bbndk/target_10_2_0_1155/qnx6/usr/include/qt4/QtCore -I../../../bbndk/target_10_2_0_1155/qnx6/usr/include/qt4/QtDeclarative -I../../../bbndk/target_10_2_0_1155/qnx6/usr/include/qt4 -I../src -Io-g/.moc -I../../../bbndk/target_10_2_0_1155/qnx6/usr/include -I../../../bbndk/target_10_2_0_1155/qnx6/usr/include/freetype2 -I. -x c++-header -c ../precompiled.h -o o-g/.obj/ARCascadesProject.gch/c++
qcc -Vgcc_ntox86 -c -Wc,-include -Wc,o-g/.obj/ARCascadesProject -Wno-psabi -lang-c++ -fstack-protector -fstack-protector-all -g -Wno-psabi -Wall -W -D_REENTRANT -DQT_NO_IMPORT_QT47_QML -DQ_OS_BLACKBERRY -DQT_DECLARATIVE_DEBUG -DQT_DECLARATIVE_LIB -DQT_CORE_LIB -DQT_SHARED -I../../../bbndk/target_10_2_0_1155/qnx6/usr/share/qt4/mkspecs/blackberry-x86-qcc -I../../ARCascadesProject -I../../../bbndk/target_10_2_0_1155/qnx6/usr/include/qt4/QtCore -I../../../bbndk/target_10_2_0_1155/qnx6/usr/include/qt4/QtDeclarative -I../../../bbndk/target_10_2_0_1155/qnx6/usr/include/qt4 -I../src -Io-g/.moc -I../../../bbndk/target_10_2_0_1155/qnx6/usr/include -I../../../bbndk/target_10_2_0_1155/qnx6/usr/include/freetype2 -I. -o o-g/.obj/applicationui.o ../src/applicationui.cpp
qcc -Vgcc_ntox86 -c -Wc,-include -Wc,o-g/.obj/ARCascadesProject -Wno-psabi -lang-c++ -fstack-protector -fstack-protector-all -g -Wno-psabi -Wall -W -D_REENTRANT -DQT_NO_IMPORT_QT47_QML -DQ_OS_BLACKBERRY -DQT_DECLARATIVE_DEBUG -DQT_DECLARATIVE_LIB -DQT_CORE_LIB -DQT_SHARED -I../../../bbndk/target_10_2_0_1155/qnx6/usr/share/qt4/mkspecs/blackberry-x86-qcc -I../../ARCascadesProject -I../../../bbndk/target_10_2_0_1155/qnx6/usr/include/qt4/QtCore -I../../../bbndk/target_10_2_0_1155/qnx6/usr/include/qt4/QtDeclarative -I../../../bbndk/target_10_2_0_1155/qnx6/usr/include/qt4 -I../src -Io-g/.moc -I../../../bbndk/target_10_2_0_1155/qnx6/usr/include -I../../../bbndk/target_10_2_0_1155/qnx6/usr/include/freetype2 -I. -o o-g/.obj/main.o ../src/main.cpp
qcc -Vgcc_ntox86 -c -Wc,-include -Wc,o-g/.obj/ARCascadesProject -Wno-psabi -lang-c++ -fstack-protector -fstack-protector-all -g -Wno-psabi -Wall -W -D_REENTRANT -DQT_NO_IMPORT_QT47_QML -DQ_OS_BLACKBERRY -DQT_DECLARATIVE_DEBUG -DQT_DECLARATIVE_LIB -DQT_CORE_LIB -DQT_SHARED -I../../../bbndk/target_10_2_0_1155/qnx6/usr/share/qt4/mkspecs/blackberry-x86-qcc -I../../ARCascadesProject -I../../../bbndk/target_10_2_0_1155/qnx6/usr/include/qt4/QtCore -I../../../bbndk/target_10_2_0_1155/qnx6/usr/include/qt4/QtDeclarative -I../../../bbndk/target_10_2_0_1155/qnx6/usr/include/qt4 -I../src -Io-g/.moc -I../../../bbndk/target_10_2_0_1155/qnx6/usr/include -I../../../bbndk/target_10_2_0_1155/qnx6/usr/include/freetype2 -I. -o o-g/.obj/moc_applicationui.o o-g/.moc/moc_applicationui.cpp
qcc -Vgcc_ntox86 -lang-c++ -Wl,-rpath-link,D:/bbndk/target_10_2_0_1155/qnx6/x86/lib -Wl,-rpath-link,D:/bbndk/target_10_2_0_1155/qnx6/x86/usr/lib -Wl,-rpath-link,D:/bbndk/target_10_2_0_1155/qnx6/x86/usr/lib/qt4/lib -o o-g/ARCascadesProject o-g/.obj/applicationui.o o-g/.obj/main.o o-g/.obj/moc_applicationui.o -LD:/bbndk/target_10_2_0_1155/qnx6/x86/lib -LD:/bbndk/target_10_2_0_1155/qnx6/x86/usr/lib -LD:/bbndk/target_10_2_0_1155/qnx6/x86/usr/lib/qt4/lib -LD:/bbndk/target_10_2_0_1155/qnx6//usr/lib/qt4/lib -L../Library/lib -lARchitectSDK -lARchitectLibrary -lgameplay -lscreen -lEGL -lGLESv2 -limg -lcrypto -lbbdevice -lcamapi -lfreetype -lmmrndclient -lpng -lbbdata -lwmm -lbb -lbbsystem -lbbcascades -lQtDeclarative -lQtScript -lQtSvg -lQtSql -lsqlite3 -lz -lQtXmlPatterns -lQtGui -lQtNetwork -lsocket -lQtCore -lm -lbps
D:\bbndk\host_10_2_0_15\win32\x86\usr\bin\ntox86-ld: skipping incompatible ../Library/lib\libARchitectSDK.a when searching for -lARchitectSDK
D:\bbndk\host_10_2_0_15\win32\x86\usr\bin\ntox86-ld: cannot find -lARchitectSDK
D:\bbndk\host_10_2_0_15\win32\x86\usr\bin\ntox86-ld: skipping incompatible ../Library/lib\libARchitectLibrary.a when searching for -lARchitectLibrary
D :\bbndk\host_10_2_0_15\win32\x86\usr\bin\ntox86-ld: cannot find -lARchitectLibrary
D:\bbndk\host_10_2_0_15\win32\x86\usr\bin\ntox86-ld: skipping incompatible ../Library/lib\libgameplay.a when searching for -lgameplay
D:\bbndk\host_10_2_0_15\win32\x86\usr\bin\ntox86-ld: cannot find -lgameplay
cc: D:/bbndk/host_10_2_0_15/win32/x86/usr/bin/ntox86-ld caught signal 5
make[2]: *** [o-g/ARCascadesProject] Error 1
make[2]: Leaving directory `D:/BB_10_Workspace/ARCascadesProject/x86'
make[1]: *** [debug] Error 2
make[1]: Leaving directory `D:/BB_10_Workspace/ARCascadesProject/x86'
make: *** [Simulator-Debug] Error 2
19:54:02 Build Finished (took 25s.979ms)
please look into the issue . I am new to this technology I am trying to implement Augmented Reality in bb10 using wikitude , please help I am stuck here?
You are building the target "Simulator-Debug" which is not supported by Wikitude SDK. You will need to build for a device. Change the "Build configuration" under Debug/Run Configurations to "Device-Debug" or "Device-Release".

Cannot find -lperl doing a makefile on c++

sorry about my bad english...
Well, I'm now to linux, perl and c++, but I have to do some codes for the university and I'm getting some troubles while doing the makefile.
I have a code in perl which is running perfectly. As well, I have a code in C++ that calls perl as a subroutine. Everything is working properly, but when I do the makefile on my computer, it says:
sathlervbn Spam C # make clean; make
rm -f *.o
g++ -Wall -D_REENTRANT -D_GNU_SOURCE -DDEBIAN -fstack-protector -fno-strict-aliasing -pipe -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -I/usr/lib/perl/5.14/CORE -c -o main.o main.cpp
g++ -L/usr/lib -Wall -Wl,-E -fstack-protector -L/usr/local/lib -L/usr/lib/perl/5.14/CORE - lperl -ldl -lm -lpthread -lc -lcrypt -o main libSpam.a main.o
/usr/bin/ld: cannot find -lperl
collect2: error: ld returned 1 exit status
make: *** [main] Error 1
The problem is that when I run the makefile in my professor's computer, it's works...
Here is the code of makefile:
#CC= /usr/bin/g++
CPP = g++
CPPFLAGS = -Wall $(shell perl -MExtUtils::Embed -e ccopts)
#LD= /usr/bin/g++
LD = g++
#LFLAGS = -Wall $(shell perl -MExtUtils::Embed -e ldopts)
LFLAGS = -Wall -Wl,-E -fstack-protector -L/usr/local/lib -L/usr/lib/perl/5.14/CORE - lperl -ldl -lm -lpthread -lc -lcrypt
MAINOBJS = libSpam.a main.o
EMAILS = main
EXECS = $(EMAILS)
#Regra Implicita:
.c.o:
$(CPP) $(CPPFLAGS) -c $<
all: emails
emails: $(EMAILS)
main: $(MAINOBJS)
$(LD) -L/usr/lib $(LFLAGS) -o $# $(MAINOBJS)
clean:
rm -f *.o
Does anyone know how to solve it?
You need to install the perl library for C. If you're on a Debian based system (including Ubuntu) sudo apt-get install libperl-dev or something similar may be sufficient, depending on which version of perl you're using.
Update: ok, this is a bit strange - I've installed perl-base, and it installed /usr/lib/libperl.so.5.14 but it did not make a /usr/lib/libperl.so symlink as you'd expect. I wonder why not? If I manually create the symlink with ln -s /usr/lib/libperl.so.5.14 /usr/lib/libperl.so it links correctly.
Update the second I had perl-base installed, but not libperl-dev which gave me /usr/lib/libperl.so.5.14 but not /usr/lib/libperl.so. I suspect (don't know for sure, but strongly suspect) that the correct answer isn't to manually make the symlink, but to install libperl-dev.

undefined reference when linking against libresolv

I have a project that is a library that links against libresolv,
It works fine on recent distros: Ubuntu 10.x Fedora 13, Mandriva
2010.1 but on Centos 5.x I get the following errors
glibc installed is: glibc-2.5-18.el5_1.1
g++ -DHAVE_CONFIG_H -I. -I./include -I/usr/include/postgresql -O3
-ansi -Wall -Wno-deprecated -D_FORTIFY_SOURCE=0 -MT testUpLog.o -MD
-MP -MF .deps/testUpLog.Tpo -c -o testUpLog.o testUpLog.cc
mv -f .deps/testUpLog.Tpo .deps/testUpLog.Po
/bin/sh ./libtool --tag=CXX --mode=link g++ -O3 -ansi -Wall
-Wno-deprecated -D_FORTIFY_SOURCE=0 -L/usr/lib64 -L/lib64
-L/usr/lib64/mysql -o testUpLog testUpLog.o libUpTools.la -lpq
-lmysqlclient -lssl -lpthread
libtool: link: g++ -O3 -ansi -Wall -Wno-deprecated -D_FORTIFY_SOURCE=0
-o .libs/testUpLog testUpLog.o -L/usr/lib64 -L/lib64
-L/usr/lib64/mysql ./.libs/libUpTools.so -lpq -lmysqlclient -lssl
-lpthread
./.libs/libUpTools.so: undefined reference to `__ns_name_uncompress'
./.libs/libUpTools.so: undefined reference to `__ns_initparse'
./.libs/libUpTools.so: undefined reference to `__ns_parserr'
collect2: ld returned 1 exit status
make[1]: *** [testUpLog] Error 1
make[1]: Leaving directory `/tmp/UpTools-8.5.3'
make: *** [check-am] Error 2
library.la file contains:
dlname='libUpTools.so.0'
library_names='libUpTools.so.0.0.0 libUpTools.so.0 libUpTools.so'
old_library='libUpTools.a'
inherited_linker_flags=''
dependency_libs=' -L/usr/lib64 -L/lib64 -L/usr/lib64/mysql -lpq
-lmysqlclient -lssl -lpthread'
weak_library_names=''
current=0
age=0
revision=0
installed=no
shouldnotlink=no
dlopen=''
dlpreopen=''
libdir='/usr/lib'
You can read configure.ac on
http://pastebin.com/hs5q21Rq
Thanks in advance
If libUpTools uses functions lib libresolv, you need to say so:
libUpTools_la_LIBADD = -lresolv (of course -lresolv may be replaced by variables determined by configure etc.)
That way, -lresolv will end up in the .la file and also in the .so file (if you chose to build it) that you can run ldd on for verification.