I am trying to write a softphone using qt. And many forums and resources, including stackoverflow, suggest to use pjsip libraries. So I decided to follow this advice and use it.
First, to be clear about my post here, my OS is linux (KUbuntu to be percise), and I am using Qt 5.4.1 and Qt Creator 3.3.2.
Also, I built pjsip static libraries using instructions on their website here: http://trac.pjsip.org/repos/wiki/Getting-Started/Autoconf.
And I have some troubles linking pjsip static libraries using qt. I've searched about this problem and didn't find the answer neither on this site nor anywhere. There are some topics on the forums but no one gives an answer to it.
Here is my qt .pro file:
TEMPLATE = app
QT += qml quick widgets
SOURCES += main.cpp
RESOURCES += qml.qrc
INCLUDEPATH += $$_PRO_FILE_PWD_/pjsip_headers
LIBS += -L$$_PRO_FILE_PWD_/pjsip_libs
linux-g++-64:LIBS += -lpjsua-x86_64-unknown-linux.gnu \
-lpjsip-ua-x86_64-unknown-linux.gnu\
-lpjsip-simple-x86_64-unknown-linux.gnu \
-lpjsip-x86_64-unknown-linux.gnu \
-lpjmedia-codec-x86_64-unknown-linux.gnu \
-lpjmedia-x86_64-unknown-linux.gnu \
-lpjmedia-codec-x86_64-unknown-linux.gnu \
-lpjmedia-audiodev-x86_64-unknown-linux.gnu \
-lpjmedia-videodev-x86_64-unknown-linux.gnu \
-lpjnath-x86_64-unknown-linux.gnu \
-lpjlib-util-x86_64-unknown-linux.gnu \
-lpj-x86_64-unknown-linux.gnu \
-lportaudio-x86_64-unknown-linux.gnu \
-lgsmcodec-x86_64-unknown-linux.gnu \
-lilbccodec-x86_64-unknown-linux.gnu \
-lspeex-x86_64-unknown-linux.gnu \
-lresample-x86_64-unknown-linux.gnu \
-lsrtp-x86_64-unknown-linux.gnu \
-lg7221codec-x86_64-unknown-linux.gnu \
-lopenh264 \
-lpjsua2-x86_64-unknown-linux.gnu
QML_IMPORT_PATH =
include(deployment.pri)
And here is the problem: when I try to build my project with this .pro file above, everything is OK until i try to use some function or an object of any class in this library. And if I do so, I get many undefined reference errors.
Pjsip manual says only about how to build your own application with this library by using GNU tools here: http://trac.pjsip.org/repos/wiki/Getting_Started_Using. But it involves editing Makefile, which is autogenerated by qmake in qt.
I just stuck with this problem and I don't know what else I can do about it. I read about linking order of this library while including it in your qt .pro file, but I tried many combinations and it didn't help.
Also, I read that it might be necessary to use QMAKE variables to set CFLAGS and LDFLAGS in qt .pro file according to pjsip instructions of how to build your own application using GNU tools.
And I even downloaded qt projects, which use pjsip libraries, for example, QjSimple, but I didn't find anything new in their qt .pro file settings.
Here is their qt .pro file:
DEFINES -= UNICODE
TEMPLATE = app
TARGET = QjSimple
QT += core \
gui \
xml \
network
HEADERS += buddy.h \
PjCallback.h \
accountdialog.h \
debugdialog.h \
addbuddydialog.h \
imwidget.h \
qjsimple.h
SOURCES += buddy.cpp \
PjCallback.cpp \
accountdialog.cpp \
debugdialog.cpp \
addbuddydialog.cpp \
imwidget.cpp \
main.cpp \
qjsimple.cpp
FORMS += accountdialog.ui \
debugdialog.ui \
addbuddydialog.ui \
imwidget.ui \
qjsimple.ui
RESOURCES += icons.qrc
win32-g++:RC_FILE = appicon.rc
INCLUDEPATH += ../pjproject-1.8.10/pjlib/include \
../pjproject-1.8.10/pjlib-util/include \
../pjproject-1.8.10/pjnath/include \
../pjproject-1.8.10/pjmedia/include \
../pjproject-1.8.10/pjsip/include
LIBS += -L../pjproject-1.8.10/pjlib/lib \
-L../pjproject-1.8.10/pjlib-util/lib \
-L../pjproject-1.8.10/pjnath/lib \
-L../pjproject-1.8.10/pjmedia/lib \
-L../pjproject-1.8.10/pjsip/lib \
-L../pjproject-1.8.10/third_party/lib
# INCLUDEPATH += ../pjproject-1.5.5/pjlib/include \
# ../pjproject-1.5.5/pjlib-util/include \
# ../pjproject-1.5.5/pjnath/include \
# ../pjproject-1.5.5/pjmedia/include \
# ../pjproject-1.5.5/pjsip/include
# LIBS += -L../pjproject-1.5.5/pjlib/lib \
# -L../pjproject-1.5.5/pjlib-util/lib \
# -L../pjproject-1.5.5/pjnath/lib \
# -L../pjproject-1.5.5/pjmedia/lib \
# -L../pjproject-1.5.5/pjsip/lib \
# -L../pjproject-1.5.5/third_party/lib
# INCLUDEPATH += ../pjproject-1.4/pjlib/include \
# ../pjproject-1.4/pjlib-util/include \
# ../pjproject-1.4/pjnath/include \
# ../pjproject-1.4/pjmedia/include \
# ../pjproject-1.4/pjsip/include
# LIBS += -L../pjproject-1.4/pjlib/lib \
# -L../pjproject-1.4/pjlib-util/lib \
# -L../pjproject-1.4/pjnath/lib \
# -L../pjproject-1.4/pjmedia/lib \
# -L../pjproject-1.4/pjsip/lib \
# -L../pjproject-1.4/third_party/lib
# win32-g++:LIBS += -L../openssl-0.9.8g
win32-g++:LIBS += -L../OpenSSL/lib/mingw
win32-g++:LIBS += -lpjsua-i686-pc-mingw32 \
-lpjsip-ua-i686-pc-mingw32 \
-lpjsip-simple-i686-pc-mingw32 \
-lpjsip-i686-pc-mingw32 \
-lpjmedia-codec-i686-pc-mingw32 \
-lpjmedia-i686-pc-mingw32 \
-lpjmedia-codec-i686-pc-mingw32 \
-lpjmedia-audiodev-i686-pc-mingw32 \
-lpjnath-i686-pc-mingw32 \
-lpjlib-util-i686-pc-mingw32 \
-lpj-i686-pc-mingw32 \
-lportaudio-i686-pc-mingw32 \
-lgsmcodec-i686-pc-mingw32 \
-lilbccodec-i686-pc-mingw32 \
-lspeex-i686-pc-mingw32 \
-lresample-i686-pc-mingw32 \
-lmilenage-i686-pc-mingw32 \
-lsrtp-i686-pc-mingw32 \
-lm \
-lwinmm \
-lole32 \
-lws2_32 \
-lwsock32 \
-lssl \
-lcrypto \
-lgdi32
linux-g++:LIBS += -lpjsua-i686-pc-linux-gnu \
-lpjsip-ua-i686-pc-linux-gnu \
-lpjsip-simple-i686-pc-linux-gnu \
-lpjsip-i686-pc-linux-gnu \
-lpjmedia-codec-i686-pc-linux-gnu \
-lpjmedia-i686-pc-linux-gnu \
-lpjmedia-codec-i686-pc-linux-gnu \
-lpjmedia-audiodev-i686-pc-linux-gnu \
-lpjnath-i686-pc-linux-gnu \
-lpjlib-util-i686-pc-linux-gnu \
-lpj-i686-pc-linux-gnu \
-lportaudio-i686-pc-linux-gnu \
-lgsmcodec-i686-pc-linux-gnu \
-lilbccodec-i686-pc-linux-gnu \
-lspeex-i686-pc-linux-gnu \
-lresample-i686-pc-linux-gnu \
-lmilenage-i686-pc-linux-gnu \
-lsrtp-i686-pc-linux-gnu \
-lm \
-lpthread \
-lssl \
-lasound \
-luuid
linux-g++-64:LIBS += -lpjsua-x86_64-unknown-linux-gnu \
-lpjsip-ua-x86_64-unknown-linux-gnu \
-lpjsip-simple-x86_64-unknown-linux-gnu \
-lpjsip-x86_64-unknown-linux-gnu \
-lpjmedia-codec-x86_64-unknown-linux-gnu \
-lpjmedia-x86_64-unknown-linux-gnu \
-lpjmedia-codec-x86_64-unknown-linux-gnu \
-lpjmedia-audiodev-x86_64-unknown-linux-gnu \
-lpjnath-x86_64-unknown-linux-gnu \
-lpjlib-util-x86_64-unknown-linux-gnu \
-lpj-x86_64-unknown-linux-gnu \
-lportaudio-x86_64-unknown-linux-gnu \
-lgsmcodec-x86_64-unknown-linux-gnu \
-lilbccodec-x86_64-unknown-linux-gnu \
-lspeex-x86_64-unknown-linux-gnu \
-lresample-x86_64-unknown-linux-gnu \
-lmilenage-x86_64-unknown-linux-gnu \
-lsrtp-x86_64-unknown-linux-gnu \
-lm \
-lpthread \
-lssl \
-lasound \
-luuid
macx-g++:LIBS += -lpjsua-i386-apple-darwin9.7.1 \
-lpjsip-ua-i386-apple-darwin9.7.1 \
-lpjsip-simple-i386-apple-darwin9.7.1 \
-lpjsip-i386-apple-darwin9.7.1 \
-lpjmedia-i386-apple-darwin9.7.1 \
-lpjmedia-i386-apple-darwin9.7.1 \
-lpjmedia-codec-i386-apple-darwin9.7.1 \
-lpjmedia-audiodev-i386-apple-darwin9.7.1 \
-lpjnath-i386-apple-darwin9.7.1 \
-lpjlib-util-i386-apple-darwin9.7.1 \
-lpj-i386-apple-darwin9.7.1 \
-lportaudio-i386-apple-darwin9.7.1 \
-lgsmcodec-i386-apple-darwin9.7.1 \
-lilbccodec-i386-apple-darwin9.7.1 \
-lspeex-i386-apple-darwin9.7.1 \
-lresample-i386-apple-darwin9.7.1 \
-lmilenage-i386-apple-darwin9.7.1 \
-lsrtp-i386-apple-darwin9.7.1 \
-lm \
-lpthread \
-lssl \
-lcrypto \
-framework \
CoreAudio \
-framework \
AudioToolbox \
-framework \
AudioUnit
OTHER_FILES += Changelog
There is nothing new in their .pro file.
So I just don't know where to find the solution. I hope I gave enough information. And as I mentioned above, I didn't find anyting useful about this problem.
Maybe there is another way to build a softphone by using qt, but as I found out pjsip library is one of the best decisions to do that. Any information would be appreciated.
Related
I'm working with an Haptic Device (" Phantom Omni"), and i'm creating a GUI, this gui has some headers and source files from the haptic device. I've already included them, but I have also include the libraries. I've tried all the several ways that I found on internet, but when I try to build the project it returns me error about LNK 2019 and LNK 2001.
I've checked also the Makefile that the qMake generates, and into this file there are the paths and libraries that i would to add, but I don't know why, I have always the some error.
The .pro file:
#LIBS += -L"C:\\Folder\\Folder2\\LibFolder" -lextlib.lib
QT += core gui
CONFIG += console
QT += gui
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
TARGET = GUI_TeleManipulation
TEMPLATE = app
SOURCES += main.cpp\
gui_telemanipulation.cpp \
debug/moc_gui_telemanipulation.cpp \
src/Client.cpp \
src/PHANToM.cpp \
src/HDU/src/hdu.cpp \
src/HDU/src/hduAfx.cpp \
src/HDU/src/hduDecompose.cpp \
src/HDU/src/hduError.cpp \
src/HDU/src/hduHapticDevice.cpp \
src/HDU/src/hduLine.cpp \
src/HDU/src/hduLineSegment.cpp \
src/HDU/src/hduMatrix.cpp \
src/HDU/src/hduPlane.cpp \
src/HDU/src/hduQuaternion.cpp \
src/HDU/src/hduRecord.cpp \
src/hd.cpp
HEADERS += gui_telemanipulation.h \
ui_gui_telemanipulation.h \
include/Client.hpp \
include/matrix.h \
include/Packet.hpp \
include/PHANToM.h \
include/HD/hd.h \
include/HD/hdCompilerConfig.h \
include/HD/hdDefines.h \
include/HD/hdDevice.h \
include/HD/hdExport.h \
include/HD/hdScheduler.h \
include/HDU/hdu.h \
include/HDU/hduBoundBox.h \
include/HDU/hduError.h \
include/HDU/hduGenericMatrix.h \
include/HDU/hduHapticDevice.h \
include/HDU/hduLine.h \
include/HDU/hduLineSegment.h \
include/HDU/hduMath.h \
include/HDU/hduMatrix.h \
include/HDU/hduPlane.h \
include/HDU/hduQuaternion.h \
include/HDU/hduRecord.h \
include/HDU/hduVector.h \
src/HDU/src/hduAfx.h \
src/HDU/src/hduDecompose.h
FORMS += gui_telemanipulation.ui
#LIBS += -L"C:\\Folder\\Folder2\\LibFolder" -lextlib.lib
LIBS += -L"lib/" -lhd
LIBS += -L"lib/" -lhdu
With static libraries, you should be able to use simply this:
LIBS += "C:/Folder/Folder2/LibFolder/extlib.lib"
This is assuming you are doing Windows-only project. Read the docs for more.
I'm trying to link ffmpeg as static libraries with android NDK but I'm getting 'multiple definition' error' errors as below. I've also included my build script which runs through everything just fine but when I come to using the libraries in Eclipse with the ADT plugin, I can't get anywhere.
From this it looks like it wants something to do with VLC. I don't want anything to do with VLC, just ffmpeg for video streaming. Everything works fine with shared libraries, but I'm after a very tiny player because I'm restricted to space on the device.
EDIT: Also 'log2_tab_tab.o' has multiple definitions.
error: jni/libs\libavcodec.a(golomb.o): multiple definition of 'ff_golomb_vlc_len' Ffplayer C/C++ Problem
error: jni/libs\libavcodec.a(golomb.o): multiple definition of 'ff_interleaved_dirac_golomb_vlc_code' Ffplayer C/C++ Problem
error: jni/libs\libavcodec.a(golomb.o): multiple definition of 'ff_interleaved_golomb_vlc_len' Ffplayer C/C++ Problem
error: jni/libs\libavcodec.a(golomb.o): multiple definition of 'ff_interleaved_se_golomb_vlc_code' Ffplayer C/C++ Problem
error: jni/libs\libavcodec.a(golomb.o): multiple definition of 'ff_interleaved_ue_golomb_vlc_code' Ffplayer C/C++ Problem
error: jni/libs\libavcodec.a(golomb.o): multiple definition of 'ff_se_golomb_vlc_code' Ffplayer C/C++ Problem
error: jni/libs\libavcodec.a(golomb.o): multiple definition of 'ff_ue_golomb_len' Ffplayer C/C++ Problem
error: jni/libs\libavcodec.a(golomb.o): multiple definition of 'ff_ue_golomb_vlc_code' Ffplayer C/C++ Problem
error: jni/libs\libavcodec.a(log2_tab.o): multiple definition of 'ff_log2_tab' Ffplayer C/C++ Problem
error: jni/libs\libavformat.a(log2_tab.o): multiple definition of 'ff_log2_tab' Ffplayer C/C++ Problem
jni/libs\libavformat.a(golomb_tab.o): previous definition here Ffplayer C/C++ Problem
jni/libs\libavutil.a(log2_tab.o): previous definition here Ffplayer C/C++ Problem
make.exe: *** [obj/local/armeabi-v7a-hard/libffplayer.so] Error 1 Ffplayer C/C++ Problem
Using the latest branch of ffmpeg (2.4.3) my build script for Android (using toolchain 8 because it's old hardware I'm working with) and wanting the NEON hardware support:
export ANDROID_NDK=/home/carl/dev/ndk
export TOOLCHAIN=/home/carl/temp/ffmpeg
export SYSROOT=$TOOLCHAIN/sysroot/
$ANDROID_NDK/build/tools/make-standalone-toolchain.sh \
--platform=android-8 --install-dir=$TOOLCHAIN
export PATH=$TOOLCHAIN/bin:$PATH
export CC=arm-linux-androideabi-gcc
export LD=arm-linux-androideabi-ld
export AR=arm-linux-androideabi-ar
CFLAGS="-O3 -Wall -mthumb -pipe -fpic -fasm \
-finline-limit=300 -ffast-math \
-fstrict-aliasing -Werror=strict-aliasing \
-fmodulo-sched -fmodulo-sched-allow-regmoves \
-Werror=implicit-function-declaration \
-Wno-psabi -Wa,--noexecstack"
# -D__ARM_ARCH_5__ -D__ARM_ARCH_5E__ \
# -D__ARM_ARCH_5T__ -D__ARM_ARCH_5TE__ \
# -DANDROID -DNDEBUG"
EXTRA_CFLAGS="-march=armv7-a -mfpu=neon \
-mfloat-abi=softfp -mvectorize-with-neon-quad \
-DHAVE_ISNAN -DHAVE_ISINF
-std=c99"
EXTRA_LDFLAGS="-Wl,--fix-cortex-a8"
FFMPEG_FLAGS="--prefix=/home/dev/ffmpeg/build \
--target-os=linux \
--arch=arm \
--enable-cross-compile \
--cross-prefix=arm-linux-androideabi- \
--enable-shared \
--enable-static \
--enable-small \
--disable-symver \
--disable-doc \
--disable-ffplay \
--disable-ffmpeg \
--disable-ffprobe \
--disable-ffserver \
--disable-avdevice \
--disable-avfilter \
--disable-encoders \
--disable-muxers \
--disable-demuxers \
--disable-filters \
--disable-devices \
--disable-decoders \
--enable-decoder=mjpeg \
--enable-decoder=mp1 \
--enable-decoder=mp2 \
--enable-decoder=mp3 \
--enable-decoder=mpeg1_vdpau \
--enable-decoder=mpeg1video \
--enable-decoder=mpeg2video \
--enable-decoder=mpeg4 \
--enable-decoder=mpeg4_vdpau \
--enable-decoder=mpegvideo \
--enable-decoder=mpeg_xvmc \
--enable-decoder=h261 \
--enable-decoder=h263 \
--enable-decoder=h263i \
--enable-decoder=h263p \
--enable-hwaccel=h263_vaapi \
--enable-hwaccel=h263_vdpau \
--enable-hwaccel=mpeg1_vdpau \
--enable-hwaccel=mpeg1_xvmc \
--enable-hwaccel=mpeg2_dxva2 \
--enable-hwaccel=mpeg2_vaapi \
--enable-hwaccel=mpeg2_vdpau \
--enable-hwaccel=mpeg2_xvmc \
--enable-hwaccel=mpeg4_vaapi \
--enable-hwaccel=mpeg4_vdpau \
--enable-demuxer=aac \
--enable-demuxer=ac3 \
--enable-demuxer=h261 \
--enable-demuxer=h263 \
--enable-demuxer=pcm_s16be \
--enable-demuxer=pcm_s16le \
--enable-demuxer=pcm_s8 \
--enable-demuxer=mpegps \
--enable-demuxer=mpegts \
--enable-demuxer=mpegtsraw \
--enable-demuxer=mpegvideo \
--enable-demuxer=rtp \
--enable-demuxer=rtsp \
--enable-parser=aac \
--enable-parser=mpegvideo \
--enable-parser=ac3 \
--enable-parser=h261 \
--enable-parser=h263 \
--enable-parser=mjpeg \
--enable-parser=mpeg4video \
--enable-parser=mpegaudio \
--enable-protocol=rtp \
--enable-protocol=file \
--enable-protocol=ftp \
--enable-protocol=tcp \
--enable-protocol=http \
--enable-protocol=udp \
--enable-protocol=pipe \
--enable-protocol=unix \
--enable-network \
--disable-swscale \
--enable-asm \
--enable-memalign-hack \
--disable-golomb \
--enable-stripping \
--enable-pthreads \
--disable-symver \
--enable-version3"
./configure $FFMPEG_FLAGS --extra-cflags="$CFLAGS $EXTRA_CFLAGS" \
--extra-ldflags="$EXTRA_LDFLAGS"
make clean
echo "Project now cleaned"
make -j4
echo "Stripping multiple references from libraries"
arm-linux-androideabi-ar d libavcodec.a log2_tab.o
arm-linux-androideabi-ar d libavutil.a log2_tab.o
echo "Done..."
And this is the Android.mk file which works fine.
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_MODULE := avutil
LOCAL_SRC_FILES := libs\libavutil.a
include $(PREBUILT_STATIC_LIBRARY)
include $(CLEAR_VARS)
LOCAL_MODULE := avformat
LOCAL_SRC_FILES := libs\libavformat.a
include $(PREBUILT_STATIC_LIBRARY)
include $(CLEAR_VARS)
LOCAL_MODULE := avcodec
LOCAL_SRC_FILES := libs\libavcodec.a
include $(PREBUILT_STATIC_LIBRARY)
include $(CLEAR_VARS)
LOCAL_MODULE := ffplayer
LOCAL_SRC_FILES := ffplayer.cpp
LOCAL_C_INCLUDES := C:\DEV\ffmpeg\
LOCAL_LDLIBS += -llog -ljnigraphics -lGLESv2 -ldl
LOCAL_LDLIBS += -lstdc++ -lc
LOCAL_LDLIBS += -lz -lm
LOCAL_WHOLE_STATIC_LIBRARIES += libavutil libavformat libavcodec
include $(BUILD_SHARED_LIBRARY)
If anybody can spot what's wrong with this it would be so appreciated.
I figured it out by using a similar build method someone else used and just added my own options. This one also copies the folders "bin", "lib", "include" and the "share". All I needed then was to add the "lib" and "include" folders to my project. Phew!
#!/bin/bash
NDK=/home/carl/dev/ndk
PLATFORM=$NDK/platforms/android-9/arch-arm
PREBUILT=$NDK/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86/
PREFIX=/home/carl/temp/ffmpeg/
function build_one
{
./configure --target-os=linux --prefix=$PREFIX \
--enable-cross-compile \
--enable-runtime-cpudetect \
--enable-asm \
--arch=arm \
--cc=$PREBUILT/bin/arm-linux-androideabi-gcc \
--cross-prefix=$PREBUILT/bin/arm-linux-androideabi- \
--disable-stripping \
--nm=$PREBUILT/bin/arm-linux-androideabi-nm \
--sysroot=$PLATFORM \
--enable-nonfree \
--enable-small \
--disable-symver \
--disable-doc \
--disable-ffplay \
--disable-ffmpeg \
--disable-ffprobe \
--disable-ffserver \
--disable-avdevice \
--disable-avfilter \
--disable-encoders \
--disable-muxers \
--disable-demuxers \
--disable-filters \
--disable-devices \
--disable-decoders \
--enable-decoder=mjpeg \
--enable-decoder=mp1 \
--enable-decoder=mp2 \
--enable-decoder=mp3 \
--enable-decoder=mpeg1_vdpau \
--enable-decoder=mpeg1video \
--enable-decoder=mpeg2video \
--enable-decoder=mpeg4 \
--enable-decoder=mpeg4_vdpau \
--enable-decoder=mpegvideo \
--enable-decoder=mpeg_xvmc \
--enable-decoder=h261 \
--enable-decoder=h263 \
--enable-decoder=h263i \
--enable-decoder=h263p \
--enable-hwaccel=h263_vaapi \
--enable-hwaccel=h263_vdpau \
--enable-hwaccel=mpeg1_vdpau \
--enable-hwaccel=mpeg1_xvmc \
--enable-hwaccel=mpeg2_dxva2 \
--enable-hwaccel=mpeg2_vaapi \
--enable-hwaccel=mpeg2_vdpau \
--enable-hwaccel=mpeg2_xvmc \
--enable-hwaccel=mpeg4_vaapi \
--enable-hwaccel=mpeg4_vdpau \
--enable-demuxer=aac \
--enable-demuxer=ac3 \
--enable-demuxer=h261 \
--enable-demuxer=h263 \
--enable-demuxer=pcm_s16be \
--enable-demuxer=pcm_s16le \
--enable-demuxer=pcm_s8 \
--enable-demuxer=mpegps \
--enable-demuxer=mpegts \
--enable-demuxer=mpegtsraw \
--enable-demuxer=mpegvideo \
--enable-demuxer=rtp \
--enable-demuxer=rtsp \
--enable-parser=aac \
--enable-parser=mpegvideo \
--enable-parser=ac3 \
--enable-parser=h261 \
--enable-parser=h263 \
--enable-parser=mjpeg \
--enable-parser=mpeg4video \
--enable-parser=mpegaudio \
--enable-protocol=rtp \
--enable-protocol=file \
--enable-protocol=ftp \
--enable-protocol=tcp \
--enable-protocol=http \
--enable-protocol=udp \
--enable-protocol=pipe \
--enable-protocol=unix \
--enable-network \
--disable-swscale \
--enable-asm \
--enable-memalign-hack \
--enable-stripping \
--enable-pthreads \
--disable-symver \
--enable-version3 \
--extra-cflags="-I/home/android-ffmpeg/include -fPIC -DANDROID \
-D__thumb__ -mthumb -Wfatal-errors -Wno-deprecated \
-mfloat-abi=softfp -mfpu=vfpv3-d16 -marm -march=armv7-a" \
--extra-ldflags="-L/home/android-ffmpeg/lib"
make -j4 install
$PREBUILT/bin/arm-linux-androideabi-ar d libavcodec/libavcodec.a inverse.o
$PREBUILT/bin/arm-linux-androideabi-ld -rpath-link=$PLATFORM/usr/lib -L$PLATFORM/usr/lib -L$PREFIX/lib -soname libffmpeg.so -shared -nostdlib -z,noexecstack -Bsymbolic --whole-archive --no-undefined -o $PREFIX/libffmpeg.so libavcodec/libavcodec.a libavfilter/libavfilter.a libavresample/libavresample.a libavformat/libavformat.a libavutil/libavutil.a libswscale/libswscale.a -lc -lm -lz -ldl -llog -lx264 --warn-once --dynamic-linker=/system/bin/linker $PREBUILT/lib/gcc/arm-linux-androideabi/4.4.3/libgcc.a
}
build_one
I am migrating a huge project from Qt 4.x to 5, I am almost finished but Im having errors that I cannot locate, I think it has to do with the linkage of some libraries but I am somewhat lost here. I hope someone can throw some light on this matter.
Errors:
./release\addeditaton.o:addeditaton.cpp:(.text+0x6ac2): undefined reference to `_imp___ZN10HTTPClient5abortEv'
./release\addeditaton.o:addeditaton.cpp:(.text+0x98c5): undefined reference to `_imp___ZN10HTTPClient3getE7QStringbb'
./release\addeditaton.o:addeditaton.cpp:(.text+0x9f88): undefined reference to `_imp___ZN10HTTPClient3getE7QStringbb'
./release\addeditaton.o:addeditaton.cpp:(.text+0xa7a8): undefined reference to `_imp___ZN10HTTPClient3getE7QStringbb'
./release\addeditaton.o:addeditaton.cpp:(.text+0xa921): undefined reference to `_imp___ZN10RestClientC2E7QStringibS0_S0_S0_S0_'
./release\addeditaton.o:addeditaton.cpp:(.text+0xc91b): undefined reference to `_imp___ZN10HTTPClient3getE7QStringbb'
./release\addeditaton.o:addeditaton.cpp:(.text+0xcaa3): undefined reference to `_imp___ZN10RestClientC2E7QStringibS0_S0_S0_S0_'
./release\addeditaton.o:addeditaton.cpp:(.text+0xe49d): undefined reference to `_imp___ZN10HTTPClient4postE7QStringS0_b'
./release\addeditaton.o:addeditaton.cpp:(.text+0xfc55): undefined reference to `_imp___ZN10HTTPClient4postE7QStringS0_b'
Makefile.Release:922: recipe for target '..\Release\Swibz.exe' failed
c:/mingw/bin/../lib/gcc/mingw32/4.8.1/../../../../mingw32/bin/ld.exe: ./release\addeditaton.o: bad reloc address 0x20 in section `.text$_ZN10QByteArrayD1Ev[__ZN10QByteArrayD1Ev]'
Project file:
# ----------------------------------------------------
# This file is generated by the Qt Visual Studio Add-in.
# ------------------------------------------------------
TEMPLATE = app
TARGET = Swibz
include(Swibz.pri)
DESTDIR = ../Release
QT += widgets network xml webkit webkitwidgets opengl #core gui are by default
CONFIG += release
DEFINES += _WINDOWS QT_LARGEFILE_SUPPORT QT_XML_LIB QT_OPENGL_LIB QT_NETWORK_LIB QT_DLL QWT_DLL JSON_LIB_LIB
INCLUDEPATH += ../../../SprintLib \
./GeneratedFiles \
./GeneratedFiles/Release \
. \
#./../../Qwt/qwt-5.2.0/src \
../qwt/src \
#../../../QENC/QENC \
../qenc \
# ../../../zlib-1.2.5 \
../zlib-1.2.5 \
#../../../serial/qextserialport-1.2win-alpha \
../qextserialport-1.2win-alpha \
# ../../../qxmpp-0.3.0/src \
../qxmpp/build-qxmpp-Qt_4_8_5-Debug/src \
#../../../JSON \
../json/JSON \
# ../../../QtSerialPort/qtserialport/include
../QtSerialPort/qtserialport/include
LIBS += -L"../../../SprintLib/release" \
-L"../../../QENC/release" \
-L"../../../zlib-1.2.5/contrib/vstudio/vc9/x86/ZlibDllRelease" \
-L"../../../serial/qextserialport-1.2win-alpha/Release" \
-L"../../../qxmpp-0.3.0/lib" \
-L"../../../JSON/Release" \
-L"../../../QtSerialPort/qtserialport/src/serialport/release" \
-lopengl32 \
-lglu32 \
-lgdi32 \
-luser32 \
#-lHDP \
-L"./libHDP.a" \
#-l../../Qwt/qwt-5.2.0/lib/debug/qwt5 \
#-lqenc \
#-lzlibwapi \
-L"./zlib1.dll" \
#-lqextserialport \
-lsetupapi \
#-lqxmpp \
-L"./libqxmpp.a" \
#-ljson_lib \
#-lSerialPort1
-L"./libqextserialportd.a" \
#DEPENDPATH += .
#MOC_DIR += ./GeneratedFiles/release
#OBJECTS_DIR += release
#UI_DIR += ./GeneratedFiles
#eRCC_DIR += ./GeneratedFiles
#win32:RC_FILE = Swibz.rc
TRANSLATIONS = ln_en.ts
TRANSLATIONS = ln_lv.ts
TRANSLATIONS = ln_lt.ts
TRANSLATIONS = ln_es.ts
CODECFORTR = UTF-8
Includes of addeditaton.cpp (if the rest of the code is needed please tell, they are 930 lines and I dont think they are relevant to the issue(
#include "addeditaton.h"
#include "atonwidget.h"
#include "atoninfowidget.h"
#include "messagebox.h"
#include <QtDebug>
#include <QFileDialog>
./release\addeditaton.o:addeditaton.cpp:(.text+0x6ac2): undefined reference to `_imp___ZN10HTTPClient5abortEv'
Lines like that usually means at least either of the following issues:
You do not have the corresponding library installed.
You do not have the correct version installed with the symbols you rely on.
Your linkage options are not set up properly.
In this case, the complain is about the http client library, so let us check your project file first. You are using the -L and -l options correctly in the beginning, but not in the end, so let us clarify what they mean:
-L means the path to the library.
-l either means the library name or absolute path to the library.
Now, let us see what you write at the end where the issue is:
-L"./libHDP.a" \
#-l../../Qwt/qwt-5.2.0/lib/debug/qwt5 \
#-lqenc \
#-lzlibwapi \
-L"./zlib1.dll" \
#-lqextserialport \
-lsetupapi \
#-lqxmpp \
-L"./libqxmpp.a" \
#-ljson_lib \
#-lSerialPort1
-L"./libqextserialportd.a" \
Therefore, you should replace this with the following:
-lHDP
#-l../../Qwt/qwt-5.2.0/lib/debug/qwt5 \
#-lqenc \
#-lzlibwapi \
-lzlib1 \
#-lqextserialport \
-lsetupapi \
#-lqxmpp \
-lqxmpp.a \
#-ljson_lib \
#-lSerialPort1 \
-lqextserialportd
Alternatively, you could also specify the absolute path to the static libraries with the -l option as mentioned above.
Note that you should not mix up things like QtSerialPort and QextSerialPort in your project, however. It is better to use QtSerialPort.
You are using the -L option for the following libraries:
-L"./libHDP.a" \
-L"./zlib1.dll" \
-L"./libqxmpp.a" \
-L"./libqextserialportd.a" \
-L specifies a directory to search for libraries. Use the -l (lowercase) to specify a library. You may want to add a colon before the libarary name if you wnat to specify the exact name. For example,
-l :./libHDP.a \
-l :./zlib1.dll \
-l :./libqxmpp.a \
-l :./libqextserialportd.a \
See https://sourceware.org/binutils/docs/ld/Options.html#Options for details.
I'm developing Qt application on Win 7 (using Windows Qt distro with MinGW included) and I need to use Google's protocol buffers. So I followed this How to build Google's protobuf in Windows using MinGW? and I have managed to build it.
But it was necessary for me to install separately MinGW and MSYS to achieve that.
Is there cleaner way how to built in protobufs in my app just using Qt and it's toolchain ?
We created new project and added files from protobuf. I can give you my .pro file.
Then we included this project to our common project (subdirs)
QT -= gui
TARGET = protobuf
TEMPLATE = lib
CONFIG += staticlib
# DESTDIR
win32 {
CONFIG(debug, debug|release): DESTDIR = ../bin/debug
CONFIG(release, debug|release): DESTDIR = ../bin/release
}
unix {
CONFIG(debug, debug|release): DESTDIR = ../bin_unix/debug
CONFIG(release, debug|release): DESTDIR = ../bin_unix/release
}
INCLUDEPATH += ../protobuf
SOURCES += \
google/protobuf/wire_format_lite.cc \
google/protobuf/wire_format.cc \
google/protobuf/unknown_field_set.cc \
google/protobuf/text_format.cc \
google/protobuf/service.cc \
google/protobuf/repeated_field.cc \
google/protobuf/reflection_ops.cc \
google/protobuf/message_lite.cc \
google/protobuf/message.cc \
google/protobuf/generated_message_util.cc \
google/protobuf/generated_message_reflection.cc \
google/protobuf/extension_set_heavy.cc \
google/protobuf/extension_set.cc \
google/protobuf/dynamic_message.cc \
google/protobuf/descriptor_database.cc \
google/protobuf/descriptor.pb.cc \
google/protobuf/descriptor.cc \
google/protobuf/compiler/parser.cc \
google/protobuf/compiler/importer.cc \
google/protobuf/io/zero_copy_stream_impl_lite.cc \
google/protobuf/io/zero_copy_stream_impl.cc \
google/protobuf/io/zero_copy_stream.cc \
google/protobuf/io/tokenizer.cc \
google/protobuf/io/printer.cc \
google/protobuf/io/gzip_stream.cc \
google/protobuf/io/coded_stream.cc \
google/protobuf/stubs/substitute.cc \
google/protobuf/stubs/strutil.cc \
google/protobuf/stubs/structurally_valid.cc \
google/protobuf/stubs/once.cc \
google/protobuf/stubs/common.cc
HEADERS += \
google/protobuf/wire_format_lite_inl.h \
google/protobuf/wire_format_lite.h \
google/protobuf/wire_format.h \
google/protobuf/unknown_field_set.h \
google/protobuf/text_format.h \
google/protobuf/service.h \
google/protobuf/repeated_field.h \
google/protobuf/reflection_ops.h \
google/protobuf/message_lite.h \
google/protobuf/message.h \
google/protobuf/generated_message_util.h \
google/protobuf/generated_message_reflection.h \
google/protobuf/extension_set.h \
google/protobuf/dynamic_message.h \
google/protobuf/descriptor_database.h \
google/protobuf/descriptor.pb.h \
google/protobuf/descriptor.h \
google/protobuf/compiler/parser.h \
google/protobuf/compiler/importer.h \
google/protobuf/io/zero_copy_stream_impl_lite.h \
google/protobuf/io/zero_copy_stream_impl.h \
google/protobuf/io/zero_copy_stream.h \
google/protobuf/io/tokenizer.h \
google/protobuf/io/printer.h \
google/protobuf/io/gzip_stream.h \
google/protobuf/io/coded_stream_inl.h \
google/protobuf/io/coded_stream.h \
google/protobuf/stubs/substitute.h \
google/protobuf/stubs/strutil.h \
google/protobuf/stubs/stl_util-inl.h \
google/protobuf/stubs/once.h \
google/protobuf/stubs/map-util.h \
google/protobuf/stubs/hash.h \
google/protobuf/stubs/common.h \
config.h
# Turn off ALL warning for the project
win32:CONFIG += warn_off
An alternative way to build is to use this project: https://github.com/cjh1/protobuf which does not require running ./configure but does require the CMake build system for Windows which can integrate with the MinGW toolchain that comes with Qt. It currently only builds a protobufs as static libraries (not dynamic/shared) and doesn't install header files but I hope eventually those features will be built in.
I am trying to build a shared library by editing Wireshark's Makefile.am to create a "libtshark" ... to do this, I am trying to build a tshark_lib.c which is the same as tshark.c with main() stripped out of it.
So I have edited Makefile.am to include include the following in an attempt to build the shared libtshark library:
lib_LTLIBRARIES = libtshark.la
libtshark_la_LDFLAGS = -version-info 0:1:0 -export-symbols libtshark.sym #LDFLAGS_SHAREDLIB#
libtshark_la_SOURCES = \
$(WIRESHARK_COMMON_SRC) \
$(SHARK_COMMON_CAPTURE_SRC) \
$(TSHARK_TAP_SRC) \
capture_opts.c \
capture_sync.c \
tempfile.c \
tshark-tap-register.c \
tshark_lib.c
# Libraries and plugin flags with which to link tshark.
libtshark_la_LIBADD = \
wiretap/libwiretap.la \
epan/libwireshark.la \
wsutil/libwsutil.la \
#SSL_LIBS# \
$(plugin_ldadd) \
#PCRE_LIBS# \
#GLIB_LIBS# -lm \
#PCAP_LIBS# \
#SOCKET_LIBS# \
#NSL_LIBS# \
#C_ARES_LIBS# \
#ADNS_LIBS# \
#KRB5_LIBS# \
#CORESERVICES_FRAMEWORKS# \
#LIBGCRYPT_LIBS# \
#LIBGNUTLS_LIBS# \
#LIBSMI_LDFLAGS#
#tshark_CFLAGS = $(AM_CLEAN_CFLAGS) $(py_dissectors_dir)
libtshark_la_DEPENDENCIES = \
${top_builddir}/epan/libwireshark.la \
${top_builddir}/wsutil/libwsutil.la \
${top_builddir}/wiretap/libwiretap.la \
libtshark.sym
However, when I try to build the code now, I get the following error:
make[2]: *** No rule to make target `libtshark.sym', needed by `libtshark.la'. Stop.
For some reason, it is not using my 'libtshark_la_LDFLAGS' which contains '-export-symbols libtshark.sym' ... does anyone know what I might be missing?
Here is the entire Makefile.am, which is too long for stackoverflow: Makefile.am
it turns out that the .sym file is pre-generated by wireshark scripts to determine which symbols to export.