Nvidia jetson nano developer kit from waveshare cmake build problem

I am using Nvidia jetson nano dev kit from waveshare. Some background details : I have Installed the OS using sdk manager with ubuntu and jetpack 4.6.3 and then moved the os from internal memory to sd card with this tutorial : Change Root File System to SD Card Directly.

I wanted to enable opencv with cuda I have followed this github repository GitHub - mdegans/nano_build_opencv: Build OpenCV on Nvidia Jetson Nano to do it. while running the script for the build I get errors,
I cannot figure out the probblem and solve it . Can I get some help ?
Error starts from here :
– Check for working C compiler: /usr/bin/cc – broken
CMake Error at /usr/share/cmake-3.10/Modules/CMakeTestCCompiler.cmake:52 (message):
The C compiler


is not able to compile a simple test program.

It fails with the following output:

Change Dir: /tmp/build_opencv/opencv/build/CMakeFiles/CMakeTmp

Run Build Command:"/usr/bin/make" "cmTC_78248/fast"
/usr/bin/make -f CMakeFiles/cmTC_78248.dir/build.make CMakeFiles/cmTC_78248.dir/build
make[1]: Entering directory '/tmp/build_opencv/opencv/build/CMakeFiles/CMakeTmp'
Building C object CMakeFiles/cmTC_78248.dir/testCCompiler.c.o
/usr/bin/cc    -o CMakeFiles/cmTC_78248.dir/testCCompiler.c.o   -c /tmp/build_opencv/opencv/build/CMakeFiles/CMakeTmp/testCCompiler.c
/tmp/build_opencv/opencv/build/CMakeFiles/CMakeTmp/testCCompiler.c: In function ‘main’:
/tmp/build_opencv/opencv/build/CMakeFiles/CMakeTmp/testCCompiler.c:11:1: internal compiler error: Segmentation fault
 { (void)argv; return argc-1;}
Please submit a full bug report,
with preprocessed source if appropriate.
See <file:///usr/share/doc/gcc-7/README.Bugs> for instructions.
CMakeFiles/cmTC_78248.dir/build.make:65: recipe for target 'CMakeFiles/cmTC_78248.dir/testCCompiler.c.o' failed
make[1]: *** [CMakeFiles/cmTC_78248.dir/testCCompiler.c.o] Error 1
make[1]: Leaving directory '/tmp/build_opencv/opencv/build/CMakeFiles/CMakeTmp'
Makefile:126: recipe for target 'cmTC_78248/fast' failed
make: *** [cmTC_78248/fast] Error 2

CMake will not be able to correctly generate this project.
Call Stack (most recent call first):
CMakeLists.txt:107 (enable_language)

– Configuring incomplete, errors occurred!
See also “/tmp/build_opencv/opencv/build/CMakeFiles/CMakeOutput.log”.
See also “/tmp/build_opencv/opencv/build/CMakeFiles/CMakeError.log”.
make: *** No targets specified and no makefile found. Stop.
make: *** No rule to make target ‘install’. Stop.
Do you wish to remove temporary build files in /tmp/build_opencv ?
(Doing so may make running tests on the build later impossible)
Y/N n

Hi, do you have the full JetPack component on your system?
(Run sudo apt install nvidia-jetpack)

Can you manually run the CMake config flags and see if it works?

Hi Dave ,
Yes I have the full jetPack components in my system, and also ran this command that you wrote earlier . I ran the Cmake config flags again and it did not work, same error

Oh, seems like it’s exactly the same issue as the one in this post:

This user was also using a Jetson Nano, and moved the system to an external drive.
Can you try moving it back to the internal eMMC?

The internal eMMC is full. It is just 16GB , I don’t have space for the build.
Right now in my case what to do if I want to change the boot to sdcard slot , just to remember that right now I am booting from external (port usb) with sd card

Then how about re-installing the GCC and Make package?
Does it help?

