AOSP hardware automotive interface - compiling vehicleManager_fuzzer errors - c++

I'm trying to build the vehicleManager_fuzzer in AOSP using the given instructions in the README (mm -j8 vehicleManager_fuzzer) and I get the following error:
[ 98% 3565/3607] //hardware/interfaces/automotive/vehicle/2.0/default:vehicleManager_fuzzer link vehicleManager_fuzzer
FAILED: out/soong/.intermediates/hardware/interfaces/automotive/vehicle/2.0/default/vehicleManager_fuzzer/android_vendor.UpsideDownCake_x86_64_asan_fuzzer/unstripped/vehicleManager_fuzzer
prebuilts/clang/host/linux-x86/clang-r475365b/bin/clang++ out/soong/.intermediates/bionic/libc/crtbegin_dynamic/android_vendor.UpsideDownCake_x86_64/crtbegin_dynamic.o #out/soong/.intermediates/hardware/interfaces/automotive/vehicle/2.0/d
efault/vehicleManager_fuzzer/android_vendor.UpsideDownCake_x86_64_asan_fuzzer/unstripped/vehicleManager_fuzzer.rsp out/soong/.intermediates/bionic/libc/crtend_android/android_vendor.UpsideDownCake_x86_64/crtend_android.o -o out/soong/.int
ermediates/hardware/interfaces/automotive/vehicle/2.0/default/vehicleManager_fuzzer/android_vendor.UpsideDownCake_x86_64_asan_fuzzer/unstripped/vehicleManager_fuzzer -target x86_64-linux-android10000 -Wl,-z,noexecstack -Wl,-z,relro -Wl,-z
,now -Wl,--build-id=md5 -Wl,--fatal-warnings -Wl,--no-undefined-version -Wl,--exclude-libs,libgcc.a -Wl,--exclude-libs,libgcc_stripped.a -Wl,--exclude-libs,libunwind_llvm.a -Wl,--exclude-libs,libunwind.a -fuse-ld=lld -Wl,--icf=safe -Wl,--
pack-dyn-relocs=android+relr -Wl,--no-undefined -Wl,--hash-style=gnu -m64 -pie -nostdlib -Bdynamic -Wl,--gc-sections -Wl,-z,nocopyreloc -Wl,-rpath,\$ORIGIN/lib -Wl,-rpath,\$ORIGIN/../../lib -Wl,-u,__asan_preinit -fno-lto -fno-sanitize-cov
erage=stack-depth -Wl,-rpath,\$ORIGIN -fsanitize=address,fuzzer-no-link -fno-sanitize-link-runtime -Wl,--exclude-libs=libclang_rt.builtins-x86_64-android.a -Wl,-dynamic-linker,/system/bin/linker_asan64
ld.lld: error: undefined symbol: LLVMFuzzerTestOneInput
>>> referenced by FuzzerMain.cpp:20 (out/llvm-project/compiler-rt/lib/fuzzer/FuzzerMain.cpp:20)
>>> FuzzerMain.cpp.o:(main) in archive prebuilts/clang/host/linux-x86/clang-r475365b/lib/clang/16.0.2/lib/linux/libclang_rt.fuzzer-x86_64-android.a
clang-16: error: linker command failed with exit code 1 (use -v to see invocation)
I checked the file mentioned and it is existent.
I managed to get it working before, but after doing system updates, repo resyncing and trying to build AFL++, it stopped working.

Related

How can I install the "sub" library for g++ compilation for Festvox?

I'm trying to configure and make festvox, but when I attempt making it, g++ shows errors with things such as -fpermissive and how it cannot locate the library "sub". How can I get the library?
Here is a part of the logs:
making in src/vc/src/analysis ...
g++ -o analysis main.o analysis_sub.o -L../lib -lsub -lsp
/usr/bin/ld: cannot find -lsub
collect2: error: ld returned 1 exit status
make[4]: *** [Makefile:65: analysis] Error 1
making in src/vc/src/extdim ...
g++ -o extdim main.o -L../lib -lsub -lsp
/usr/bin/ld: cannot find -lsub
I have already tried using apt-get to see if the library resides in the repo, but I can't be sure that any of them actually stop the issue.
I instead got Festival through apt. I felt at first that it would outdated, but it seems to be as up to date on there as on the website.
sudo apt install festival

