Trouble Getting Started - Errors 'make'-ing Argus Samples (oneShot and others)

I bought a TX1 for one fairly straightforward purpose - capture a frame, detect a dark object against a white background, compute the object’s position, store the values, and repeat as rapidly as possible. Following the suggestions in the tutorial ‘Get Started with the JetPack Camera API,’ I went right to the included sample code ‘oneShot’ but ran into errors.

My background is scientific computing. I have written, compiled, ran codes in C. As far as making, cmaking, linking, flashing, …, and, more generally, linux - I am a total amateur. The diagnostic output provided with most errors, most help documents, and the discussions in most of these help topics are largely inscrutable.

However, I am learning and I can follow instructions. Doing so in the last few days, I believe I have up-to-date software running on the TX1:
Ubuntu 16.04 LTS
Linux for Tegra 24.2.1
Jetpack 2.3.1

I followed the instructions in /tegra_multimedia_api/README
(1) Export environment variables - YES!
(2) Install JetPack - NO because it was already done
(3) Create symbolic links - YES!
(4) Build and run samples - NO, I’m interested in the sample with argus

I then followed the instructions in /tegra_multimedia_api/argus/README.txt for the oneShot sample code
(1) mkdir build && cd build - YES!
(2) cmake … - YES, but only after figuring out the error indicating that ‘FindArgus.cmake’ could not be found (in just 4 hours of groping around, woo-hoo!)
(3) make - FAILED as follows:

[ 50%] Linking CXX executable argus_oneshot
/usr/bin/ld: cannot find -largussampleutils
collect2: error: ld returned 1 exit status
CMakeFiles/argus_oneshot.dir/build.make:95: recipe for target 'argus_oneshot failed
make[2]: *** [argus_oneshot] Error 1
CMakeFiles/MakeFile2:67: recipe for target ‘CMakeFiles/argus_oneshot.dir/all’ failed
make[1]: *** [CMakeFiles/argus_oneshot.dir/all] Error 2
MakeFile:149: recipe for target ‘all’ failed
make: *** [all] Error 2

Two days of more groping around lead nowhere. I cannot find that library anywhere. Going back to what was installed JetPack, I cannot find any reference to it or, perhaps unrelated, the TensorRT component. If someone familiar with this problem could point me in the right direction, it would be greatly appreciated.

Hi,

Did you installed the NVidia binaries on your file system when building JetPack? That is, as part of the process you need to run the apply_binaries.sh script so it installs the required NVidia drivers on your file system (including libargus). If you are unable to locate the libargus on your file system at /usr/lib/aarch64-linux-gnu/tegra/ in your rootfs then likely you forgot to run the installer script.

You can follow the steps at: http://developer.ridgerun.com/wiki/index.php?title=Compiling_Tegra_X1_source_code for more information.

Best Regards,
-Marco

Thank you for your response. I cannot find a ‘apply_binaries.sh’ file anywhere on the device. Maybe it ran during the install process because there is a ‘libargus.so’ file in /usr/lib/aarch64-linux-gnu/tegra along with other ‘lib’ files all over the place.

Hi,

Sorry I read it wrong, I thought the application was not able to find libargus but now I realize it did not find libargussampleutil.

Are you building everything into the argus directory? I mean, are you building all the samples? The required library argussampleutils is actually built as part of the samples at tegra_multimedia_api/argus/samples/utils/ so you need to have it built first. The easiest way it to compile all argus samples:

cd tegra_multimedia_api/argus/
mkdir build
cd build
cmake …
make

Regards,

I followed your procedure and it did produce a file ‘libargussampleutils.a’ in /home/tegra_multimedia_api/argus/build/samples/utils

I changed back into the oneShot/build directory, ran ‘cmake …’ (which completed successfully), and then ‘make’. Make produced the exact same error.

I have been trying to figure this out, but got absolutely nowhere. The error message returns:

CMakeFiles/argus_oneshot.dir/build.make:95: recipe for target ‘argus_oneshot’ failed

There are two such files:
one in /home/tegra_multimedia_api/argus/build/samples/oneShot/
one in /home/tegra_multimedia_api/argus/samples/oneShot/build/

