failed cross compiling aws webrtc library - c

I'm trying to cross compile aws webrtc library(https://github.com/awslabs/amazon-kinesis-video-streams-webrtc-sdk-c) for arm. So I followed the instruction on Readme.md but I failed.
What I did
export CC=arm-linux-gnueabihf-gcc
export CXX=arm-linux-gnueabihf-g++
cmake .. -DBUILD_TEST=TRUE -DBUILD_OPENSSL=TRUE -DBUILD_STATIC_LIBS=TRUE -DBUILD_OPENSSL_PLATFORM=linux-generic32 -DBUILD_LIBSRTP_HOST_PLATFORM=x86_64-pc-linux-gnu -DBUILD_LIBSRTP_DESTINATION_PLATFORM=arm-unknown-linux-uclibcgnueabi
The error I encountered
Scanning dependencies of target kvsCommonLws
[ 26%] Building C object CMakeFiles/kvsCommonLws.dir/src/source/Common/Auth.c.o
In file included from /home/jacob/Workspace/Github/amazon-kinesis-video-streams-webrtc-sdk-c/open-source/libkvsCommonLws/build/src/libkvsCommonLws-download/src/source/Common/Include_i.h:41,
from /home/jacob/Workspace/Github/amazon-kinesis-video-streams-webrtc-sdk-c/open-source/libkvsCommonLws/build/src/libkvsCommonLws-download/src/source/Common/Auth.c:5:
/home/jacob/Workspace/Github/amazon-kinesis-video-streams-webrtc-sdk-c/open-source/include/libwebsockets.h:120:10: fatal error: sys/capability.h: No such file or directory
120 | #include <sys/capability.h>
| ^~~~~~~~~~~~~~~~~~
compilation terminated.
CMakeFiles/kvsCommonLws.dir/build.make:62: recipe for target 'CMakeFiles/kvsCommonLws.dir/src/source/Common/Auth.c.o' failed
make[5]: *** [CMakeFiles/kvsCommonLws.dir/src/source/Common/Auth.c.o] Error 1
make[4]: *** [CMakeFiles/kvsCommonLws.dir/all] Error 2
CMakeFiles/Makefile2:67: recipe for target 'CMakeFiles/kvsCommonLws.dir/all' failed
Makefile:129: recipe for target 'all' failed
CMakeFiles/libkvsCommonLws-download.dir/build.make:111: recipe for target 'build/src/libkvsCommonLws-download-stamp/libkvsCommonLws-download-build' failed
make[3]: *** [all] Error 2
make[2]: *** [build/src/libkvsCommonLws-download-stamp/libkvsCommonLws-download-build] Error 2
make[1]: *** [CMakeFiles/libkvsCommonLws-download.dir/all] Error 2
CMakeFiles/Makefile2:67: recipe for target 'CMakeFiles/libkvsCommonLws-download.dir/all' failed
Makefile:83: recipe for target 'all' failed
make: *** [all] Error 2
CMake Error at CMake/Utilities.cmake:65 (message):
CMake step for libkvsCommonLws failed: 2
Call Stack (most recent call first):
CMakeLists.txt:150 (build_dependency)

Something is wrong with your ARM toolchain or how the build system uses it. Where did you get it from and how did you install it?
The header sys/capability.h is included with the ARM toolchain. For example, when I install the Debian package gcc-arm-linux-gnueabihf then this header file gets copied to /usr/arm-linux-gnueabihf/include/linux/capability.h. The toolchain is supposed to find it there on its own.
The command arm-linux-gnueabihf-gcc -v will show you where the toolchain is configured to look for its own header files. E.g. in output below it's --includedir=/usr/arm-linux-gnueabihf/include that matters, the header should be found relative to this directory. I apologize for the super long line.
$ arm-linux-gnueabihf-gcc -v
Using built-in specs.
COLLECT_GCC=/usr/bin/arm-linux-gnueabihf-gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc-cross/arm-linux-gnueabihf/10/lto-wrapper
Target: arm-linux-gnueabihf
Configured with: ../src/configure -v --with-pkgversion='Debian 10.2.1-1' --with-bugurl=file:///usr/share/doc/gcc-10/README.Bugs --enable-languages=c,ada,c++,go,d,fortran,objc,obj-c++,m2 --prefix=/usr --with-gcc-major-version-only --program-suffix=-10 --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-gnu-unique-object --disable-libitm --disable-libquadmath --disable-libquadmath-support --enable-plugin --enable-default-pie --with-system-zlib --enable-libphobos-checking=release --without-target-system-zlib --enable-multiarch --disable-sjlj-exceptions --with-arch=armv7-a --with-fpu=vfpv3-d16 --with-float=hard --with-mode=thumb --disable-werror --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=arm-linux-gnueabihf --program-prefix=arm-linux-gnueabihf- --includedir=/usr/arm-linux-gnueabihf/include --with-build-config=bootstrap-lto-lean --enable-link-mutex
Thread model: posix
Supported LTO compression algorithms: zlib
gcc version 10.2.1 20201207 (Debian 10.2.1-1)
You can also try increasing the verbosity of your cmake build process to verify that it's calling the right cross compiler. I've forgotten the details, but perhaps adding a flag -v will help.

