arm-linux-gnueabihg-g++ can't find dbus header files - c++

I was cross compiling a program for raspi (see git pukster/omxplayer-sync-2
) using the arm-bcm2708 compiler. However, I ran into problems when I tried to get it to run on the raspi2. I have now moved over to using arm-linux-gnueabihf-g++ (see git pukster/omxplayer-sync3
). I have spent the better part of the day trying to get this cross compiler to work, having finally compiled ffmpeg, but now it complains that it can't find string.
I will include a minimum working example illustrating the problem (using a helloworld program), while using the same g++ call. If you are interested in looking at the full code, you can find it at my github account pukster/omxplayer-sync3
I need someone with more compiler insight to help me diagnose this problem.
helloworld.c
#include<stdio.h>
#include<string>
main()
{
printf("Hello World");
}
make.sh
#!/bin/bash
arm-linux-gnueabihf-g++ \
--sysroot=/mnt/CYBRAN/raspi1 \
-Wall \
-isystem/include \
-pipe \
-mfloat-abi=hard \
-mcpu=cortex-a7 \
-fomit-frame-pointer \
-mabi=aapcs-linux \
-mtune=arm1176jzf-s \
-mfpu=vfp \
-Wno-psabi \
-mno-apcs-stack-check \
-O3 \
-mstructure-size-boundary=32 \
-mno-sched-prolog \
-std=c++0x \
-D__STDC_CONSTANT_MACROS \
-D__STDC_LIMIT_MACROS \
-DTARGET_POSIX \
-DTARGET_LINUX \
-fPIC \
-DPIC \
-D_REENTRANT \
-D_LARGEFILE64_SOURCE \
-D_FILE_OFFSET_BITS=64 \
-DHAVE_CMAKE_CONFIG \
-D__VIDEOCORE4__ \
-U_FORTIFY_SOURCE \
-Wall \
-DHAVE_OMXLIB \
-DUSE_EXTERNAL_FFMPEG \
-DHAVE_LIBAVCODEC_AVCODEC_H \
-DHAVE_LIBAVUTIL_OPT_H \
-DHAVE_LIBAVUTIL_MEM_H \
-DHAVE_LIBAVUTIL_AVUTIL_H \
-DHAVE_LIBAVFORMAT_AVFORMAT_H \
-DHAVE_LIBAVFILTER_AVFILTER_H \
-DHAVE_LIBSWRESAMPLE_SWRESAMPLE_H \
-DOMX \
-DOMX_SKIP64BIT \
-ftree-vectorize \
-DUSE_EXTERNAL_OMX \
-DTARGET_RASPBERRY_PI \
-DUSE_EXTERNAL_LIBBCM_HOST \
-marm \
-isystem/mnt/CYBRAN/raspi1/usr/include \
-isystem/mnt/CYBRAN/raspi1/usr/include/arm-linux-gnueabihf \
-isystem/mnt/CYBRAN/raspi1/opt/vc/include \
-isystem/mnt/CYBRAN/raspi1/usr/include \
-isystem/mnt/CYBRAN/raspi1/opt/vc/include/interface/vcos/pthreads \
-isystem/mnt/CYBRAN/raspi1/usr/include/freetype2 \
-isystem/mnt/CYBRAN/raspi1/usr/include/libavcodec \
-isystem/mnt/CYBRAN/raspi1/opt/vc/include/interface/vmcs_host/linux
-isystem/mnt/CYBRAN/raspi1/usr/include/dbus-1.0 \
-isystem/mnt/CYBRAN/raspi1/usr/lib/arm-linux-gnueabihf/dbus-1.0/include/ \
-I./ \
-Ilinux \
-Iffmpeg_compiled/usr/local/include/ \
-Iffmpeg/libavutil/ \
-c helloworld.c \
-o helloworld \
-Wno-deprecated-declarations
output
username#sv-01:~/Documents/test$ ./make.sh
helloworld.c:4:17: fatal error: string: No such file or directory
#include<string>
^
compilation terminated.
username:~/Documents/test$ ls /mnt/CYBRAN/raspi1/usr/include/string*
/mnt/CYBRAN/raspi1/usr/include/string.h /mnt/CYBRAN/raspi1/usr/include/strings.h
EDIT: troubleshooting output
Output of find /mnt/CYBRAN/raspi1/usr/include/ -type l
/mnt/CYBRAN/raspi1/usr/include/python2.6/numpy
/mnt/CYBRAN/raspi1/usr/include/c++/4.6.3
/mnt/CYBRAN/raspi1/usr/include/python2.6_d/numpy
/mnt/CYBRAN/raspi1/usr/include/python3.2mu/numpy
/mnt/CYBRAN/raspi1/usr/include/png.h
/mnt/CYBRAN/raspi1/usr/include/pngconf.h
/mnt/CYBRAN/raspi1/usr/include/python3.2dmu/numpy
/mnt/CYBRAN/raspi1/usr/include/python2.7_d/numpy
/mnt/CYBRAN/raspi1/usr/include/numpy
/mnt/CYBRAN/raspi1/usr/include/libpng
/mnt/CYBRAN/raspi1/usr/include/python2.7/numpy
EDIT:
When I do an ls on one of the -isystem directories, I can see that the file string exists, but I still get the same complaint. Is this a compatibility issue as mentioned here