I looked at line 95 in both files. The first is:
samples/oneShot/argus_oneshot: /usr/local/cuda-8.0/lib64/libcurart_static.a (which exists in that dir)
The first echos the line “Linking CXX executable argus-oneshot” (which displays in the error message)

The only curious thing is that line 94 of the first build.make file is:
samples/oneShot/argus_oneshot: samples/utils/libargussampleutils.a

If you understand how to get the ‘make’ procedure find libargussampleutils.a, that would be tremendous.

/usr/bin/ld: cannot find -largussampleutils

looks like for linking, you miss library libargussampleutils.so.

If this library is already available on your device, get its path with

sudo apt-get install locate
sudo updatedb
locate libargussampleutils.so

Once you get path to this library, add in your shell:

export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:path_to_libargussampleutils

where path_to_libargussampleutils is the directory where this library was found and give it a new trial.

If locate cannot find this library, then you have to install it or build it from source.

It seems you’ve built the static version of the lib, so you should be able to link with

-L path_to_libargussampleutils.a

in your link flags.

What did you get after following the steps? If all the steps ran correctly then you should not need to go further with any additional build steps, since the suggested procedure is executed into the argus directory it will build ALL the samples, so once it finishes you will get all the ARGUS samples built on argus/build directory. In other words, you do not need to go into the specific oneShot directory to build it.

I just followed the steps provided and this is my log, hopefully it helps to understand the procedure:

ubuntu@tegra-ubuntu:~/tegra_multimedia_api/argus$ mkdir build
ubuntu@tegra-ubuntu:~/tegra_multimedia_api/argus$ cd build/
ubuntu@tegra-ubuntu:~/tegra_multimedia_api/argus/build$ cmake ..
-- The C compiler identification is GNU 5.4.0
-- The CXX compiler identification is GNU 5.4.0
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Found PkgConfig: /usr/bin/pkg-config (found version "0.29.1") 
-- Found Argus: /usr/lib/aarch64-linux-gnu/tegra/libargus.so  
-- Found OpenGLES: /usr/lib/aarch64-linux-gnu/tegra-egl/libGLESv2.so.2  
-- Found EGL: /usr/lib/aarch64-linux-gnu/tegra-egl/libEGL.so  
-- Found EXPAT: /usr/lib/aarch64-linux-gnu/libexpat.so (found version "2.1.0") 
-- Checking for module 'gstreamer-1.0'
--   Found gstreamer-1.0, version 1.8.3
-- Checking for module 'glib-2.0'
--   Found glib-2.0, version 2.48.1
-- Found JPEG: /usr/lib/aarch64-linux-gnu/libjpeg.so  
-- Looking for pthread.h
-- Looking for pthread.h - found
-- Looking for pthread_create
-- Looking for pthread_create - not found
-- Looking for pthread_create in pthreads
-- Looking for pthread_create in pthreads - not found
-- Looking for pthread_create in pthread
-- Looking for pthread_create in pthread - found
-- Found Threads: TRUE  
-- Found CUDA: /usr/local/cuda (found version "8.0") 
-- Looking for XOpenDisplay in /usr/lib/aarch64-linux-gnu/libX11.so;/usr/lib/aarch64-linux-gnu/libXext.so
-- Looking for XOpenDisplay in /usr/lib/aarch64-linux-gnu/libX11.so;/usr/lib/aarch64-linux-gnu/libXext.so - found
-- Looking for gethostbyname
-- Looking for gethostbyname - found
-- Looking for connect
-- Looking for connect - found
-- Looking for remove
-- Looking for remove - found
-- Looking for shmat
-- Looking for shmat - found
-- Looking for IceConnectionNumber in ICE
-- Looking for IceConnectionNumber in ICE - found
-- Found X11: /usr/lib/aarch64-linux-gnu/libX11.so
-- Checking for module 'gtk+-3.0'
--   Found gtk+-3.0, version 3.18.9
-- Configuring done
-- Generating done
-- Build files have been written to: /home/ubuntu/tegra_multimedia_api/src/argus/build
ubuntu@tegra-ubuntu:~/tegra_multimedia_api/argus/build$ make
Scanning dependencies of target argussampleutils
[  1%] Building CXX object samples/utils/CMakeFiles/argussampleutils.dir/EGLGlobal.cpp.o
[  2%] Building CXX object samples/utils/CMakeFiles/argussampleutils.dir/GLContext.cpp.o
[  3%] Building CXX object samples/utils/CMakeFiles/argussampleutils.dir/JPEGConsumer.cpp.o
[  5%] Building CXX object samples/utils/CMakeFiles/argussampleutils.dir/Observed.cpp.o
[  6%] Building CXX object samples/utils/CMakeFiles/argussampleutils.dir/PreviewConsumer.cpp.o
[  7%] Building CXX object samples/utils/CMakeFiles/argussampleutils.dir/Thread.cpp.o
[  9%] Building CXX object samples/utils/CMakeFiles/argussampleutils.dir/WindowBase.cpp.o
[ 10%] Building CXX object samples/utils/CMakeFiles/argussampleutils.dir/gtk/GuiElement.cpp.o
[ 11%] Building CXX object samples/utils/CMakeFiles/argussampleutils.dir/gtk/Window.cpp.o
------- snip -------
[ 87%] Building CXX object samples/openglBox/CMakeFiles/argus_openglbox.dir/main.cpp.o
[ 88%] Building CXX object samples/openglBox/CMakeFiles/argus_openglbox.dir/utils/MathUtils.cpp.o
[ 89%] Linking CXX executable argus_openglbox
[ 89%] Built target argus_openglbox
[ 93%] Building CXX object samples/syncSensor/CMakeFiles/argus_syncsensor.dir/main.cpp.o
[ 94%] Linking CXX executable argus_syncsensor
[ 94%] Built target argus_syncsensor
Scanning dependencies of target argus_yuvjpeg
[ 96%] Building CXX object samples/yuvJpeg/CMakeFiles/argus_yuvjpeg.dir/main.cpp.o
[ 97%] Linking CXX executable argus_yuvjpeg
[ 97%] Built target argus_yuvjpeg
Scanning dependencies of target argus_userautoexposure
[ 98%] Building CXX object samples/userAutoExposure/CMakeFiles/argus_userautoexposure.dir/main.cpp.o
[100%] Linking CXX executable argus_userautoexposure
[100%] Built target argus_userautoexposure

