How to build a docker image for cuda based c++ application runnig on Nvidia Jetson? - c++

To be more specific, my source code is compiled and linked successfully when I am running it from inside the container.
However, when I am trying to build the image from a Dockerfile it fails.
i.e.:
this works (These lines are from the terminal "inside" the container):
cd AppFolder; make; //success
this does not (These are lines from the dockerfile):
RUN git clone <url> && cd APPFolder && make
Now I get:
/usr/bin/ld: warning: libcuda.so.1 needed by...
How can I build the application from the dockerfile?

The only difference between a container and a layer during the image build is the next layers. perhaps you are running the RUN directive to early - i.e. before the cuda library was generated?
try putting this command as low as you can in the Dockerfile

Well, adding "-Wl,--allow-shlib-undefined" to the compiler/linker (g++) solved this issue. I think it "tells" the linker to "remain" pointer to function that will be "linked" only in runtime (i.e., when running the docker image)

Related

ERROR::ASSIMP:: Expected different index count in <p> element

I developed a project on windows with visual studio 17 and it worked fine for me. Now I'm compiling it with cmake on a linux virtual machine (in virtualbox) and everything seems to be ok but when I run my program Assimp doesn't work.
When I create an importer to load an animation it prints an error:
ERROR::ASSIMP:: Expected different index count in <p> element.
but what drives me crazy is that it doesn't cause a crash in the program but it keeps going after printing this, it gets the scene like nothing happened, an assert is passed but when i take the animations i get a segmentation fault.
Here the code:
Assimp::Importer importer;
const aiScene* scene = importer.ReadFile(animationPath, aiProcess_Triangulate);
assert(scene && scene->mRootNode);
auto animation = scene->mAnimations[0];
Any ideas how to fix this?
To reproduce it:
Virtualbox with Ubuntu 22.04 LTS os.
the repo can be cloned from here
You need Conan installed.
When Conan is installed, just clone the repo and run the script called installer.sh
it just installs some dependencies like xorg-dev, build-essential etc with apt-get install and some libraries with conan and configures the makefile with cmake and build it. Then, go to the build dir and run the program called Reskinner.
This is a known bug in the collada-implementation. The number of indices does not fit to the kind of primitive. I am not sure if this is caused by a wrong expectation from our collada parser or from an invalid model.
You can find the issue-report here: Problem with wrong indices

How to fix " --asar does not take any arguments, it only has sub-properties" warning

At the last step of my application when I want to build my desktop app (for windows 10 OS) with "npm run package-win" command I am getting the same warning in the title. Other problem is application's exe file occurs but gives error. "The code execution cannot proceed because ffmpeg.dll was not found. Reinstalling the program may fix the problem."
I reinstalled the program several times, I changed my package.json's scripts I thought it is because of asar's dependencies
PS C:\Users\osman.turalioglu\Projects\project> npm run package-win
project#1.0.0 package-win C:\Users\osman.turalioglu\Projects\project>
electron-packager . --overwrite --asar=true --platform=win32 --arch=ia32 --icon=assets/icons/win/icon.ico --prune=true --out=release-builds --version-string.CompanyName=CE --version-string.FileDescription=CE --version-string.ProductName="project"
WARNING: --asar does not take any arguments, it only has sub-properties (see --help)
Packaging app for platform win32 ia32 using electron v5.0.6
Wrote new app to release-builds\project-win32-ia32
I expect my desktopp app' exe file builded
hi the error its pretty explicit, go to package.json on scripts section on package-win line, look for --asar=true remove the true leaving only --asar, the asar property is true by default

Building VirtualBox without GUI or Guest Additions

