Why I cann't Cross Compile the samples of Tegra_Multimedia_API_R28.2.0_aarch64.tbz2 Successfully?

I download the Tegra_Multimedia_API_R28.2.0_aarch64.tbz2, and then decompression it。I see there are some samples in it,but i cann’t cross compile them successly。

I set the environment variable TARGET_ROOTFS to “/home/mxj/Nvidia_TX2/64_TX2/Linux_for_Tegra/rootfs”.

export TARGET_ROOTFS=/home/mxj/Nvidia_TX2/64_TX2/Linux_for_Tegra/rootfs。

I go into the samoles path, then enter make.There are some errors while the compiler is going to linking。

Compiling: main.cpp
make[1]: Entering directory ‘/home/mxj/NvidiaTX2_Work/tegra_multimedia_api/samples/common/classes’
Compiling: NvElementProfiler.cpp
Compiling: NvElement.cpp
Compiling: NvApplicationProfiler.cpp
Compiling: NvVideoDecoder.cpp
Compiling: NvJpegEncoder.cpp
Compiling: NvVideoConverter.cpp
Compiling: NvDrmRenderer.cpp
Compiling: NvLogging.cpp
Compiling: NvEglRenderer.cpp
Compiling: NvUtils.cpp
Compiling: NvBuffer.cpp
Compiling: NvJpegDecoder.cpp
Compiling: NvVideoEncoder.cpp
Compiling: NvV4l2ElementPlane.cpp
Compiling: NvV4l2Element.cpp
make[1]: Leaving directory ‘/home/mxj/NvidiaTX2_Work/tegra_multimedia_api/samples/common/classes’
Compiling: /home/mxj/NvidiaTX2_Work/tegra_multimedia_api/argus/samples/utils/Thread.cpp
Linking: multi_camera
/usr/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
/usr/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
Makefile:60: recipe for target ‘multi_camera’ failed
make: *** [multi_camera] Error 1

I can find the file crt1.o and crti.o under the path ${TARGET_ROOTFS}/usr/lib,but why the compiler cann’t find them? Is there some mistakes in my steps?

/*
 * Copyright (c) 2016, NVIDIA CORPORATION. All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 *  * Redistributions of source code must retain the above copyright
 *    notice, this list of conditions and the following disclaimer.
 *  * Redistributions in binary form must reproduce the above copyright
 *    notice, this list of conditions and the following disclaimer in the
 *    documentation and/or other materials provided with the distribution.
 *  * Neither the name of NVIDIA CORPORATION nor the names of its
 *    contributors may be used to endorse or promote products derived
 *    from this software without specific prior written permission.
 *
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY
 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
 * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR
 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */

Use the following procedure to set up the cross-compilation environment for
Multimedia API on the host system.

1. Install the CUDA cross-platform toolkit on the host system with the following
   commands:

        $ sudo dpkg --add-architecture arm64
        $ sudo apt-get update
        $ sudo dpkg -i cuda-repo-<distro>_<version>_amd64.deb
        $ sudo apt-get update
        $ sudo apt-get install cuda-cross-aarch64

   NOTE: Only cuda-8.x supports cross-platform development for aarch64(arm64).

2. Download the <L4T Sample Root Filesystem> from the following website:

        https://developer.nvidia.com/embedded/downloads

3. Decompress the package and export rootfs path with the following command:

        $ export TARGET_ROOTFS=<PATH_OF_TEGRA_DRIVER_PACKAGE>/Linux_for_Tegra/rootfs

    NOTE: The sample 11_camera_object_identification and backend do not support
    cross-compilation in this release.

4. Export the path of cross-compiler tool chain with the following command:

        $ export PATH=$PATH:<CROSS_COMPILER_PATH>/bin

5. Create symbolic links with the following commands:

        $ export TEGRA_ARMABI=aarch64-linux-gnu
        $ cd ${TARGET_ROOTFS}/usr/lib/
        $ sudo ln -sf ${TEGRA_ARMABI}/crt1.o crt1.o
        $ sudo ln -sf ${TEGRA_ARMABI}/crti.o crti.o
        $ sudo ln -sf ${TEGRA_ARMABI}/crtn.o crtn.o
        $ cd ${TEGRA_ARMABI}
        $ sudo ln -sf libv4l2.so.0 libv4l2.so
        $ sudo ln -sf tegra-egl/libEGL.so.1 libEGL.so
        $ sudo ln -sf tegra-egl/libGLESv2.so.2 libGLESv2.so
        $ sudo ln -sf tegra/libcuda.so.1.1 libcuda.so.1
        $ sudo ln -sf ../../../lib/aarch64-linux-gnu/libdl.so.2 libdl.so

6. Enter the sample directories and run make to cross-compile.

And to the TX2 the folder of tegra-egl doesn’t exist anymore, but mesa-egl, and this CROSS_PLATFORM_SUPPORT file is also missing. Have no idea.

We don’t support cross-compile of tegra_multimedia_api samples.

Which documentation explains these? I don’t feel I’ve seen it。

When i compile samples on TX2, there are some errors.

Compiling: main.cpp
make[1]: Entering directory ‘/home/nvidia/Nvidia/tegra_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/nvidia/Nvidia/tegra_multimedia_api/samples/common/classes’
Compiling: /home/nvidia/Nvidia/tegra_multimedia_api/argus/samples/utils/Thread.cpp
Linking: multi_camera
/usr/bin/ld: cannot find -lv4l2
/usr/bin/ld: cannot find -lcudart
/usr/bin/ld: cannot find -lnvinfer
/usr/bin/ld: cannot find -lnvparsers

collect2: error: ld returned 1 exit status
Makefile:60: recipe for target ‘multi_camera’ failed
make: *** [multi_camera] Error 1

How should i deal these errors? Thank you.

PLease install via Jetpack JetPack SDK | NVIDIA Developer
Jetpack handles all dependencies.

i succeeded by nfs share the root of the jetson than mount on it at the host linux. you should use that path as TARGET_ROOTFS.

Hi umit.torun,

Thanks for sharing, would you please provide the details to let other developers be leveraged?

Thanks