FINISHED! 

ubuntu@tegra-ubuntu:~/tegra_multimedia_api/argus/build$ ls
CMakeCache.txt  CMakeFiles  CPackConfig.cmake  CPackSourceConfig.cmake  Makefile  apps  cmake_install.cmake  samples  <----- Here you will find all the samples binaries. 

LET's RUN oneShot sample:

ubuntu@tegra-ubuntu:~/tegra_multimedia_api/argus/build$ cd samples/oneShot/
ubuntu@tegra-ubuntu:~/tegra_multimedia_api/argus/build/samples/oneShot$ ls
CMakeFiles  Makefile  argus_oneshot  cmake_install.cmake
ubuntu@tegra-ubuntu:~/tegra_multimedia_api/argus/build/samples/oneShot$ ./argus_oneshot 
Encoder_Open ++
Encoder_Open --
Error returned 0x0
[Image-Enc] Client requested Primary Only. Primary done
size of buffer 84819 0 81757 1001 0
ubuntu@tegra-ubuntu:~/tegra_multimedia_api/argus/build/samples/oneShot$ ls
CMakeFiles  Makefile  argus_oneshot  cmake_install.cmake  oneShot.jpg
ubuntu@tegra-ubuntu:~/tegra_multimedia_api/argus/build/samples/oneShot$

Hope this helps!

Regards,

Thank you for walking me through this issue.

Following your procedure worked. I was able to modify ‘main.cpp’ and use your procedure to create a new executable that included my modification.

Can you answer one last question to, hopefully, put this issue to rest?

The first instruction in the “README” file was “Start in the source directory.” I took “the source directory” to be

‘/tegra_multimedia_api/argus/samples/oneShot’

because it contained ‘main.cpp’. Is this were I went wrong?