Related

How to use g++ -MM in a makefile

I can use the -MM option in g++ to generate the dependencies in a makefile rule format.
g++ -MM module2.cpp -I../src -I../../raven-set -I. -I../src/ext
outputs
module2.o: module2.cpp pch.h ../src/theGlobalDefines.h \
../../raven-set/raven_sqlite.h ../src/ext/sqlite3.h Module2.h \
cPelexMixerComponent.h cErrorHandler.h cTimedEvent.h cPelexConfig.h \
../src/sgp.h ../src/cCircularVector.h ../../raven-set/cTimerBusyLoop.h \
../src/channelIdentification.h ../src/cPacketData.h cRxTx.h \
cOutputTransmitter.h cDelayStats.h cMCUSB202.h cPeakerServer.h cInput.h \
../src/cSequenceNumber.h cRxPelexWireless.h ../../raven-set/cRunCount.h \
cPeakFilter.h cSPO2StateMachine.h wrs_cProcessed.h ../src/log.h \
wrs/cRaw.h wrs/cPacket.h wrs/cCalibrate.h wrs/cStream.h \
../src/cPelexMixerConfig.h ../src/ext/json.h wrs/cSignalProcessor_wrs.h \
cD1ZeroCross.h ../src/cVitals.h cUI.h cTimeProfiler.h \
../licenser/cLicence.h cSignalProcessor.h ../src/cPeakFilterSet.h \
../src/cPeakFinder.h cDataRange.h cDerivativeTemplate.h \
cDerivativePeak.h cInputRecord.h cSGPOutput.h cSignalProcessorConfig.h \
cHeartRate.h ../src/StatusDB.h cLogger.h cKeyBoardMonitor.h \
wrs/cStartSequence.h ../src/Configure.h ../src/HistoryDB.h \
../../raven-set/cRunWatch.h version.h
Now what do I do with this?
Is there a way for make to run the g++ -MM command and then use the generated rule?
Here is the makefile
#source file search paths
VPATH = wrs . ../src ../src/ext ../licenser
# compiler include search paths
INCS=-I../src -I../src/ext \
-I. -I"C:\Users\Public\Documents\Measurement Computing\DAQ\C" \
-I../../boost/boost1_72
# libraries required by linker
LIBS=-lstdc++fs -lws2_32 -lwsock32 \
-L"C:\Users\Public\Documents\Measurement Computing\DAQ\C" \
-lcbw64 -lIphlpapi \
-L../../boost/boost1_72/lib \
-lboost_thread-mgw82-mt-x64-1_72 \
-lboost_system-mgw82-mt-x64-1_72 \
-lboost_program_options-mgw82-mt-x64-1_72 \
-lboost_filesystem-mgw82-mt-x64-1_72
# folder for .o files
ODIR=./obj
# sources
_OBJ = \
cLicence.o \
sha1.o \
ChannelIdentification.o \
ChannelLabels.o \
Configure.o \
CubicSpline.o \
HistoryDB.o \
StatusDB.o \
cPacketData.o \
cPeakFilterSet.o \
cPeakFinder.o \
cPelexMixerConfig.o \
cVitals.o \
cRunWatch.o \
cSpline.o \
cTimerBusyLoop.o \
json.o \
raven_sqlite.o \
sqlite3.o \
log.o \
cD1ZeroCross.o \
cDataRange.o \
cDelayStats.o \
cDerivativeTemplate.o \
cErrorHandler.o \
cHeartRate.o \
cInput.o \
cInputRecord.o \
cMCUSB202.o \
cOutputTransmitter.o \
cPacketAlpha.o \
cPacketWRS.o \
cPeakFilter.o \
cPeakFinderSustainedD1.o \
cPeakFinderTallPoppy.o \
cPeakerServer.o \
cPelexConfig.o \
cPelexMixerComponent.o \
cRxPelexWireless.o \
cRxTx.o \
cSGPOutput.o \
cSPO2StateMachine.o \
cSignalProcessor.o \
cTimeProfile.o \
cTimedEvent.o \
cUI.o \
module2.o \
sgp.o \
cCalibrate.o \
cRaw.o \
cSignalProcessor_wrs.o \
cStartSequence.o \
cStream.o \
wrs_cProcessed.o
OBJ = $(patsubst %,$(ODIR)/%,$(_OBJ))
$(ODIR)/sqlite3.o: sqlite3.c
gcc -c -o $# $<
$(ODIR)/%.o: %.cpp
g++ -std=c++17 -m64 -fexceptions -D_mingw_ -DMODULE2 -O2 \
-c -o $# $< $(INCS)
mixer: $(OBJ)
g++ -m64 -O2 -s -o ../bin/PelexMixer.exe $^ $(LIBS)
I need to do the following steps to generate, store and include the dependency files
This follows the hints in the link provided by #G.M and helpful comments added to this answer
Step 1: define some flags requesting the generation and storage of dependencies. Notice that I am storing both the .o and the .d files in the same folder - makes things a bit simpler
# flags requesting dependency generation
DEPFLAGS = -MT $# -MMD -MP -MF $(ODIR)/$*.d
Step 2 add flags to compilation rule so that they will be generated as we go along
$(ODIR)/%.o: %.cpp
g++ -std=c++17 -m64 -fexceptions -D_mingw_ -DMODULE2 -O2 \
$(DEPFLAGS) \
-c -o $# $< $(INCS)
Step 3 Include the dependency files
# convert list of object files to list of dependency files
DEPFILES := $(_OBJ:%.o=$(ODIR)/%.d)
# empty rule, so make won't complain
# about not having a rule to make the dependency file if missing
$(DEPFILES):
# include the dependency files
include $(wildcard $(DEPFILES))
Here is my complete makefile with the changes described above
#source file search paths
VPATH = wrs . ../src ../src/ext ../licenser
# compiler include search paths
INCS=-I../src -I../src/ext \
-I. -I"C:\Users\Public\Documents\Measurement Computing\DAQ\C" \
-I../../boost/boost1_72
# libraries required by linker
LIBS=-lstdc++fs -lws2_32 -lwsock32 \
-L"C:\Users\Public\Documents\Measurement Computing\DAQ\C" \
-lcbw64 -lIphlpapi \
-L../../boost/boost1_72/lib \
-lboost_thread-mgw82-mt-x64-1_72 \
-lboost_system-mgw82-mt-x64-1_72 \
-lboost_program_options-mgw82-mt-x64-1_72 \
-lboost_filesystem-mgw82-mt-x64-1_72
# folder for .o files and depedency files
ODIR = ../pelexmixer/obj
# flags requesting dependency generation
DEPFLAGS = -MT $# -MMD -MP -MF $(ODIR)/$*.d
# sources
_OBJ = \
cLicence.o \
sha1.o \
ChannelIdentification.o \
ChannelLabels.o \
Configure.o \
CubicSpline.o \
HistoryDB.o \
StatusDB.o \
cPacketData.o \
cPeakFilterSet.o \
cPeakFinder.o \
cPelexMixerConfig.o \
cVitals.o \
cRunWatch.o \
cSpline.o \
cTimerBusyLoop.o \
json.o \
raven_sqlite.o \
sqlite3.o \
log.o \
cD1ZeroCross.o \
cDataRange.o \
cDelayStats.o \
cDerivativeTemplate.o \
cErrorHandler.o \
cHeartRate.o \
cInput.o \
cInputRecord.o \
cMCUSB202.o \
cOutputTransmitter.o \
cPacketAlpha.o \
cPacketWRS.o \
cPeakFilter.o \
cPeakFinderSustainedD1.o \
cPeakFinderTallPoppy.o \
cPeakerServer.o \
cPelexConfig.o \
cPelexMixerComponent.o \
cRxPelexWireless.o \
cRxTx.o \
cSGPOutput.o \
cSPO2StateMachine.o \
cSignalProcessor.o \
cTimeProfile.o \
cTimedEvent.o \
cUI.o \
module2.o \
sgp.o \
cCalibrate.o \
cRaw.o \
cSignalProcessor_wrs.o \
cStartSequence.o \
cStream.o \
wrs_cProcessed.o
OBJ = $(patsubst %,$(ODIR)/%,$(_OBJ))
$(ODIR)/sqlite3.o: sqlite3.c
gcc -c -o $# $<
$(ODIR)/%.o: %.cpp
g++ -std=c++17 -m64 -fexceptions -D_mingw_ -DMODULE2 -O2 \
$(DEPFLAGS) \
-c -o $# $< $(INCS)
mixer: $(OBJ)
g++ -m64 -O2 -s -o ../bin/PelexMixer.exe $^ $(LIBS)
DEPFILES := $(_OBJ:%.o=$(ODIR)/%.d)
$(DEPFILES):
include $(wildcard $(DEPFILES))

