Cross compilation problem

Dear whom it may concern,

I am using SDK manager installed DRIVE 10.0 to Xavier and my host computer. However, when I follow the procedure of cross-compilation (https://developer.nvidia.com/drive/learn/tutorial-xcompilation), I cannot make the hello_world sample running on the target.

I tried the host compilation and it worked well. Then I follow the tutorial to make cross compilation, the binary is able to be run on host, but when I use scp to copy it to the target, the binary cannot run.

My operation is below:

cmake -DCMAKE_BUILD=Release\
-DCMAKE_TOOLCHAIN_FILE=../cmake/Toolchain-V5L.cmake \
-DVIBRANTE_PDK:STRING=/home/nvidia/drive-t186ref-linux \
..

make -j && make install

The tutorial indicates if I “file hello_world”, it will show

hello_world: ELF 64-bit LSB executable, ARM aarch64, version 1 (SYSV), dynamically linked, interpreter /lib/ld-linux-aarch64.so.1, for GNU/Linux 3.18.0, BuildID[sha1]=2a2f7b728622349804b4b7c3f97ad5063602e68d, not stripped

But my case is

hello_world: ELF 64-bit LSB shared object, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/l, for GNU/Linux 3.2.0, BuildID[sha1]=357f41e89700f98d330dba1dd6fe1a052d3b982b, with debug_info, not stripped

Could anyone help me to debug it?
Thanks!

Dear hanyang.zhuang,
It seems DVIBRANTE_PDK:STRING value is wrong. Could you check the below.

mkdir ~/build-host
cd ~/build-host
cmake -DCMAKE_BUILD_TYPE=Release       -DCMAKE_TOOLCHAIN_FILE=/usr/local/driveworks/samples/cmake/Toolchain-V5L.cmake       -DVIBRANTE_PDK:STRING=/home/$USER/nvidia/nvidia_sdk/DRIVE_Software_10.0_Linux_OS_E3550/DRIVEOS/drive-t186ref-linux         /usr/local/driveworks/samples
make -j

Hi SivaRamaKrishna,

I cannot find the compiler indicated in the DVIBRANTE_PDK:STRING. The file in that path looks like following:

zhy@zhy-HP-ZBook-15-G5:~/nvidia/nvidia_sdk/DRIVE_Software_10.0_Linux_OS_E3550/DRIVEOS$ tree -L 2 .
.
└── toolchains
    ├── gcc-linaro-7.3.1-2018.05-x86_64_aarch64-linux-gnu
    ├── gcc-linaro-7.3.1-2018.05-x86_64_arm-linux-gnueabi
    └── gcc-linaro-7.3.1-2018.05-x86_64_arm-linux-gnueabihf

4 directories, 0 files

In the SDK Manager, all the items are shown to be “installed” in the host section.

  1. So do I miss anything?
  2. In addition, this DVIBRANTE_PDK:STRING path means the path to “drive-t186ref-linux” in the host system, not the target system, correct?

Dear hanyang.zhuang,
Did you flash the board? Flashing the board is necessary to set up cross compilation on host.

Dear hanyang.zhuang,
Is the issue resolved? Could you provide any update?

Hi SivaRamaKrishna,

Sorry for late reply. I re-installed the SDK manager, re-download everything, and re-install SDK/re-flash Xavier. Then everything goes well with the cross compiling. Now I can find the drive-t186ref-linux on my host and the cross compiled binary can be run in the target.

Perhaps the previous SDK manager was not well performed since I have force stopped it multiple times.

Everything goes well now and thanks for help!

Hi everyone.Did you mean only the pc which perform the flashing work, will have a functional toolchain? I face some strange problem too, which i think is also coused by toolchain unproperly installed.

Hi zhengxiaofeng333,

Yes, the host machine, PC that does the flashing, needs to be fully configured in order to cross compile.

Hi LukeNV,

am I interpreting your answer right? Does that mean, cross compiling is only possible on host machines, that have flashed the drive AGX?

Thank you!

Yes.

Hi SivaRamaKrishna,

thank you for the clarification. I have a couple of follow-up questions:

Could you elaborate on why cross-compiling is only possible from host machines that have flashed the Drive AGX? I understand, that the necessary toolchain is installed while flashing the AGX. But what does that entail, does it only install the necessary libraries or is there more to it? Would it be possible to flash the AGX from a host and then distribute the toolchain to another host, that did not flash the Drive AGX. E.g. in a scenario where more than one developer wants to cross-compile their code for the Drive AGX, but they do not want to flash the Drive AGX with every laptop.

Thank you!

2 Likes

Any updates on jmassing’s question? I would be interested in that too.

I too wonder the answer to the jmassing’s latest question about multiple developers cross compiling? Could you please elaborate on that ?

For setting up a cross compilition host system, developers can skip the flash step in SDK Manager but they still need to install all the host/target components. Thanks!