If I wanted to followed their procedure to just rebuild oneShot, should the ‘source directory’ be something else like

‘/tegra_multimedia_api/argus/build/samples/oneShot’

or one of the subdirectories?

Thank you for following-up with a solution.

Hello, numbersnerd:
if you can execute ‘make’ in ‘build’ directory successfully, then everything should be OK.
if you want to change the source code, like /home/ubuntu/tegra_multimedia_api/argus/samples/oneShot/main.cpp, just edit that file and save.
and with another console in ‘/home/ubuntu/tegra_multimedia_api/argus/build/samples/oneShot’ and run ‘make’. That should work.

Let me know if there’s still failure.

br
Chenjian

Thank you Chenjian for your help. That did create a new executable with my changes for only the oneShot example. This is the start I needed.

So the procedure provided in the readme.txt is just wrong? Ugh! It is so utterly frustrating to be inexperienced and find headaches from step one from a system “designed to get you up and running fast.” If this is typical, maybe I will reconsider this purchase.

In the meantime, thank you for your response.

Hello, numbersnerd:
Glad to know that works for you.

For README, I don’t think there’s anything wrong.
‘Start in the source directory’ and with next step: ‘mkdir build && cd build’. Following making will happen in ‘build’ directory.

‘cmake’ is used for Argus building, and that’s very general in Linux projects. You can take a look at its manual.

Hope you can enjoy Jetson/TX1.

br
ChenJian

Following the procedure in the README file does not work. I encourage you to try it. It is certainly possible that I am still doing something wrong, but I think you will find following the instructions exactly produces the error that appears in my first post and was my original source of consternation.

Is there an Argus manual? I have the “Argus 0.96 API Specification”, but there is nothing whatsoever on the difficulty encountered here. If there is another document that would be helpful, I would love to know more specifically what it is and where to find it. I’ve found the documentation to be another headache. The Jetson TX1 Developer Kit User Guide refers to a document that, as far as I can tell, does not exist as follows: “For information about flashing the Boot Loader and Kernel, see the Getting Starting chapter in the NVIDIA Tegra Linux Driver Package Development Guide.”

I’ve just found everything associated with the purchase of the TX1 starting from customer service right through to the documentation to be entirely disappointing. However, your response was helpful. It allowed me to finally make incremental progress.

Hello, numbersnerd:
I have tried the procedures in argus/README.txt. That works perfectly in my side. If you met any problem, would you please paste the full log and maybe we can find out what happened.

You can download ‘NVIDIA Tegra Linux Driver Package Development Guide’ from https://developer.nvidia.com/embedded/downloads. Just search ‘L4T Documentation’ and get the package with corresponding version.

A good documentation is as difficult as a good hardware/software project. Your feedback is helpful.

thanks.

br
ChenJian

My guess is that you did not take a TX1 off the shelf, open the box, and start from the enclosed quick start guide. If you did, I think you would have received the error in the first post. Since I do not know what “the full log” is, I cannot paste it here. The error returned by the TX1 is as follows:

[ 50%] Linking CXX executable argus_oneshot
/usr/bin/ld: cannot find -largussampleutils
collect2: error: ld returned 1 exit status
CMakeFiles/argus_oneshot.dir/build.make:95: recipe for target 'argus_oneshot failed
make[2]: *** [argus_oneshot] Error 1
CMakeFiles/MakeFile2:67: recipe for target ‘CMakeFiles/argus_oneshot.dir/all’ failed
make[1]: *** [CMakeFiles/argus_oneshot.dir/all] Error 2
MakeFile:149: recipe for target ‘all’ failed
make: *** [all] Error 2

Thank you for the reference to the Development Guide. I will carefully examine the “Getting Started” procedure. That document seems to stops short of the sample programs but maybe there was an important step in the set-up that was not included in the “NVIDIA Tegra linux driver package quick-start guide” that causes the above error. Since the first line of the Development Guide indicates “It is intended for software engineers …” I’m not sure it will be that usefull. The TX1 certainly targets a much narrower audience than indicated by the website, as for example, the “Tutorials” or “Success Stories.”