Yes I have did that several times , unfortunately it did not solve it.
I have tried to narrow down the problem by compiling a simple hello word c code also I got that error :
turac-ika@turacika-desktop:~$ gcc hello.c -o hello
hello.c: In function ‘main’:
hello.c:6:1: internal compiler error: Segmentation fault
Please submit a full bug report,
with preprocessed source if appropriate.
See <file:///usr/share/doc/gcc-7/README.Bugs> for instructions.

You may try to make some room available on Linux filesystem such as deleting opencv build directory:

sudo rm -rf /tmp/build_opencv/opencv/build

…or anything else that you can delete safely, and reboot.
Use an external storage for building, so that linux root filesystem doesn’t get full.

1 Like

Hi, so where does your system and the test code reside? Is your SD card also near full?
As mentioned by @Honey_Patouceul, someone on stackoverflow also bumped into the similar issue, and one of the solution mentioned in the post was deleting some files to free up disk space:

The external sd card is not full, there is enough space but the build is not working on it .

How can I change my system root to internal memory again ?
Filesystem Size Used Avail Use% Mounted on
/dev/sda1 58G 14G 42G 25% /
none 1.7G 0 1.7G 0% /dev
tmpfs 2.0G 209M 1.8G 11% /dev/shm
tmpfs 2.0G 37M 1.9G 2% /run
tmpfs 5.0M 4.0K 5.0M 1% /run/lock
tmpfs 2.0G 0 2.0G 0% /sys/fs/cgroup
tmpfs 396M 132K 396M 1% /run/user/1000
/dev/mmcblk0p1 14G 13G 10M 100% /media/turac-ika/058bdf93-535d-4d45-a038-371b72494303

The last one is the internal storage as you may notice

Ok, this rules out the available space issue.

It looks that cmake cannot find CUDA.

  1. Did you install a custom cmake version ?

  2. Check that there is a symbolic link /usr/local/cuda pointing to your actual cuda version (here through /etc/alternatives, note the following is from AGX Orin with R35.1, for Nano the versions may differ):

ls -dl /usr/local/cuda*
lrwxrwxrwx  1 root root   22 nov.   2  2022 /usr/local/cuda -> /etc/alternatives/cuda
lrwxrwxrwx  1 root root   25 août   1  2022 /usr/local/cuda-11 -> /etc/alternatives/cuda-11
drwxr-xr-x 11 root root 4096 août  16  2022 /usr/local/cuda-11.4

ls -dl /etc/alternatives/cuda*
lrwxrwxrwx 1 root root 20 août   1  2022 /etc/alternatives/cuda -> /usr/local/cuda-11.4
lrwxrwxrwx 1 root root 20 août   1  2022 /etc/alternatives/cuda-11 -> /usr/local/cuda-11.4
  1. Check your environment:
# Is NVCC available ?
nvcc --version
nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2022 NVIDIA Corporation
Built on Wed_May__4_00:02:26_PDT_2022
Cuda compilation tools, release 11.4, V11.4.239
Build cuda_11.4.r11.4/compiler.31294910_0

If not found, you have to add cuda to your shell environment:

export PATH=/usr/local/cuda/bin:$PATH
export LD_LIBRARY_PATH=/usr/local/cuda/lib64:$LD_LIBRARY_PATH
  1. You may try this script for building opencv with CUDA.

  2. For booting again from eMMC it should be easy but before trying that,

  • you would free some space in eMMC (100% is not safe).
  • you would have a serial console

Then as root you would edit /media/turac-ika/058bdf93-535d-4d45-a038-371b72494303/boot/extlinux/extlinux.conf and copy the default entry and paste it below.
Then give a name to this second entry and change the APPEND line setting linux root from /dev/sda1 to /dev/mmcblk0p1:

DEFAULT primary

MENU TITLE L4T boot options

LABEL primary
      MENU LABEL primary kernel
      APPEND ${cbootargs} root=/dev/sda1 rw rootwait rootfstype=ext4 ...

      ....Same as above
      APPEND ${cbootargs} root=/dev/mmcblk0p1 rw rootwait rootfstype=ext4 ...

Then save it and reboot with serial console attached. When extlinux will be run, you’ll have only 3 seconds for selecting the second entry from console.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.