compiling cpp wasm module using skia library face to an error

I'm trying to use SKIA lib in my WASM solution. first I Compiled Skia to wasm bitcode using bellow config:
/bin/gn gen ./out/Build-wasm-Release/Release --args="cc=\"emcc\" extra_cflags_cc=[\"-frtti\",\"-s\",\"USE_FREETYPE=1\"] cxx=\"em++\" extra_cflags=[\"-Wno-unknown-warning-option\",\"-s\",\"USE_FREETYPE=1\",\"-s\",\"USE_LIBPNG=1\"] \
is_debug=false \
is_official_build=true \
is_component_build=false \
target_cpu=\"wasm\" \
\
skia_use_egl=false \
skia_use_vulkan=false \
skia_use_libwebp=false \
skia_use_libpng=true \
skia_use_lua=false \
skia_use_dng_sdk=false \
skia_use_fontconfig=false \
skia_use_libjpeg_turbo=false \
skia_use_libheif=false \
skia_use_expat=false \
skia_use_vulkan=false \
skia_use_freetype=false \
skia_use_icu=false \
skia_use_expat=false \
skia_use_piex=false \
skia_use_zlib=true \
skia_enable_gpu=true \
skia_enable_pdf=false"
it successfully compiled, when I try to compile my own code using:
em++ multiply.cpp -o multiply.js -s EXPORTED_FUNCTIONS="['_float_multiply','_float_multiply_array','_sample_array_rtn','_sample_array_float_rtn','_msd_main']"-s EXTRA_EXPORTED_RUNTIME_METHODS='["ccall", "cwrap"]' -s ALLOW_MEMORY_GROWTH=1 -s USE_WEBGL2=1 -s NO_EXIT_RUNTIME=1 -s USE_LIBPNG=1 -s WASM=1 -s MODULARIZE=1 -s FORCE_FILESYSTEM=0 -I$SKIAPATH/include/ -I$SKIAPATH/include/gpu -I$SKIAPATH/include/core -I$SKIAPATH/include/config -I$SKIAPATH/include/c -L$SKIAPATH/out/Build-wasm-Release/Release -I$SKIAPATH -lskia
I got bellow this error:
LLVM ERROR: Invalid SIMD cast between items of different bit sizes!

