Hi,
I am following the cross compilation instructions here, but I am having some issues. I am just trying to compile a sample for now, 00_video_decode
I have the Jetson set up, and I can compile the sample (00_video_decode
) on the target.
I have successfully cloned the image to my host machine, and mounted it.
I have downloaded the toolchain (64 bit, version 28.3.2), but this is where my confusion begins. According to the instructions, I am supposed to:
export PATH=<CROSS_COMPILER_PATH>/bin:$PATH
but the file I downloaded contains both install/bin
and install/aarch64-unknown-linux-gnu/bin
. Which of these am I supposed to use?
I have tried both, but neither worked.
install/bin
When following the steps, I get the error
aarch64-linux-gnu-g++: not found
because the compiler in install/bin
is called aarch64-unknown-linux-gnu-g++
. I had a look at the makefile and realized I had to change the CROSS_COMPILE
env from
export CROSS_COMPILE=aarch64-linux-gnu-
to
export CROSS_COMPILE=aarch64-unknown-linux-gnu-
Now I get the error
Compiling: video_decode_csvparser.cpp
aarch64-unknown-linux-gnu-g++: loadlocale.c:129: _nl_intern_locale_data: Assertion `cnt < (sizeof (_nl_value_type_LC_TIME) / sizeof (_nl_value_type_LC_TIME[0]))' failed.
Aborted (core dumped)
make: *** [Makefile:49: video_decode_csvparser.o] Error 134
After some googling, I found a fix: export LANG=C
. This gets rid of the error, but I do not understand why. If anybody could explain it, that would be great :)
Now I can compile the sample, but the linker fails
Compiling: video_decode_csvparser.cpp
Compiling: video_decode_main.cpp
make[1]: Entering directory '/home/lhahn/Documents/CrossCompilation/Images/jetson/usr/src/jetson_multimedia_api/samples/common/classes'
Compiling: NvElementProfiler.cpp
Compiling: NvElement.cpp
Compiling: NvApplicationProfiler.cpp
Compiling: NvVideoDecoder.cpp
Compiling: NvJpegEncoder.cpp
Compiling: NvVideoConverter.cpp
Compiling: NvBuffer.cpp
Compiling: NvLogging.cpp
Compiling: NvEglRenderer.cpp
Compiling: NvUtils.cpp
Compiling: NvDrmRenderer.cpp
Compiling: NvJpegDecoder.cpp
Compiling: NvVideoEncoder.cpp
Compiling: NvV4l2ElementPlane.cpp
Compiling: NvV4l2Element.cpp
make[1]: Leaving directory '/home/lhahn/Documents/CrossCompilation/Images/jetson/usr/src/jetson_multimedia_api/samples/common/classes'
Linking: video_decode
/home/lhahn/Documents/CrossCompilation/gcc-4.8.5-aarch64/install/bin/../lib/gcc/aarch64-unknown-linux-gnu/4.8.5/../../../../aarch64-unknown-linux-gnu/bin/ld: cannot find crt1.o: No such file or directory
/home/lhahn/Documents/CrossCompilation/gcc-4.8.5-aarch64/install/bin/../lib/gcc/aarch64-unknown-linux-gnu/4.8.5/../../../../aarch64-unknown-linux-gnu/bin/ld: cannot find crti.o: No such file or directory
collect2: error: ld returned 1 exit status
make: *** [Makefile:53: video_decode] Error 1
I have found the missing file in install/aarch64-unknown-linux-gnu/sysroot/usr/lib/crti.o
and in the cloned image ${ROOT_FS}/usr/lib/aarch64-linux-gnu/crti.o
. I checked the g++ search paths (aarch64-unknown-linux-gnu-g++ -print-search-dirs
) which are passed to the linker, and they do not include either of the 2 locations above. I don’t understand where I went wrong, and manually hacking it in here seems wrong. Can someone please tell me how to fix this properly?
install/aarch64-unknown-linux-gnu/bin
When following the steps, I get the same initial error as before,
/bin/sh: 1: aarch64-linux-gnu-g++: not found
because the compiler in install/aarch64-unknown-linux-gnu/bin
is simply called g++
, so I cleared the CROSS_COMPILE
env. Now the Rules.mk automatically set the CROSS_COMPILE
env to aarch64-unknown-linux-gnu-
. I uncommented that part.
Now I get the same error as above,
Compiling: video_decode_csvparser.cpp
g++: loadlocale.c:129: _nl_intern_locale_data: Assertion `cnt < (sizeof (_nl_value_type_LC_TIME) / sizeof (_nl_value_type_LC_TIME[0]))' failed.
Aborted (core dumped)
make: *** [Makefile:49: video_decode_csvparser.o] Error 134
That’s fixed by
export LANG=C
Now I get the error
Compiling: video_decode_csvparser.cpp
g++: error trying to exec 'cc1plus': execvp: No such file or directory
make: *** [Makefile:49: video_decode_csvparser.o] Error 1
I tried googling this as well, but didn’t find anything relevant.
I would really appreciate some help with this.
Kind regards,
Lukas