i have added a module to ns2 and i am compiling it when i get undefined reference error.
g++ -o ns \
-lXext -lX11 -lnsl -ldl -lm -lm -lrt -lneoclassic -lxml
maser/mamas.o: In function `mamasReasoner::mamasReasoner()':
mamas.cc:(.text+0x95): undefined reference to `NeoEnvironment::initFromNs(std::basic_ostringstream<char, std::char_traits<char>, std::allocator<char> >&, std::basic_ostringstream<char, std::char_traits<char>, std::allocator<char> >&, int)'
maser/mamas.o: In function `mamasReasoner::build_ontology_tree(knBase&)':
mamas.cc:(.text+0x1c84): undefined reference to `NeoEnvironment::evaluateCommand(String const&)'
maser/mamas.o: In function `NeoEnvironment::readXmlFromMemory(char const*, char const*)':
mamas.cc:(.text._ZN14NeoEnvironment17readXmlFromMemoryEPKcS1_[NeoEnvironment::readXmlFromMemory(char const*, char const*)]+0x14): undefined reference to `Parser::readXmlFromMemory(char const*, char const*)'
collect2: ld returned 1 exit status
make: *** [ns] Error
the library which it is asking for is present at the /usr/local/lib/libneoclassic.so and the makefile can be seen here http://pastebin.com/NZWPxKht
which use the following code for linking.
LINK = g++
LDFLAGS = -lneoclassic -lrt -lxml2
LDOUT = -o $(BLANK)
LIB = \
-L/usr/local/lib -ltclcl -L/usr/local/lib -lotcl -L/usr/local/lib -ltk8.4 -L/usr/local/lib -ltcl8.4 \
-lXext -lX11 \
-lnsl -ldl \
-lm -lm
OBJ_CC = \
tools/random.o tools/rng.o tools/ranvar.o common/misc.o common/timer-handler.o \
common/scheduler.o common/object.o common/packet.o \
common/ip.o routing/route.o common/connector.o common/ttl.o \
trace/trace.o trace/trace-ip.o \
classifier/classifier.o classifier/classifier-addr.o \
classifier/classifier-hash.o \
classifier/classifier-virtual.o \
classifier/classifier-mcast.o \
classifier/classifier-bst.o \
classifier/classifier-mpath.o mcast/replicator.o \
classifier/classifier-mac.o \
classifier/classifier-qs.o \
classifier/classifier-port.o src_rtg/classifier-sr.o \
src_rtg/sragent.o src_rtg/hdr_src.o adc/ump.o \
qs/qsagent.o qs/hdr_qs.o \
apps/app.o apps/telnet.o tcp/tcplib-telnet.o \
tools/trafgen.o trace/traffictrace.o tools/pareto.o \
tools/expoo.o tools/cbr_traffic.o \
adc/tbf.o adc/resv.o adc/sa.o tcp/saack.o \
tools/measuremod.o adc/estimator.o adc/adc.o adc/ms-adc.o \
adc/timewindow-est.o adc/acto-adc.o \
adc/pointsample-est.o adc/salink.o adc/actp-adc.o \
adc/hb-adc.o adc/expavg-est.o\
adc/param-adc.o adc/null-estimator.o \
adc/adaptive-receiver.o apps/vatrcvr.o adc/consrcvr.o \
common/agent.o common/message.o apps/udp.o \
common/session-rtp.o apps/rtp.o tcp/rtcp.o \
common/ivs.o \
common/messpass.o common/tp.o common/tpm.o apps/worm.o \
tcp/tcp.o tcp/tcp-sink.o tcp/tcp-reno.o \
tcp/tcp-newreno.o \
tcp/tcp-vegas.o tcp/tcp-rbp.o tcp/tcp-full.o tcp/rq.o \
baytcp/tcp-full-bay.o baytcp/ftpc.o baytcp/ftps.o \
tcp/scoreboard.o tcp/scoreboard-rq.o tcp/tcp-sack1.o tcp/tcp-fack.o \
tcp/tcp-asym.o tcp/tcp-asym-sink.o tcp/tcp-fs.o \
tcp/tcp-asym-fs.o \
tcp/tcp-int.o tcp/chost.o tcp/tcp-session.o \
tcp/nilist.o \
sctp/sctp.o apps/sctp_app1.o\
sctp/sctp-timestamp.o sctp/sctp-hbAfterRto.o \
sctp/sctp-multipleFastRtx.o sctp/sctp-mfrHbAfterRto.o \
sctp/sctp-mfrTimestamp.o \
sctp/sctp-cmt.o \
sctp/sctpDebug.o \
tools/integrator.o tools/queue-monitor.o \
tools/flowmon.o tools/loss-monitor.o \
queue/queue.o queue/drop-tail.o \
adc/simple-intserv-sched.o queue/red.o \
queue/semantic-packetqueue.o queue/semantic-red.o \
tcp/ack-recons.o \
queue/sfq.o queue/fq.o queue/drr.o queue/srr.o queue/cbq.o \
queue/jobs.o queue/marker.o queue/demarker.o \
link/hackloss.o queue/errmodel.o queue/fec.o\
link/delay.o tcp/snoop.o \
gaf/gaf.o \
link/dynalink.o routing/rtProtoDV.o common/net-interface.o \
mcast/ctrMcast.o mcast/mcast_ctrl.o mcast/srm.o \
common/sessionhelper.o queue/delaymodel.o \
mcast/srm-ssm.o mcast/srm-topo.o \
routing/alloc-address.o routing/address.o \
$(LIB_DIR)int.Vec.o $(LIB_DIR)int.RVec.o \
$(LIB_DIR)dmalloc_support.o \
webcache/http.o webcache/tcp-simple.o webcache/pagepool.o \
webcache/inval-agent.o webcache/tcpapp.o webcache/http-aux.o \
webcache/mcache.o webcache/webtraf.o \
webcache/webserver.o \
webcache/logweb.o \
empweb/empweb.o \
empweb/empftp.o \
realaudio/realaudio.o \
mac/lanRouter.o classifier/filter.o \
common/pkt-counter.o \
common/Decapsulator.o common/Encapsulator.o \
common/encap.o \
mac/channel.o mac/mac.o mac/ll.o mac/mac-802_11.o \
mac/mac-802_3.o mac/mac-tdma.o mac/smac.o \
mobile/mip.o mobile/mip-reg.o mobile/gridkeeper.o \
mobile/propagation.o mobile/tworayground.o \
mobile/antenna.o mobile/omni-antenna.o \
mobile/shadowing.o mobile/shadowing-vis.o mobile/dumb-agent.o \
common/bi-connector.o common/node.o \
common/mobilenode.o \
mac/arp.o mobile/god.o mobile/dem.o \
mobile/topography.o mobile/modulation.o \
queue/priqueue.o queue/dsr-priqueue.o \
mac/phy.o mac/wired-phy.o mac/wireless-phy.o \
mac/mac-timers.o trace/cmu-trace.o mac/varp.o \
mac/mac-simple.o \
satellite/sat-hdlc.o \
dsdv/dsdv.o dsdv/rtable.o queue/rtqueue.o \
routing/rttable.o \
imep/imep.o imep/dest_queue.o imep/imep_api.o \
imep/imep_rt.o imep/rxmit_queue.o imep/imep_timers.o \
imep/imep_util.o imep/imep_io.o \
tora/tora.o tora/tora_api.o tora/tora_dest.o \
tora/tora_io.o tora/tora_logs.o tora/tora_neighbor.o \
dsr/dsragent.o dsr/hdr_sr.o dsr/mobicache.o dsr/path.o \
dsr/requesttable.o dsr/routecache.o dsr/add_sr.o \
dsr/dsr_proto.o dsr/flowstruct.o dsr/linkcache.o \
dsr/simplecache.o dsr/sr_forwarder.o \
aodv/aodv_logs.o aodv/aodv.o \
aodv/aodv_rtable.o aodv/aodv_rqueue.o \
common/ns-process.o \
satellite/satgeometry.o satellite/sathandoff.o \
satellite/satlink.o satellite/satnode.o \
satellite/satposition.o satellite/satroute.o \
satellite/sattrace.o \
rap/raplist.o rap/rap.o rap/media-app.o rap/utilities.o \
common/fsm.o tcp/tcp-abs.o \
diffusion/diffusion.o diffusion/diff_rate.o diffusion/diff_prob.o \
diffusion/diff_sink.o diffusion/flooding.o diffusion/omni_mcast.o \
diffusion/hash_table.o diffusion/routing_table.o diffusion/iflist.o \
tcp/tfrc.o tcp/tfrc-sink.o mobile/energy-model.o apps/ping.o tcp/tcp-rfc793edu.o \
queue/rio.o queue/semantic-rio.o tcp/tcp-sack-rh.o tcp/scoreboard-rh.o \
plm/loss-monitor-plm.o plm/cbr-traffic-PP.o \
linkstate/hdr-ls.o \
mpls/classifier-addr-mpls.o mpls/ldp.o mpls/mpls-module.o \
routing/rtmodule.o classifier/classifier-hier.o \
routing/addr-params.o \
nix/hdr_nv.o nix/classifier-nix.o \
nix/nixnode.o \
routealgo/rnode.o \
routealgo/bfs.o \
routealgo/rbitmap.o \
routealgo/rlookup.o \
routealgo/routealgo.o \
nix/nixvec.o \
nix/nixroute.o \
diffserv/dsred.o diffserv/dsredq.o \
diffserv/dsEdge.o diffserv/dsCore.o \
diffserv/dsPolicy.o diffserv/ew.o diffserv/dewp.o \
queue/red-pd.o queue/pi.o queue/vq.o queue/rem.o \
queue/gk.o \
pushback/rate-limit.o pushback/rate-limit-strategy.o \
pushback/ident-tree.o pushback/agg-spec.o \
pushback/logging-data-struct.o \
pushback/rate-estimator.o \
pushback/pushback-queue.o pushback/pushback.o \
common/parentnode.o trace/basetrace.o \
common/simulator.o asim/asim.o \
common/scheduler-map.o common/splay-scheduler.o \
linkstate/ls.o linkstate/rtProtoLS.o \
pgm/classifier-pgm.o pgm/pgm-agent.o pgm/pgm-sender.o \
pgm/pgm-receiver.o mcast/rcvbuf.o \
mcast/classifier-lms.o mcast/lms-agent.o mcast/lms-receiver.o \
mcast/lms-sender.o \
queue/delayer.o \
xcp/xcpq.o xcp/xcp.o xcp/xcp-end-sys.o \
wpan/p802_15_4csmaca.o wpan/p802_15_4fail.o \
wpan/p802_15_4hlist.o wpan/p802_15_4mac.o \
wpan/p802_15_4nam.o wpan/p802_15_4phy.o \
wpan/p802_15_4sscs.o wpan/p802_15_4timer.o \
wpan/p802_15_4trace.o wpan/p802_15_4transac.o \
maser/maser.o maser/mamas.o \
$(OBJ_STL)
$(LINK) $(LDFLAGS) $(LDOUT)$# \
common/tclAppInit.o $(OBJ) $(LIB)
I figured out that the functions were declared but not implemented. As soon as I implemented them, the problem was solved.
Related
I am using autotools to build a project. I have a configure.ac, makefile.am and autogen.sh. This all works great. My Jenkins pipeline can pick this up and run it. My issue is the makefile.am is getting longer and longer. Recently I added some 3rd part vendor code to my project.
This is the current makefile.am
AUTOMAKE_OPTIONS = foreign subdir-objects
bin_PROGRAMS = MAIN_Application
MAIN_Application_LDADD = -lsocketcan -lpthread -lm
AM_CPPFLAGS = \
-I$(srcdir)/include \
-I$(srcdir)/include/utilities \
-I$(srcdir)/include/comms \
-I$(srcdir)/include/config_parsing \
-I$(srcdir)/vendor/my_vendor/host/include \
-I$(srcdir)/vendor/my_vendor/host/source/lib/comm_mgr/inc \
-I$(srcdir)/vendor/my_vendor/host/source/lib/mem_pool/inc \
-I$(srcdir)/vendor/my_vendor/host/source/lib/osal/inc \
-I$(srcdir)/vendor/my_vendor/production/source/lib/FFT \
-I$(srcdir)/vendor/my_vendor/public/common \
-I$(srcdir)/vendor/my_vendor/public/host \
-I$(srcdir)/vendor/my_vendor/public/production
MAIN_Application_SOURCES = \
src/main.cpp \
src/scheduler.c \
src/thread_health.c \
src/signal_handler.c \
src/utilities/time_conversions.c \
src/utilities/ring_buffer.c \
src/utilities/logger.c \
src/utilities/string_operations.c \
src/config_parsing/file_operations.c \
src/config_parsing/config_parser.c \
src/comms/can.c \
src/comms/can_ring_buffer.c \
vendor/my_vendor/production/source/lib/FFT/FFT.c \
vendor/my_vendor/production/source/PROD_lib.c \
vendor/my_vendor/host/source/HLB_helper.c \
vendor/my_vendor/host/source/HLB_nscm.c \
vendor/my_vendor/host/source/HLB_apcm.c \
vendor/my_vendor/host/source/HLB_fwload.c \
vendor/my_vendor/host/source/HLB_host.c \
vendor/my_vendor/host/source/HLB_noise_floor.c \
vendor/my_vendor/host/source/lib/mem_pool/src/mem_pool.c \
vendor/my_vendor/host/source/lib/comm_mgr/src/comm_mgr_lib.c \
vendor/my_vendor/host/source/lib/osal/src/osal.c \
vendor/my_vendor/host/source/HLB_legacy_commands.c \
vendor/my_vendor/host/source/HLB_protocol.c
Do I really have to include each .c file individually? Why does vendor/my_vendor/host/*/** not work? How can I compress this makefile.am?
Autotools developers consider it to be best practice to explicitly list all the source files. This avoids things like test or debug sources etc. creeping into distribution packages.
You can't use ** because this syntax is a non-standard extension available specifically in shells like bash and zsh, that is not supported by standard POSIX globbing (which is what make uses for its glob expansion).
I think it would work to use simple globbing (that is, *.c) in Makefile.am but of course you'd still need to use each directory.
Just to add:
You can also make your makefile "tidier" by breaking up the sources into sections. So for example you might have something like:
MAIN_Application_SOURCES = \
src/main.cpp \
src/scheduler.c \
src/thread_health.c \
src/signal_handler.c
MAIN_Application_SOURCES += \
src/utilities/time_conversions.c \
src/utilities/ring_buffer.c \
src/utilities/logger.c \
src/utilities/string_operations.c
MAIN_Application_SOURCES += \
src/config_parsing/file_operations.c \
src/config_parsing/config_parser.c
MAIN_Application_SOURCES += \
src/comms/can.c \
src/comms/can_ring_buffer.c
MAIN_Application_SOURCES += \
vendor/my_vendor/production/source/lib/FFT/FFT.c \
vendor/my_vendor/production/source/PROD_lib.c \
vendor/my_vendor/host/source/HLB_helper.c \
vendor/my_vendor/host/source/HLB_nscm.c \
vendor/my_vendor/host/source/HLB_apcm.c \
vendor/my_vendor/host/source/HLB_fwload.c \
vendor/my_vendor/host/source/HLB_host.c \
vendor/my_vendor/host/source/HLB_noise_floor.c \
vendor/my_vendor/host/source/lib/mem_pool/src/mem_pool.c \
vendor/my_vendor/host/source/lib/comm_mgr/src/comm_mgr_lib.c \
vendor/my_vendor/host/source/lib/osal/src/osal.c \
vendor/my_vendor/host/source/HLB_legacy_commands.c \
vendor/my_vendor/host/source/HLB_protocol.c
or something like that, or you could even use other variables and then add them together. Maybe that helps with readability.
I am trying write plugin to generate validate go files. Which uses https://github.com/mwitkow/go-proto-validators and envoy proxy validator https://github.com/envoyproxy/protoc-gen-validate. Below is my command
protoc \
--proto_path=${GOPATH}/src \
--proto_path=${GOPATH}/pkg/mod/github.com/gogo/protobuf#v1.3.2 \
--proto_path=${GOPATH}/pkg/mod/github.com/envoyproxy/protoc-gen-validate#v0.1.0
--proto_path=. \
--gogo_out=. \
—-validate_out=“lang=go:.\”
--govalidators_out=gogoimport=true:. \
proto/*.proto
when I run above command I am getting below error? any suggestion expert on how to resolve this. Appreciate your help.
zsh: command not found: --proto_path=.
zsh: command not found: --govalidators_out=gogoimport=true:.
After adding the missing "/"
protoc \
--proto_path=${GOPATH}/src \
--proto_path=${GOPATH}/pkg/mod/github.com/gogo/protobuf#v1.3.2 \
--proto_path=${GOPATH}/pkg/mod/github.com/envoyproxy/protoc-gen-validate#v0.1.0 \
--proto_path=. \
--gogo_out=. \
-—go_out=":./generated" \
—-validate_out="lang=go:./generated" \
--govalidators_out=gogoimport=true:. \
proto/test.proto
I am getting Unknown flag: -?
you missed \ after get-validate and later...
protoc \
--proto_path=${GOPATH}/src \
--proto_path=${GOPATH}/pkg/mod/github.com/gogo/protobuf#v1.3.2 \
--proto_path=${GOPATH}/pkg/mod/github.com/envoyproxy/protoc-gen-validate#v0.1.0 \
--proto_path=. \
--gogo_out=. \
—-validate_out="lang=go:." \
--govalidators_out=gogoimport=true:. \
proto/*.proto
below code from AOSP build/core/Makefile
If someone set INSTALLED_RAMDISK_TARGET as empty(by accident) then recoveryimage will have no RAMDISK
How can I check if each of the dependencies is empty or not?
or is there any other suggestion?
1016 $(INSTALLED_RECOVERYIMAGE_TARGET): $(MKBOOTFS) $(MKBOOTIMG) $(MINIGZIP) \
1017 $(INSTALLED_RAMDISK_TARGET) \
1018 $(INSTALLED_BOOTIMAGE_TARGET) \
1019 $(INTERNAL_RECOVERYIMAGE_FILES) \
1020 $(recovery_initrc) $(recovery_sepolicy) $(recovery_kernel) \
1021 $(INSTALLED_2NDBOOTLOADER_TARGET) \
1022 $(recovery_build_prop) $(recovery_resource_deps) \
1023 $(recovery_fstab) \
1024 $(RECOVERY_INSTALL_OTA_KEYS)
1025 $(call build-recoveryimage-target, $#)
I tried below method but in vain because foreach will skip variable which is empty
1016 RECOVERYIMAGE_REQUIRED := $(MKBOOTFS) $(MKBOOTIMG) $(MINIGZIP) \
1017 $(INSTALLED_RAMDISK_TARGET) \
1018 $(INSTALLED_BOOTIMAGE_TARGET) \
1019 $(INTERNAL_RECOVERYIMAGE_FILES) \
1020 $(recovery_initrc) $(recovery_sepolicy) $(recovery_kernel) \
1021 $(INSTALLED_2NDBOOTLOADER_TARGET) \
1022 $(recovery_build_prop) $(recovery_resource_deps) \
1023 $(recovery_fstab) \
1024 $(RECOVERY_INSTALL_OTA_KEYS)
1025 $(call build-recoveryimage-target, $#)
1026 $(foreach item,$(HOSDIMAGE_REQUIRED), \
1027 $(eval _item := $(strip $(item))) \
1028 $(if $(_item),$(info $(_item) checked),$(error dependency is empty)) \
1029 )
1030 $(INSTALLED_RECOVERYIMAGE_TARGET): $(RECOVERYIMAGE_REQUIRED)
Oh how I wish for a --error-undefined-variables to match the existing --warn-undefined-variables. In the mean time you can just use something like:
depvarnames := \
MKBOOTFS \
MKBOOTIMG \
MINIGZIP \
⋮
deps := $(foreach _,${depvarnames},$(or $_,$(error $$$_ is empty!)))
${INSTALLED_RECOVERYIMAGE_TARGET}: ${deps}
recipe
⋮
below is my solution, looks stupid but it really help me a lot
NULL :=
SPACE := $(NULL) $(NULL)
DQUOTE = "
RECOVERYIMAGE_REQUIRED := \
"$(MKBOOTFS)" \
"$(MKBOOTIMG)" \
"$(MINIGZIP)" \
"$(PRODUCT_OUT)/ramdisk.img" \
"$(PRODUCT_OUT)/boot.img" \
"$(rec_initrc)" \
"$(rec_kernel)" \
"$(rec_build_prop)" \
"$(rec_resource_deps)" \
"$(rec_fstab)"
$(foreach item, $(RECOVERYIMAGE_REQUIRED), \
$(eval _item := $(strip $(item))) \
$(if $(filter "", $(_item)),$(error dependency is empty),) \
)
RECOVERYIMAGE_OPTIONAL := \
"$(INSTALLED_2NDBOOTLOADER_TARGET)" \
$(foreach item, $(RECOVERYIMAGE_REQUIRED) $(RECOVERYIMAGE_OPTIONAL), \
$(if $(strip $(subst $(DQUOTE),$(SPACE),$(item))), \
$(eval RECOVERYIMAGE_FINAL_LIST += $(strip $(subst $(DQUOTE),$(SPACE),$(item)))), \
) \
)
$(INSTALLED_RECOVERYIMAGE_TARGET): $(RECOVERYIMAGE_FINAL_LIST)
I'm trying to compile php 5.6 on OsX Mavericks but in the middle of linking process I am receiving this error and do not know what to do with it.
Undefined symbols for architecture x86_64:
"_libiconv", referenced from:
_do_convert in gdkanji.o
_zif_iconv_substr in iconv.o
_zif_iconv_mime_encode in iconv.o
_php_iconv_string in iconv.o
__php_iconv_strlen in iconv.o
__php_iconv_strpos in iconv.o
_php_iconv_stream_filter_append_bucket in iconv.o
...
"_libiconv_close", referenced from:
_do_convert in gdkanji.o
_convert in encodings.o
"_libiconv_open", referenced from:
_do_convert in gdkanji.o
_convert in encodings.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [libs/libphp5.bundle] Error 1
This is my configure options:
sudo ./configure --prefix=/opt/local \
--mandir=/usr/share/man \
--enable-maintainer-zts \
--infodir=/usr/share/info \
--sysconfdir=/private/etc \
--with-apxs2=/usr/sbin/apxs \
--enable-cli \
--with-config-file-path=/etc \
--with-config-file-scan-dir=/Library/Server/Web/Config/php \
--with-libxml-dir=/usr \
--with-openssl=/usr \
--with-kerberos=/usr \
--with-zlib=/usr \
--enable-bcmath \
--with-bz2=/usr \
--enable-calendar \
--disable-cgi \
--with-curl=/usr \
--enable-dba \
--enable-exif \
--enable-fpm \
--enable-ftp \
--with-gd \
--with-freetype-dir=/BinaryCache/apache_mod_php/apache_mod_php-87.2~1/Root/usr/local \
--with-jpeg-dir=/BinaryCache/apache_mod_php/apache_mod_php-87.2~1/Root/usr/local \
--with-png-dir=/BinaryCache/apache_mod_php/apache_mod_php-87.2~1/Root/usr/local \
--enable-gd-native-ttf \
--with-icu-dir=/usr \
--with-ldap=/usr \
--with-ldap-sasl=/usr \
--with-libedit=/usr \
--enable-mbstring \
--enable-mbregex \
--with-mysql=mysqlnd \
--with-mysqli=mysqlnd \
--with-pear \
--with-pdo-mysql=mysqlnd \
--with-mysql-sock=/var/mysql/mysql.sock \
--with-readline=/usr \
--enable-shmop \
--with-snmp=/usr
--enable-soap \
--enable-sockets \
--enable-sysvmsg \
--enable-sysvsem \
--enable-sysvshm \
--with-tidy \
--enable-wddx\
--with-xmlrpc \
--with-iconv-dir=/usr \
--with-xsl=/usr \
--enable-zip \
--with-pcre-regex=/opt/local \
--with-vpx-dir=/usr/local/Cellar \
--with-xpm-dir=no
Any help determining the issue would be greatly appreciated. I have tried rebuilding libiconv with no success in fixing the issue. The backslashes on my configure options was put there to break up the really long line of options to make it more readable here so please dont correct me on that in the case that you think that might be the issue. Thanks in advance.
I am trying to compile ffmpeg for Android but for the x86 architecture. I've successfully compiled an arm .so and it all works, and I though that by replacing arm with x86 in the relevant places within the build script would have done the trick. Unfortunately that's not the case and I get some strange things occurring.
First I get this while it's compiling ffmpeg:
/home/ankur/android-ndk-r8/platforms/android-8/arch-arm//usr/include/strings.h:49: warning: redundant redeclaration of 'index'
Notice the arch-arm instead of arch-x86. Finally I get this:
/home/ankur/android-ndk-r8/toolchains/x86-4.4.3/prebuilt/linux-x86/bin/i686-android-linux-ld: libavcodec/libavcodec.a(4xm.o): Relocations in generic ELF (EM: 40)
/home/ankur/android-ndk-r8/toolchains/x86-4.4.3/prebuilt/linux-x86/bin/i686-android-linux-ld: libavcodec/libavcodec.a(4xm.o): Relocations in generic ELF (EM: 40)
/home/ankur/android-ndk-r8/toolchains/x86-4.4.3/prebuilt/linux-x86/bin/i686-android-linux-ld: libavcodec/libavcodec.a(4xm.o): Relocations in generic ELF (EM: 40)
libavcodec/libavcodec.a(4xm.o): could not read symbols: File in wrong format
The build script I've created looks like this:
#!/bin/bash
NDK=~/android-ndk-r8
PLATFORM=$NDK/platforms/android-8/arch-x86/
PREBUILT=$NDK/toolchains/x86-4.4.3/prebuilt/linux-x86
function build_one_r8
{
./configure \
--disable-shared \
--enable-static \
--enable-gpl \
--enable-version3 \
--enable-nonfree \
--disable-doc \
--disable-ffmpeg \
--disable-ffplay \
--disable-ffprobe \
--disable-ffserver \
--disable-avdevice \
--disable-avfilter \
--disable-postproc \
--enable-small \
--cross-prefix=$PREBUILT/bin/i686-android-linux- \
--enable-cross-compile \
--target-os=linux \
--extra-cflags="-I$PLATFORM/usr/include" \
--arch=x86 \
--disable-symver \
--disable-debug \
--disable-stripping \
$ADDITIONAL_CONFIGURE_FLAG
sed -i 's/HAVE_LRINT 0/HAVE_LRINT 1/g' config.h
sed -i 's/HAVE_LRINTF 0/HAVE_LRINTF 1/g' config.h
sed -i 's/HAVE_ROUND 0/HAVE_ROUND 1/g' config.h
sed -i 's/HAVE_ROUNDF 0/HAVE_ROUNDF 1/g' config.h
sed -i 's/HAVE_TRUNC 0/HAVE_TRUNC 1/g' config.h
sed -i 's/HAVE_TRUNCF 0/HAVE_TRUNCF 1/g' config.h
make clean
make -j4 install
$PREBUILT/bin/i686-android-linux-ar d libavcodec/libavcodec.a inverse.o
$PREBUILT/bin/i686-android-linux-ld -rpath-link=$PLATFORM/usr/lib -L$PLATFORM/usr/lib -soname libffmpeg.so -shared -nostdlib -z,noexecstack -Bsymbolic --whole-archive --no-undefined -o $PREFIX/libffmpeg.so libavcodec/libavcodec.a libavformat/libavformat.a libavutil/libavutil.a libswscale/libswscale.a -lc -lm -lz -ldl -llog --warn-once --dynamic-linker=/system/bin/linker $PREBUILT/lib/gcc/i686-android-linux/4.4.3/libgcc.a
}
function build_one_r8_2
{
$PREBUILT/bin/i686-android-linux-ar d libavcodec/libavcodec.a inverse.o
$PREBUILT/bin/i686-android-linux-ld -rpath-link=$PLATFORM/usr/lib -L$PLATFORM/usr/lib -soname libffmpeg.so -shared -nostdlib -z,noexecstack -Bsymbolic --whole-archive --no-undefined -o $PREFIX/libffmpeg.so libavcodec/libavcodec.a libavformat/libavformat.a libavutil/libavutil.a libswscale/libswscale.a -lc -lm -lz -ldl -llog --warn-once --dynamic-linker=/system/bin/linker $PREBUILT/lib/gcc/i686-android-linux/4.4.3/libgcc.a
}
#x86
CPU=x86
OPTIMIZE_CFLAGS="-march=$CPU "
PREFIX=./android/$CPU
ADDITIONAL_CONFIGURE_FLAG=
build_one_r8
I hope I'm doing something wrong rather than this not being possible.
Thanks!
I've been able to compile for the Atom, BUT the GoogleTV has no support for the NDK, which explains why all my attempts of compiling NDK for my GoogleTV device have not work. I hope it's coming soon!
Here's my build script, if it's helpful, I see a few things I have set that you don't seem to which may be part of your problem. I source it from on directory below the ffmpeg source dir (source). I.E. the script is called build.sh and resides in ~/android/ffmpeg, the ffmpeg source is in ~/android/ffmpeg/source and my build output ends up in ~/android/build/armeabi-v7a when I run the script as such:
~/android/ffmpeg$ source build.sh
This is build.sh:
#!/bin/bash
NDK=~/android/ndk
SYSROOT=$NDK/platforms/android-9/arch-arm
TOOLCHAIN=$NDK/toolchains/arm-linux-androideabi-4.4.3/prebuilt/linux-x86/bin/arm-linux-androideabi-
ABI="armeabi-v7a"
CPU="armv7-a"
ARCH="arm"
FPU="vfpv3-d16"
ANDROID_LIBS=$SYSROOT/usr/lib
DEST="../build/ffmpeg/$ABI"
EXTRA_LDFLAGS="-Wl,--fix-cortex-a8 -L$ANDROID_LIBS -Wl,-rpath-link,$ANDROID_LIBS"
EXTRA_CXXFLAGS="-Wno-multichar -Wno-psabi -fno-exceptions -fno-rtti"
EXTRA_CFLAGS="-DANDROID -marm -march=$CPU -mfloat-abi=softfp -mfpu=$FPU"
function configure
{
./configure \
--target-os=linux \
--prefix=$DEST \
--cross-prefix=$TOOLCHAIN \
--sysroot=$SYSROOT \
--extra-cflags="$EXTRA_CFLAGS" \
--extra-ldflags="$EXTRA_LDFLAGS" \
--extra-cxxflags="$EXTRA_CXXFLAGS" \
--enable-cross-compile \
--extra-libs="-lgcc" \
--arch=$ARCH \
--cpu=$CPU \
--disable-debug \
--disable-runtime-cpudetect \
--disable-optimizations \
--disable-neon \
--disable-network \
--disable-armv5te \
--disable-armv6 \
--disable-armv6t2 \
--disable-armvfp \
--disable-everything \
--disable-doc \
--disable-decoders \
--disable-encoders \
--disable-demuxers \
--disable-muxers \
--disable-protocols \
--disable-indevs \
--disable-filters \
--disable-outdevs \
--disable-bsfs \
--disable-shared \
--disable-ffprobe \
--disable-ffserver \
--disable-avfilter \
--disable-swresample \
--disable-avdevice \
--disable-ffplay \
--disable-ffmpeg \
--disable-swscale-alpha \
--disable-avresample \
--enable-static \
--enable-pthreads \
--enable-protocol=file \
--enable-libvpx \
--enable-decoder=vp8 \
--enable-parser=vp8 \
--enable-demuxer=matroska
}
cd source
make clean &&
configure &&
make -j8 &&
rm -rf $DEST &&
mkdir -p $DEST &&
make install