Related

Error in running Makefile using cross compiler

my Makefile is
obj-m := hello.o
PWD := $(shell pwd)
KERNELDIR := /lib/modules/4.4.0-130-generic/build#$(shell uname -r)/build/
default:
make -C $(KERNELDIR) M=$(PWD) #ARCH=$(ARCH) CROSS_COMPILE=$(COMPILER) modules
clean:
make -C $(KERNELDIR) M=$(PWD) #ARCH=$(ARCH) clean
I want to compile it using cross compiler. I am compiling it using
make ARCH=arm CROSS_COMPILE=arm-none-linux-gnueabi-
It throws error:
satya#satya-dev:~/Test/kernal$ make ARCH=arm CROSS_COMPILE=arm-none-linux-gnueabi-
make -C /lib/modules/4.4.0-130-generic/build M=/home/satya/Test/kernal #ARCH=arm CROSS_COMPILE= modules
make[1]: Entering directory '/usr/src/linux-headers-4.4.0-130-generic'
Makefile:704: Cannot use CONFIG_CC_STACKPROTECTOR_STRONG: -fstack-protector-strong not supported by compiler
make[1]: arm-none-linux-gnueabi-gcc: Command not found
LD /home/satya/Test/kernal/built-in.o
/bin/sh: arm-none-linux-gnueabi-ar: command not found
scripts/Makefile.build:418: recipe for target '/home/satya/Test/kernal/built-in.o' failed
make[2]: *** [/home/satya/Test/kernal/built-in.o] Error 127
Makefile:1437: recipe for target '_module_/home/satya/Test/kernal' failed
make[1]: *** [_module_/home/satya/Test/kernal] Error 2
make[1]: Leaving directory '/usr/src/linux-headers-4.4.0-130-generic'
Makefile:7: recipe for target 'default' failed
make: *** [default] Error 2
satya#satya-dev:~/Test/kernal$
When search in forum for it is mentioned that compiler is 32 bit, but my compiler is 64 bit.
satya#satya-dev:~/Test/kernal$ uname -m
x86_64
Even gcc is updated one.
satya#satya-dev:~/Test/kernal$ gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/5/lto-wrapper
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Ubuntu 5.4.0-6ubuntu1~16.04.10' --with-bugurl=file:///usr/share/doc/gcc-5/README.Bugs --enable-languages=c,ada,c++,java,go,d,fortran,objc,obj-c++ --prefix=/usr --program-suffix=-5 --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-gnu-unique-object --disable-vtable-verify --enable-libmpx --enable-plugin --with-system-zlib --disable-browser-plugin --enable-java-awt=gtk --enable-gtk-cairo --with-java-home=/usr/lib/jvm/java-1.5.0-gcj-5-amd64/jre --enable-java-home --with-jvm-root-dir=/usr/lib/jvm/java-1.5.0-gcj-5-amd64 --with-jvm-jar-dir=/usr/lib/jvm-exports/java-1.5.0-gcj-5-amd64 --with-arch-directory=amd64 --with-ecj-jar=/usr/share/java/eclipse-ecj.jar --enable-objc-gc --enable-multiarch --disable-werror --with-arch-32=i686 --with-abi=m64 --with-multilib-list=m32,m64,mx32 --enable-multilib --with-tune=generic --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu
Thread model: posix
gcc version 5.4.0 20160609 (Ubuntu 5.4.0-6ubuntu1~16.04.10)
Any suggestions to compile this?
When search in forum for it is mentioned that compiler is 32 bit, but my compiler is 64 bit.
satya#satya-dev:~/Test/kernal$ uname -m
x86_64
The architecture of your running system doesn't have anything to do with your compiler. Adding to that, you're cross compiling (or, trying to), so your default compiler isn't relevant either.
The error message is actually quite obvious:
/bin/sh: arm-none-linux-gnueabi-gcc: command not found
So, you just don't have a cross-compiler for arm installed, at least not in your search path.