libgtest.so error adding symbols: DSO missing from command line

I have been using gtests for unit testing a personal project. Last week I upgraded to the LTS version of Linux Mint. Unfortunately, after that event, I haven't been able to compile my project due to gtests linking problems.
The following error is being issued:
/usr/bin/x86_64-linux-gnu-ld: build/tests/policies/roundrobin_tests.o: undefined reference to symbol '_ZN7testing4TestC2Ev'
/home/myuser/Documents/googletest-release-1.8.0/googletest/libgtest.so: error adding symbols: DSO missing from command line
collect2: error: ld returned 1 exit status
I have generated both libgtest.so and libgtest_main.so through CMake 3.10.2. The gtest version is the release-1.8.0, the same I used to have before.
Those libraries are located in /usr/lib and the corresponding include folder has also been copied to /usr/include. I made sure that this location is in my ld path and that is not the problem.
My compiler is g++ v7.3.0 and the command Im using to compile the testes is:
g++ -std=c++14 -Wall -O3 -Iinclude build/tests/policies/roundrobin_tests.o -lgtest_main -pthread -o bin/policies/roundrobin_tests
I have tried altering the order of the elements in the command, explicitly adding -L/usr/lib and -I/usr/include without luck. A funny fact is that if I take off the -pthread flag, the error is still the same.
The same command was used before and the only difference is the compiler version I am using now as I used g++ 5.4.0 before. Any insights on how to solve this?
edit: Just tested the same process with g++ 5.4.0 and CMake 3.5 and the same problems ocurred.

C++ exceptions not getting caught with GNU gcc libstdc++ 4.3.6 on AIX 7.1