Qt: pjsip linking problems

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.

ffmpeg ndk multiple definition libavcodec.a(golomb.o)

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

Makefile Compiling Issue for Mixed C++ and Fortran Program

This is my makefile :
PROGRAM = mf2005-GPU.f
# Define the Fortran compile flags
F90FLAGS= -g -fopenmp
F90= gfortran
# Define the C compile flags
# -D_UF defines UNIX naming conventions for mixed language compilation.
CFLAGS= -D_UF -O3
CC= gcc
CPPFLAGS= -Dcpp_variable
CXX= g++
# Define GMG objects
#
GMG = r_vector.o\
solvers.o\
ccfd.o\
mf2kgmg.o\
# Define the libraries
SYSLIBS= -lc
USRLIB =
CUDA_LIB64=/cm/shared/apps/cuda40/toolkit/4.0.17/lib64/
LFLAGS = -L$(CUDA_LIB64) -lcuda -lcudart -lcusparse -lcublas -lpthread -lm -lcufft -lcurand -lnpp -lgomp
# Define all object files which make up MODFLOW
OBJECTS = \
dblas.o\
gwf2bas7.o \
de47.o \
dlapak.o\
pcg7.o \
sip7.o \
gmg7.o \
mhc7.o \
gwf2bcf7.o \
gwf2lpf7.o \
gwf2huf7.o \
gwf2rch7.o \
gwfuzfmodule.o \
gwfsfrmodule.o \
gwf2lak7.o \
gwf2sfr7.o \
gwf2uzf1.o \
gwf2gag7.o \
gwf2chd7.o \
gwf2drn7.o \
gwf2drt7.o \
gwf2ets7.o \
gwf2evt7.o \
gwf2fhb7.o \
gwf2ghb7.o \
gwf2hfb7.o \
gwf2ibs7.o \
gwf2res7.o \
gwf2riv7.o \
gwf2str7.o \
gwf2sub7.o \
gwf2swt7.o \
gwf2wel7.o \
hufutl7.o \
obs2bas7.o \
obs2drn7.o \
obs2ghb7.o \
obs2riv7.o \
obs2chd7.o \
obs2str7.o \
parutl7.o \
gwf2mnw17.o \
gwf2mnw27.o \
gwf2mnw2i7.o \
utl7.o \
lmt7.o \
gwf2hydmod7.o \
upcg7.o \
upcgc.o \
upcg7lanczos.o \
upcg7polya.o \
upcg7polyu.o \
mf2005-GPU.o \
# Define Task Function
all: mf2005-GPU
# Define what mf2005
mf2005-GPU: $(OBJECTS) $(GMG)
-$(F90) $(F90FLAGS) -o mf2005-GPU $(OBJECTS) cuda_kernels.o $(GMG) $(USRLIB) $(SYSLIBS) $(LFLAGS)
# Object codes
.f.o:
$(F90) $(F90FLAGS) -c $<
.c.o:
$(CC) $(CFLAGS) -c $<
.cpp.o:
$(CXX) $(CPPFLAGS) -c $<
# end
This is how I compile cuda_kernels.cu
nvcc -c -arch sm_20 -lcuda -lcudart -lcusparse cuda_kernels.cu
This is what I get for errors
upcg7.o: In function `upcg7ar':
/home/zhangmj/MF2005_MAKE/upcg7.f:731: undefined reference to `upcgc7_init_'
upcg7.o: In function `upcg7ap':
/home/zhangmj/MF2005_MAKE/upcg7.f:1272: undefined reference to `upcgc7_'
upcg7.o: In function `upcg7da':
/home/zhangmj/MF2005_MAKE/upcg7.f:1416: undefined reference to `upcgc7_final_'
upcgc.o: In function `UPCGC7':
upcgc.cpp:(.text+0xf6a): undefined reference to `SUPCGILU0A'
collect2: ld returned 1 exit status
make: [mf2005-GPU] Error 1 (ignored)
Following is upcg7.f (this is not my code, I download it from here)
https://github.com/jdhughes-usgs/modflow-2005-upcg/blob/master/code/src/UPCG/upcg7.f
Following is upcgc.cpp and upcgc.h (this is not my code, I download it from here)
https://github.com/jdhughes-usgs/modflow-2005-upcg/blob/master/code/src/UPCG/upcgc.cpp
**My question is **
SUPCGILU0A is the subroutine defined in upcg7.f. And subroutine SUPCGILU0A is called from the C++ program upcgc.cpp.
upcgc7_init, upcgc7 and upcgc7_final are defined in upcgc.cpp, And these three are called from the fortran program upcg7.f.
I understand from my research that these are likely linker issues,or C++ and Fortran need to translate some function/routine from the other, but I cannot figure out what the problem is. Is there anyone out there who might have some insight into what the issue is?
If the upcgc7 routines reside in the C code, they probably do not have the trailing underscore. The best way to deal with this is to make use of the ISO_C_BINDING interface in Fortran and declare the interfaces to these routines.