I'm trying to build VirtualBox 5.2.18 on Ubuntu Server LTS 18.04 64-bit. I want to build it without any GUI components and without Guest Additions, as I want to avoid installing any unnecessary dependencies. I am using the following options when configuring:
./configure --build-headless --disable-qt --disable-alsa --disable-pulse --disable-opengl --disable-sdl-ttf --disable-libvpx --disable-docs
Although there is an option to only build the Guest Additions (--only-additions), there doesn't seem to be an option passable to configure to skip building Guest Additions. Is there a way to skip building Guest Additions, or perhaps to ignore any build-time errors related to building Guest Additions?
I found a solution in https://forums.virtualbox.org/viewtopic.php?t=33090&start=0, which contains more useful details. One can build VirtualBox without GUI or Guest Additions by adding the following lines to LocalConfig.kmk in the root of the development tree:
VBOX_WITHOUT_ADDITIONS = 1
VBOX_WITH_HEADLESS = 1
VBOX_WITH_VRDP=
VBOX_WITH_VRDP_VIDEO_CHANNEL=
VBOX_WITH_VRDP_AUTHMOD=
VBOX_WITH_VRDP_RDESKTOP=
VBOX_WITH_VBOXFB=
VBOX_WITH_KCHMVIEWER=
VBOX_WITH_TESTSUITE=
VBOX_WITH_TESTCASES=
VBOX_WITH_SHARED_FOLDERS=
VBOX_WITH_SHARED_CLIPBOARD=
VBOX_WITH_VNC =
VBOX_X11_SEAMLESS_GUEST=
VirtualBox can then be built by executing the following in the root folder:
./configure --build-headless --disable-qt --disable-alsa --disable-pulse --disable-opengl --disable-sdl-ttf --disable-libvpx --disable-docs
source env.sh
kmk
It is unclear which of the options is necessary for skipping the building of the guest additions (in either LocalConfig.kmk or those passed to ./configure).
When kmk packing is executed, the following error message might appear:
kmk: *** No rule to make target `.../out/linux.amd64/release/bin/additions/VBoxGuestAdditions.iso',
needed by `.../out/linux.amd64/release/obj/Installer/linux/archive/additions/VBoxGuestAdditions.iso'.
Stop.
This error can be avoided by executing a touch command before kmk packing (this fix was obtained from https://forums.virtualbox.org/viewtopic.php?f=10&t=41598&p=187420&hilit=VBoxGuestAdditions#p187420):
kmk
mkdir -p out/linux.amd64/release/bin/additions/
touch out/linux.amd64/release/bin/additions/VBoxGuestAdditions.iso
kmk packing
The mkdir command was added before touch because touch might fail if the directory out/linux.amd64/release/bin/additions/ did not exist.
Some errors might come up during installation of VirtualBox-*.run, but it should successfully completely. However, if you try to execute VBoxManage, you might get the following error:
Could not find VirtualBox installation. Please reinstall.
This arises most probably because the executable file VirtualBox was not found in the installation folder (usually /opt/VirtualBox). The file VirtualBox is the GUI component which was not built. We can bypass the error by editing VBox.sh in the installation folder, and changing the line
elif test -f "${MY_DIR}/VirtualBox" && test -x "${MY_DIR}/VirtualBox"; then
to
elif test -f "${MY_DIR}/VBoxHeadless" && test -x "${MY_DIR}/VBoxHeadless"; then
VirtualBox should now run without any problems.

autostart webserver and programm

I'm working on a Yocto based system. My problem is that I can't start my programm written in C++ and the webserver (node.js) at the same time right after the boot of my device.
I already tried this in /etc/init.d:
#! /bin/bash
/home/ProjectFolder/myProject
cd /home/myapp && DEBUG=myapp:* npm start
exit 0
I changed the rights after creating the script by
chmod +x ./startProg.sh
After that I linked it by
update-rc.d startProg.sh defaults
After reboot the system only starts the C++-programm. I tried some other possibilities like seperating the two comands in different shell-scripts, but that didn't work out any better.
Is there any option I missed or did I make any mistake trying to put those two processes into the autostart?
This of course isn't a C++ or Node.js question. A shell script is a list of commands that are executed in order, unless specified otherwise. So your shell script runs your two programs in the order specified, first myProject and when that's done npm will be started.
This is the same as what would happen from the prompt and the solution is the same: /home/ProjectFolder/myProject &

Running SonarQube analysis scan - SonarSource build-wrapper

I'm new to running SonarQube scans and I get this error message in the log in Jenkins:
16:17:39 16:17:36.926 ERROR - The only way to get an accurate analysis of your C/C++/Objective-C project is by using the SonarSource build-wrapper. If for any reason, the use of the build-wrapper is not possible on your project, you can bypass it with the help of the "sonar.cfamily.build-wrapper-output.bypass=true" property. By using that property, you'll switch to an "at best" mode that could result in false-positives and false-negatives.
Can someone please advise where I can find and run this SonarSource build-wrapper?
Thanks a lot for your help!
To solve this issue, download the Build Wrapper directly from your SonarQube Server, so that its version perfectly matches your version of the plugin:
Build Wrapper for Linux can be downloaded from URL
http://localhost:9000/static/cpp/build-wrapper-linux-x86.zip
Unzip the downloaded Build Wrapper,
Configure it in your PATH because it's just more convenient
export PATH=$PATH:/path/where/you/unzip
Once done, Run below commands.
build-wrapper-linux-x86-64 --out-dir <dir-name> <build-command>
build-wrapper-linux-x86-64 --out-dir build_output make clean all
Once all this done, you have to modify your sonar-project.properties file with following line. Note the dir-name is same directory which we defined in previous command.
sonar.cfamily.build-wrapper-output=<dir-name>
and then you can run the sonar scanner command.
sonar-scanner
this will do the analysis against your code. For more details, you can check this link.
Contacted support, turns out this was caused by missing the argument sonar.cfamily.build-wrapper-output in the scanner begin command.
Build wrapper downloads:
Linux: https://sonarcloud.io/static/cpp/build-wrapper-linux-x86.zip
macOS: https://sonarcloud.io/static/cpp/build-wrapper-macosx-x86.zip
Windows: https://sonarcloud.io/static/cpp/build-wrapper-win-x86.zip
Some links covering how to run the build wrapper:
https://docs.sonarqube.org/latest/analysis/languages/cfamily/
https://blog.sonarsource.com/with-great-power-comes-great-configuration/