I'm trying to get a port of our product to AIX that someone did 9 years ago working again, so I'm using gcc 4.3.6 on AIX 7.1 - the code builds without errors, and runs until we first throw an exception, but then the catch block that should catch it (and does on Linux) never gets called, and the execution terminates due to the uncaught exception. I've added test code where the throw and the catch are in the same function, so that it's not trying to cross any module boundaries or do any stack unwinding, and even that doesn't work:
try {
throw std::runtime_error("Just testing throw-catch");
} catch (std::runtime_error& e) {
// We don't get here
So it seems like something is very sick in our libstdc++ exception handling. The gcc & libstdc++ 4.3.6 we're using are from RPMs downloaded from the www.perzl.org/aix repository, so they should be built correctly, and looking at the autoconf log from setting up our makefiles for AIX they seem to have been located correctly. So I'm guessing it must be something in our environment or the linking process for my executable. We're using the preinstalled (on a VM provided by IBM) AIX native linker ld, rather than the gnu linker, which I gather is the correct thing to do on AIX. I've confirmed that the libstdc++.a library archive that we're using contains a .so library, so I believe we're linking libstdc++ dynamically. If it's relevant, here's some gory details of build flags etc:
/usr/local/tools/powerpc_AIX71/gcc-4.3.6/bin/g++ -DHAVE_CONFIG_H -I. -I../.. -I/usr/nimbus/nimbus/agent/util/tests -I/usr/local/tools/powerpc_AIX71/cppunit/include -I/usr/nimbus/nimbus/agent -I/usr/local/tools/powerpc_AIX71/boost-1.33.1/include -DECVERSION='"7.2.0.0"' -I/usr/local/tools/powerpc_AIX71/openssl-0.9.8y/include -I/usr/nimbus/nimbus/agent -I/usr/local/tools/powerpc_AIX71/boost-1.33.1/include -DECVERSION='"7.2.0.0"' -DUSE_PROFILING -DUSE_LOGGING -DHAVE_UNIX -DHAVE_AIX -g -O2 -c -o testrunner-TestSystem-unix.o `test -f 'unix/TestSystem-unix.cpp' || echo '/usr/nimbus/nimbus/agent/util/tests/'`unix/TestSystem-unix.cpp
rm -f buildinfo.cpp; echo '#include <util/buildinfo.h>' >buildinfo.cpp; echo >>buildinfo.cpp; echo 'const char *BuildInfo = "u0016760__0_OPT_2017.02.08_10:38:05";' >>buildinfo.cpp; /usr/local/tools/powerpc_AIX71/gcc-4.3.6/bin/g++ -DHAVE_CONFIG_H -I. -I../.. -I/usr/nimbus/nimbus/agent/util/tests -I/usr/nimbus/nimbus/agent -I/usr/local/tools/powerpc_AIX71/boost-1.33.1/include -DECVERSION='"7.2.0.0"' -DUSE_PROFILING -DUSE_LOGGING -DHAVE_UNIX -DHAVE_AIX -g -O2 -c buildinfo.cpp; /opt/freeware/bin/bash ../../libtool --tag=CXX --mode=link /usr/local/tools/powerpc_AIX71/gcc-4.3.6/bin/g++ -DUSE_PROFILING -DUSE_LOGGING -DHAVE_UNIX -DHAVE_AIX -g -O2 -static-libgcc -L../.. -o testrunner buildinfo.o testrunner-TestAtomicValue.o testrunner-TestCondition.o testrunner-TestCounter.o testrunner-TestECVersion.o testrunner-TestExec.o testrunner-TestExecTimeProfiler.o testrunner-TestExpirableStack.o testrunner-TestFileAttributes.o testrunner-TestGetOpt.o testrunner-TestHTTPStream.o testrunner-TestLock.o testrunner-TestLogger.o testrunner-TestMutex.o testrunner-TestNamedTimer.o testrunner-TestRBList.o testrunner-TestRange.o testrunner-TestRefCount.o testrunner-TestServerSocket.o testrunner-TestSlidingWindow.o testrunner-TestSSLSocket.o testrunner-TestSSLSocketFactory.o testrunner-TestSingleton.o testrunner-TestStringKey.o testrunner-TestStringUtilities.o testrunner-TestSubString.o testrunner-TestSystem.o testrunner-TestTCPRawStream.o testrunner-TestTCPSocket.o testrunner-TestTCPStream.o testrunner-TestThreadPool.o testrunner-TestTSDVar.o testrunner-TestTask.o testrunner-TestThread.o testrunner-TestTicks.o testrunner-TestTime.o testrunner-TestTimer.o testrunner-TestWinEnv.o testrunner-Testfilefun.o testrunner-TinyHTTP.o testrunner-Testpathfun.o testrunner-utiltestutil.o testrunner-TestDouble.o testrunner-TestLockedFile-unix.o testrunner-TestSystem-unix.o ../../testmain/libtestmain.a -L/usr/local/tools/powerpc_AIX71/cppunit/lib -lcppunit ../../util/libutil.a -lpthread -L/usr/local/tools/powerpc_AIX71/openssl-0.9.8y/lib -lssl -lcrypto
libtool: link: warning: library `/usr/local/tools/powerpc_AIX71/cppunit/lib/libcppunit.la' was moved.
libtool: link: warning: library `/usr/local/tools/powerpc_AIX71/cppunit/lib/libcppunit.la' was moved.
/usr/local/tools/powerpc_AIX71/gcc-4.3.6/bin/g++ -DUSE_PROFILING -DUSE_LOGGING -DHAVE_UNIX -DHAVE_AIX -g -O2 -static-libgcc -o testrunner buildinfo.o testrunner-TestAtomicValue.o testrunner-TestCondition.o testrunner-TestCounter.o testrunner-TestECVersion.o testrunner-TestExec.o testrunner-TestExecTimeProfiler.o testrunner-TestExpirableStack.o testrunner-TestFileAttributes.o testrunner-TestGetOpt.o testrunner-TestHTTPStream.o testrunner-TestLock.o testrunner-TestLogger.o testrunner-TestMutex.o testrunner-TestNamedTimer.o testrunner-TestRBList.o testrunner-TestRange.o testrunner-TestRefCount.o testrunner-TestServerSocket.o testrunner-TestSlidingWindow.o testrunner-TestSSLSocket.o testrunner-TestSSLSocketFactory.o testrunner-TestSingleton.o testrunner-TestStringKey.o testrunner-TestStringUtilities.o testrunner-TestSubString.o testrunner-TestSystem.o testrunner-TestTCPRawStream.o testrunner-TestTCPSocket.o testrunner-TestTCPStream.o testrunner-TestThreadPool.o testrunner-TestTSDVar.o testrunner-TestTask.o testrunner-TestThread.o testrunner-TestTicks.o testrunner-TestTime.o testrunner-TestTimer.o testrunner-TestWinEnv.o testrunner-Testfilefun.o testrunner-TinyHTTP.o testrunner-Testpathfun.o testrunner-utiltestutil.o testrunner-TestDouble.o testrunner-TestLockedFile-unix.o testrunner-TestSystem-unix.o -L/usr/nimbus/out/powerpc_AIX71/nimbus/agent ../../testmain/libtestmain.a -L/usr/local/tools/powerpc_AIX71/cppunit/lib /usr/local/tools/powerpc_AIX71/cppunit/lib/libcppunit.a ../../util/libutil.a -lpthread -L/usr/local/tools/powerpc_AIX71/openssl-0.9.8y/lib -lssl -lcrypto
ld: 0711-224 WARNING: Duplicate symbol: .bcopy
ld: 0711-224 WARNING: Duplicate symbol: .virtual thunk to CppUnit::OStringStream::~OStringStream()
ld: 0711-224 WARNING: Duplicate symbol: .virtual thunk to CppUnit::OStringStream::~OStringStream()
ld: 0711-224 WARNING: Duplicate symbol: virtual thunk to CppUnit::OStringStream::~OStringStream()
ld: 0711-224 WARNING: Duplicate symbol: virtual thunk to CppUnit::OStringStream::~OStringStream()
ld: 0711-345 Use the -bloadmap or -bnoquiet option to obtain more information.
The various warnings look unrelated to me. Does anyone have any suggestions of what to check next?

C++ implementing CNN Error adding symbols: DSO missing from command line

I'm testing a CNN implementation provided here. I run the command:
make cifar10 && ./cifar10
But I got the following messages:
g++ -o cifar10 BatchProducer.o ConvolutionalLayer.o ConvolutionalTriangularLayer.o IndexLearnerLayer.o MaxPoolingLayer.o MaxPoolingTriangularLayer.o NetworkArchitectures.o NetworkInNetworkLayer.o Picture.o Regions.o Rng.o SigmoidLayer.o SoftmaxClassifier.o SparseConvNet.o SparseConvNetCUDA.o SpatiallySparseBatch.o SpatiallySparseBatchInterface.o SpatiallySparseDataset.o SpatiallySparseLayer.o TerminalPoolingLayer.o cudaUtilities.o readImageToMat.o types.o utilities.o vectorCUDA.o vectorHash.o OpenCVPicture.o SpatiallySparseDatasetCIFAR10.o cifar10.o -lopencv_core -lopencv_highgui -lopencv_imgproc -lrt -larmadillo -lopenblas -lz --std=c++11 -O3
/usr/bin/ld: BatchProducer.o: undefined reference to symbol 'pthread_create##GLIBC_2.2.5'
//lib/x86_64-linux-gnu/libpthread.so.0: error adding symbols: DSO missing from command line
collect2: error: ld returned 1 exit status
make: *** [cifar10] Error 1
What's wrong with this? I installed all the dependencies listed in the webpage. I did not install CUDA because I tested the CPU version here. Therefore I don't think the error is due to missing CUDA.
I'm using Ubuntu 14.04 and gcc 5.3.0.
Thank you all for helping me!!!
Solution: add '-lz' to your makefile / GCC flags. In other words, your simply missing a library in your make steps, and check if you installled all dependencies
sudo apt-get install libarmadillo-dev libopencv-core-dev libopencv-highgui-dev sparsehash

Problem in building my own module in omnetpp

I'm trying to write an application using the UDP module included
in the inetmanet framework in omnetpp. The problem is that the files that I have to include don't get included in the linking phase.
The errors are:
opp_makemake
bedo#ethereal:~/omnetpp/samples/Basic-Broadcast-Simulation$ opp_makemake --deep -f -I../inet-sommer/src/transport/contract -I../inet-sommer/src/networklayer/contract -I../inet-sommer/src/base
Creating Makefile in /home/bedo/omnetpp/samples/Basic-Broadcast-Simulation...
Makefile created, running "make depend" to add dependencies...
opp_makedep -Y --objdirtree -I../inet-sommer/src/transport/contract -I../inet-sommer/src/networklayer/contract -I../inet-sommer/src/base -I. -Igcc-debug -Igcc-debug/src -Igcc-debug/src/flooding -Isimulations -Isimulations/bitmaps -Isimulations/results -Isrc -Isrc/flooding -f Makefile -P\$O/ -- ./*.cc gcc-debug/*.cc gcc-debug/src/*.cc gcc-debug/src/flooding/*.cc simulations/*.cc simulations/bitmaps/*.cc simulations/results/*.cc src/*.cc src/flooding/*.cc
make
bedo#ethereal:~/omnetpp/samples/Basic-Broadcast-Simulation$ make
g++ -c -g -Wall -fno-stack-protector -DHAVE_PCAP -DXMLPARSER=libxml -DWITH_PARSIM -DWITH_NETBUILDER -I../inet-sommer/src/transport/contract -I../inet-sommer/src/networklayer/contract -I../inet-sommer/src/base -I. -Igcc-debug -Igcc-debug/src -Igcc-debug/src/flooding -Isimulations -Isimulations/bitmaps -Isimulations/results -Isrc -Isrc/flooding -I/home/bedo/omnetpp/include -o out/gcc-debug//src/flooding/Flooding.o src/flooding/Flooding.cc
src/flooding/Flooding.cc: In member function ‘virtual void Flooding::handleLowerMsg(cMessage*)’:
src/flooding/Flooding.cc:82: warning: unused variable ‘m’
g++ -Wl,--export-dynamic -Wl,-rpath,/home/bedo/omnetpp/lib -Wl,-rpath,. -o out/gcc-debug//Basic-Broadcast-Simulation out/gcc-debug//src/flooding/Flooding.o -Wl,--whole-archive -Wl,--no-whole-archive -L"/home/bedo/omnetpp/lib/gcc" -L"/home/bedo/omnetpp/lib" -u _tkenv_lib -lopptkenvd -loppenvird -lopplayoutd -u _cmdenv_lib -loppcmdenvd -loppenvird -loppsimd -ldl -lstdc++
out/gcc-debug//src/flooding/Flooding.o: In function `Flooding::setupLowerLayer()':
/home/bedo/omnetpp/samples/Basic-Broadcast-Simulation/src/flooding/Flooding.cc:50: undefined reference to `UDPControlInfo::UDPControlInfo()'
/home/bedo/omnetpp/samples/Basic-Broadcast-Simulation/src/flooding/Flooding.cc:52: undefined reference to `UDPSocket::generateSocketId()'
out/gcc-debug//src/flooding/Flooding.o: In function `Flooding::sendMessage()':
/home/bedo/omnetpp/samples/Basic-Broadcast-Simulation/src/flooding/Flooding.cc:101: undefined reference to `UDPControlInfo::UDPControlInfo()'
/home/bedo/omnetpp/samples/Basic-Broadcast-Simulation/src/flooding/Flooding.cc:103: undefined reference to `IPAddress::ALL_HOSTS_MCAST'
collect2: ld returned 1 exit status
make: *** [out/gcc-debug//Basic-Broadcast-Simulation] Error 1
bedo#ethereal:~/omnetpp/samples/Basic-Broadcast-Simulation$
I really don't know why they get included, and my module compile fine, but in the linking phase I get "undefined reference".
Any idea?
You can run nm on on all libraries you link with to see which library undefined symbols like this:
nm liboppcmdenvd.(so/a) | c++filt | grep UDPControlInfo
(c++filt demangles C++ symbols).
Library that requires the symbol will get output something like (U for Undefined):
00000000007f90a0 U UDPControlInfo
Library that defines/has the symbol will get output something like:
00000000007f90a0 T UDPControlInfo
This can be T or t
Of course, libraries you link with are indicated by arguments with starting by -l:
-lopptkenvd -loppenvird -lopplayoutd -u _cmdenv_lib -loppcmdenvd -loppenvird
liboppcmdenvd liboppenvird liboppsimd libUDPControlInfo
Solved. I modified the makefile in the root directory to a simpler one, leaving all the compile and linking duties to the src's makefile.
Thanks everyone