Qemu static configure error (thread local storage)

I'm trying to compile Qemu for this target in a static way : {arm-linux-user, armeb-linux-user, arm-softmmu}.
here is this configure command I'm using :
./configure --target-list="arm-linux-user armeb-linux-user arm-softmmu" --disable-werror --enable-debug --static
When I'm executing this command I got the following error :
C++ compiler c++ does not work with C compiler cc Disabling C++
specific optional code
ERROR: Your compiler does not support the __thread specifier for
Thread-Local Storage (TLS). Please upgrade to a version that does.
Or, my cc version is 5.1.1 so this is quite new :
[lionel#localhost qemu]$ cc -v
Utilisation des specs internes.
COLLECT_GCC=cc
COLLECT_LTO_WRAPPER=/usr/libexec/gcc/x86_64-redhat-linux/5.1.1/lto-wrapper
Cible : x86_64-redhat-linux
Configuré avec: ../configure --enable-bootstrap --enable-languages=c,c++,objc,obj-c++,fortran,ada,go,lto --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --with-bugurl=http://bugzilla.redhat.com/bugzilla --enable-shared --enable-threads=posix --enable-checking=release --enable-multilib --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-gnu-unique-object --enable-linker-build-id --with-linker-hash-style=gnu --enable-plugin --enable-initfini-array --disable-libgcj --with-isl --enable-libmpx --enable-gnu-indirect-function --with-tune=generic --with-arch_32=i686 --build=x86_64-redhat-linux
Thread model: posix
gcc version 5.1.1 20150618 (Red Hat 5.1.1-4) (GCC)
I can compile it normally without the "--static" argument. I need to compile it in static way as I am trying to chroot into a filesystem where binaries are ELF arm executable..
If it is not possible I could possibly use qemu-system-arm to emulate to board.
Configure will also produce this error message if your linker is broken (ie trying to compile a .c program to an executable doesn't work), because the TLS check happens to be the first one which tries to do that -- in this case it will print a misleading error message. In this case your compiler is definitely new enough to handle __thread, so you should check whether your linker works OK. Looking in config.log will show all the programs QEMU's configure script tried to run and their output.
(I just submitted a patch -- http://patchwork.ozlabs.org/patch/548123/ -- which will result in a less confusing warning if your linker doesn't work.)

configure: error: cannot run C compiled programs

I'm trying to install different software onto my Raspberry Pi with Debian Wheezy OS. When I run try to configure software I'm trying to install I get this output
checking for C compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... configure: error: in 'directory of where I'm installing the software'
configure: error: cannot run C compiled programs.
If you meant to cross compile, use '--host'.
See config.log' for more details
So then I check the config log and it basically says the same thing, the only difference is I see there was a segfault when checking whether cross compiling:
configure:3547: checking for suffix of executables
configure:3554: /usr/bin/gcc -o conftest -Wno-long-long conftest.c >&5
configure:3558: $? = 0
configure:3580: result:
configure:3602: checking whether we are cross compiling
configure:3610: /usr/bin/gcc -o conftest -Wno-long-long conftest.c >&5
configure:3614: $? = 0
configure:3621: ./conftest
./configure: line 3623: 3679 Segmentation fault ./conftest$ac_cv_exeext
configure:3625: $? = 139
configure:3632: error: in `/usr/local/src/VALGRIND/valgrind-3.10.1':
configure:3634: error: cannot run C compiled programs.
If you meant to cross compile, use `--host'.
See `config.log' for more details
This error has come up twice now. Once when trying to install Valgrind and once when trying to install libusb.
The output with gcc -v is this:
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/arm-linux-gnueabihf/4.6/lto-wrapper
Target: arm-linux-gnueabihf
Configured with: ../src/configure -v --with-pkgversion='Debian 4.6.3-14+rpi1' --with-bugurl=file:///usr/share/doc/gcc-4.6/README.Bugs --enable- languages=c,c++,fortran,objc,obj-c++ --prefix=/usr --program-suffix=-4.6 --enable-shared --enable-linker-build-id --with-system-zlib --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --with-gxx-include-dir=/usr/include/c++/4.6 --libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --enable-gnu-unique-object --enable-plugin --enable-objc-gc --disable-sjlj-exceptions --with-arch=armv6 --with-fpu=vfp --with-float=hard --enable-checking=release --build=arm-linux-gnueabihf --host=arm-linux-gnueabihf --target=arm-linux-gnueabihf
Thread model: posix
gcc version 4.6.3 (Debian 4.6.3-14+rpi1)
On CoreOS, solved the problem with.
install.packages('rgdal', type = "source", configure.args='--host=host')
The problem here has been resolved by:
export PATH=/path/to/gcc-4.9.2/bin/:$PATH
export LD_LIBRARY_PATH=/path/to/gcc-4.9.2/lib64/:$LD_LIBRARY_PATH
./configure --prefix=/path/to/ --host=arm
Hope this will help you.
It is an issue with /tmp directory. Just append this to your pip command: --build ./ and rerun it.
./ is current working directory.
I got this exact error. When I looked in config.log I saw the message:
fatal error: sys/cdefs.h: No such file or directory
To fix this, I ran:
sudo apt-get install libc6-dev
I could then configure and compile my program.

MATLAB(linux) cannot find the gcc

I try to compile in MATALAB, but it seems that the MATLAB cannot find the gcc:
Error using mex
No supported compiler or SDK was found. For options, visit
http://www.mathworks.com/support/compilers/R2014a/glnxa64.
Error in compile (line 439)
mex(args{:});
>> mex -setup
MEX configured to use 'gcc' for C language compilation.
Warning: The MATLAB C and Fortran API has changed to support MATLAB
variables with more than 2^32-1 elements. In the near future
you will be required to update your code to utilize the
new API. You can find more information about this at:
http://www.mathworks.com/help/matlab/matlab_external/upgrading-mex-files-to-use-64-bit-api.html.
To choose a different language, select one from the following:
mex -setup C++
mex -setup FORTRAN
But I have already installed the gcc using apt-get install gcc, and type the gcc -v can get the following information:
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/4.8/lto-wrapper
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Ubuntu 4.8.2-19ubuntu1' --with-bugurl=file:///usr/share/doc/gcc-4.8/README.Bugs --enable-languages=c,c++,java,go,d,fortran,objc,obj-c++ --prefix=/usr --program-suffix=-4.8 --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --with-gxx-include-dir=/usr/include/c++/4.8 --libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --enable-gnu-unique-object --disable-libmudflap --enable-plugin --with-system-zlib --disable-browser-plugin --enable-java-awt=gtk --enable-gtk-cairo --with-java-home=/usr/lib/jvm/java-1.5.0-gcj-4.8-amd64/jre --enable-java-home --with-jvm-root-dir=/usr/lib/jvm/java-1.5.0-gcj-4.8-amd64 --with-jvm-jar-dir=/usr/lib/jvm-exports/java-1.5.0-gcj-4.8-amd64 --with-arch-directory=amd64 --with-ecj-jar=/usr/share/java/eclipse-ecj.jar --enable-objc-gc --enable-multiarch --disable-werror --with-arch-32=i686 --with-abi=m64 --with-multilib-list=m32,m64,mx32 --with-tune=generic --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu
Thread model: posix
gcc version 4.8.2 (Ubuntu 4.8.2-19ubuntu1)
How can I solve this problem?
converting my comment into this answer:
The error message tells you to go to http://mathworks.com/support/compilers/R2014a/glnxa64, which lists gcc 4.7.x as a supported compiler, but you have 4.8.2.
So you need to install GCC 4.7. On Ubuntu this can be done using:
sudo apt-get install gcc-4.7

LLVM missing linker and can't compile the lld (llvm linker)

I want to build a compiler to a new target and I choose llvm. As far as I understand, I can use the clang project as a front end and llvm as a back end. I can get .o files out of the llc (part of the llvm). now I need to link them all into executable. I tried using lld project but it failed compiling with the error :
Desktop/llvm_project/llvm/lib/Target/ARM/ARMISelLowering.cpp: In member function ‘llvm::Instruction* llvm::ARMTargetLowering::makeDMB(llvm::IRBuilder<>&, llvm::ARM_MB::MemBOpt) const’:
Desktop/llvm_project/llvm/lib/Target/ARM/ARMISelLowering.cpp:11000:73: error: could not convert ‘{(& Builder)->llvm::IRBuilder<>::<anonymous>.llvm::IRBuilderBase::getInt32(15u), (& Builder)->llvm::IRBuilder<>::<anonymous>.llvm::IRBuilderBase::getInt32(0u), (& Builder)->llvm::IRBuilder<>::<anonymous>.llvm::IRBuilderBase::getInt32(0u), (& Builder)->llvm::IRBuilder<>::<anonymous>.llvm::IRBuilderBase::getInt32(7u), (& Builder)->llvm::IRBuilder<>::<anonymous>.llvm::IRBuilderBase::getInt32(10u), (& Builder)->llvm::IRBuilder<>::<anonymous>.llvm::IRBuilderBase::getInt32(5u)}’ from ‘<brace-enclosed initializer list>’ to ‘llvm::ArrayRef<llvm::Value*>’
Builder.getInt32(10), Builder.getInt32(5)};
^
make[2]: *** [lib/Target/ARM/CMakeFiles/LLVMARMCodeGen.dir/ARMISelLowering.cpp.o] Error 1
make[1]: *** [lib/Target/ARM/CMakeFiles/LLVMARMCodeGen.dir/all] Error 2
make: *** [all] Error 2
so I have several question cause I think I am missing something :
if I don't have binutils for the new target, how should I use the llvm project ? - they create they great project...but without the final piece that actually create running files ?! what should I use as a linker ?
anyone encountered this lld build error and solved it ?
uname -a
Linux my_name-Inspiron-3521 3.13.0-35-generic #62-Ubuntu SMP Fri Aug
15 01:58:42 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux
gcc -v
Using built-in specs. COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/4.8/lto-wrapper
Target: x86_64-linux-gnu Configured with: ../src/configure -v
--with-pkgversion='Ubuntu 4.8.2-19ubuntu1' --with-bugurl=file:///usr/share/doc/gcc-4.8/README.Bugs --enable-languages=c,c++,java,go,d,fortran,objc,obj-c++ --prefix=/usr --program-suffix=-4.8 --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --with-gxx-include-dir=/usr/include/c++/4.8 --libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --enable-gnu-unique-object --disable-libmudflap --enable-plugin --with-system-zlib --disable-browser-plugin --enable-java-awt=gtk --enable-gtk-cairo --with-java-home=/usr/lib/jvm/java-1.5.0-gcj-4.8-amd64/jre --enable-java-home --with-jvm-root-dir=/usr/lib/jvm/java-1.5.0-gcj-4.8-amd64 --with-jvm-jar-dir=/usr/lib/jvm-exports/java-1.5.0-gcj-4.8-amd64 --with-arch-directory=amd64 --with-ecj-jar=/usr/share/java/eclipse-ecj.jar --enable-objc-gc --enable-multiarch --disable-werror --with-arch-32=i686 --with-abi=m64 --with-multilib-list=m32,m64,mx32 --with-tune=generic --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu Thread model: posix gcc version 4.8.2 (Ubuntu 4.8.2-19ubuntu1)
The error you are encountering is in llvm itself, not lld. I'm not seeing that error on the buildbots, so I recommend updating your source tree.
As for binutils, llvm does not currently provide a complete replacement for them. This is being worked on, but it will be a while before it's completed. For now I recommend using gnu binutils with either ld or gold as the linker.

Resources