Porting Eigen3 library for Chrome's Portable Native Client (PNaCl) build error - c++

So I have an AWS instance (the free tier one) running with Ubuntu 16.04. There I have installed nacl_sdk (which is working and has allowed me to access their sample sites with success) and naclports which I used to port opencv with which I had trouble with at first due to errors with zlib but got it working after I added i386 architecture and did sudo apt-get update on the system and installed necessary i386 programs.
Note I have depot_tools installed as well.
Now I am trying to install the eigen3 library for pnacl as well but I am getting an error and I am not sure how to understand it nor how exactly it gets built to fix it.
The command that I ported opencv with was
$ NACL_ARCH=pnacl make opencv
And I tried these two commands for building eigen3 with the same results (shown below)
$ NACL_ARCH=pnacl make eigen3
$ bin/webports install eigen3
This is the very end of terminal output (the entire message is very long):
######################################################################
Building eigen3
######################################################################
chdir /home/ubuntu/Work/ExternCode/naclports/src/out/build/eigen3/build_pnacl
make -j1 basicstuff cholesky determinant geo_transformations inverse
Scanning dependencies of target basicstuff
Building CXX object test/CMakeFiles/basicstuff.dir/basicstuff.cpp.o
Linking CXX executable basicstuff
Built target basicstuff
Scanning dependencies of target cholesky
[100%] Building CXX object test/CMakeFiles/cholesky.dir/cholesky.cpp.o
clang: error: unable to execute command: Killed
clang: error: clang frontend command failed due to signal (use -v to see invocation)
clang version 3.7.0 (https://chromium.googlesource.com/a/native_client/pnacl-clang.git cf0dc7f6e6123dfa9b8834b56743315300b34e6c) (https://chromium.googlesource.com/a/native_client/pnacl-llvm.git baa63524b6b493ec2a6aa2c5193d9f25c0c33191)
Target: le32-unknown-nacl
Thread model: posix
clang: note: diagnostic msg: PLEASE submit a bug report to http://llvm.org/bugs/ and include the crash backtrace, preprocessed source, and associated run script.
clang: note: diagnostic msg:
test/CMakeFiles/cholesky.dir/build.make:62: recipe for target 'test/CMakeFiles/cholesky.dir/cholesky.cpp.o' failed
make[3]: *** [test/CMakeFiles/cholesky.dir/cholesky.cpp.o] Error 254
CMakeFiles/Makefile2:14386: recipe for target 'test/CMakeFiles/cholesky.dir/all' failed
make[2]: *** [test/CMakeFiles/cholesky.dir/all] Error 2
CMakeFiles/Makefile2:14393: recipe for target 'test/CMakeFiles/cholesky.dir/rule' failed
make[1]: *** [test/CMakeFiles/cholesky.dir/rule] Error 2
Makefile:5128: recipe for target 'cholesky' failed
make: *** [cholesky] Error 2
webports: Build failed: 'eigen3' [pnacl/release]

clang: error: unable to execute command: Killed
It looks like your AWS instance killed clang, so perhaps it ran out of memory. The free tier gives 1 MiB of RAM and that might not be enough for what you're trying to do.

Related

Problems with compiling C++/Cuda code after Linux update

We have an in-house C++-code which partly uses CUDA. The CUDA-code is spread between the files "cuda_kernel.hpp" and "cuda_kernel.cu".
All was good and the code compiled both on my local machine and our cluster.
Now I had to update my Linux from impish to jammy, which I did on Friday. When trying to compile said project today I received the following error message:
Making all in dergeraet
make[1]: Entering directory '/home/paul/Projekte/DerGeraet/dergeraet'
make all-am
make[2]: Entering directory '/home/paul/Projekte/DerGeraet/dergeraet'
CXX poisson.o
make[2]: *** No rule to make target '/usr/include/c++/10/new', needed by 'cuda_kernel.o'. Stop.
make[2]: Leaving directory '/home/paul/Projekte/DerGeraet/dergeraet'
make[1]: *** [makefile:306: all] Error 2
make[1]: Leaving directory '/home/paul/Projekte/DerGeraet/dergeraet'
make: *** [Makefile:374: all-recursive] Error 1
So I checked whether nvcc was installed. nvcc --version returned nothing so I followed the instructions on https://developer.nvidia.com/cuda-downloads to install cuda and then ran sudo apt install nvidia-cuda-toolkit. Now when calling nvcc --version Linux returns
nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2021 NVIDIA Corporation
Built on Thu_Nov_18_09:45:30_PST_2021
Cuda compilation tools, release 11.5, V11.5.119
Build cuda_11.5.r11.5/compiler.30672275_0
Ok, me thinks, let's compile again but the error-message still remains the same.
I checked '/usr/include/c++/10/new' and there is only
'/usr/include/c++/11/new', i.e., no '/usr/include/c++/10' folder.
I am really out of clues here. Tried reinstalling cuda twice with different version numbers (11.6 and 11.7) but the error persisted. Is this some weird incompatibility issues between gcc and nvcc?
Other in-house code (without CUDA) compiles fine, thus I think it must be a cuda-related problem.
Thanks for any help in advance!
This error was caused by an incomplete host g++ installation. In this case the libstdc++-10-dev package was either missing or incorrectly installed.

Ipopt installation

I tried to install the Ipopt package on my Mac (macOS Catalina, 10.15.0) following this installation guide:
https://coin-or.github.io/Ipopt/INSTALL.html
I installed ASL as the linear solver and made it to the point 3. makewithout any further issues. However, when I run make test, I receive the following error message:
cd test; /Applications/Xcode.app/Contents/Developer/usr/bin/make test
CXX hs071_main.o
CXX hs071_nlp.o
CXXLD hs071_cpp
CC hs071_c.o
CCLD hs071_c
ln -s ../examples/hs071_f/hs071_f.f hs071_f.f
F77 hs071_f.o
F77LD hs071_f
ld: library not found for -lmkl_core
collect2: error: ld returned 1 exit status
make[1]: *** [hs071_f] Error 1
make: *** [unitTest] Error 2
Does anyone know how to fix this issue? It seems like it can't find the mkl library...
Yes, you have to install the Intel MKL library https://software.intel.com/content/www/us/en/develop/tools/oneapi/components/onemkl.html since it is not part of Mac OS.

Linking error with Movesense library 1.9.0.rc3

I get a linking error after updating Movesense library from 1.8.1 to 1.9.0 in my project and even in the hello world sample project. Has anyone else has this problem and can offer a solution?
I am running the SDK on
Ubuntu 18.04.2 LTS
arm-none-eabi-gcc 7.3.1
Same problem with gcc-arm-none-eabi-7-2017-q4
Here is the output of the linking failure after calling ninja:
FAILED: Movesense
: && /usr/bin/arm-none-eabi-gcc -W -Wall -[...] ../platform/nRF5x/linker/gcc/appflash.ld CMakeFiles/Movesense.dir/App.cpp.obj CMakeFiles/Movesense.dir/HelloWorldService.cpp.obj CMakeFiles/Movesense.dir/generated/sbem-code/sbem_definitions.cpp.obj CMakeFiles/Movesense.dir/generated/app-resources/resources.cpp.obj CMakeFiles/Movesense.dir/app-metadata/metadata.cpp.obj -o Movesense /home/lukas/Projects/movesense/movesense-device-lib/MovesenseCoreLib/lib/GCCARM/libmovesense-coreD.a -lm -lstdc++ && :
lto1: internal compiler error: bytecode stream: expected tag round_div_expr instead of reference_type
Please submit a full bug report,
with preprocessed source if appropriate.
See <https://gcc.gnu.org/bugs/> for instructions.
lto-wrapper: fatal error: /usr/bin/arm-none-eabi-gcc returned 1 exit status
compilation terminated.
/usr/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/bin/ld: error: lto-wrapper failed
collect2: error: ld returned 1 exit status
ninja: build stopped: subcommand failed.
With Movesense 1.8.1 everything works fine:
git checkout 38be3c2
[...]
cmake -G Ninja -DMOVESENSE_CORE_LIBRARY=../MovesenseCoreLib/ -DCMAKE_TOOLCHAIN_FILE=../MovesenseCoreLib/toolchain/gcc-nrf52.cmake ../samples/hello_world_app
[...]
ninja
[...]
[8/8] Linking CXX executable Movesense
Thanks in advance!
From CHANGES.md (& README.md) since 1.9.0
REQUIRED: Use Windows build environment only (due to above GNU OSX bug)
REQUIRED: Use GNU Toolchain for ARM v. 7.2.1 2017q4
This situation is unfortunate and will be rectified in the coming 2.0 release with a new docker based build environment.
Full Disclaimer: I work for the Movesense team

libcudart.so.7.5: cannot open shared object file:No such file or directory

I was trying to compile darknet(YOLO) with Cuda and Opencv. I compiled them and there is no error but there is warning like this :
/usr/bin/ld: warning: libcudart.so.7.5, needed by /usr/local/lib/libopencv_core.so, not found (try using -rpath or -rpath-link)
When I try with the example from https://pjreddie.com/darknet/yolo/, an error come out.
./darknet: error while loading shared libraries: libcudart.so.7.5: cannot open shared object file: No such file or directory
I don't know how to solve this.
Below is my system
OS = Ubuntu 16.04 LTS
CUDA = 8.0
OPENCV = 2.4
Typing nvcc -V on terminal result with this
nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2016 NVIDIA Corporation
Built on Sun_Sep__4_22:14:01_CDT_2016
Cuda compilation tools, release 8.0, V8.0.44
I installed opencv using this command like shown from http://milq.github.io/install-opencv-ubuntu-debian/
sudo apt-get install libopencv-dev python-opencv
I did use option two from the page but during make process, it return the following error
modules/cudalegacy/CMakeFiles/opencv_cudalegacy.dir/build.make:2982: recipe for target 'modules/cudalegacy/CMakeFiles/opencv_cudalegacy.dir/src/graphcuts.cpp.o' failed
make[2]: *** [modules/cudalegacy/CMakeFiles/opencv_cudalegacy.dir/src/graphcuts.cpp.o] Error 1
CMakeFiles/Makefile2:16054: recipe for target 'modules/cudalegacy/CMakeFiles/opencv_cudalegacy.dir/all' failed
make[1]: *** [modules/cudalegacy/CMakeFiles/opencv_cudalegacy.dir/all] Error 2
make[1]: *** Waiting for unfinished jobs....
[ 59%] Linking CXX shared library ../../lib/libopencv_photo.so
[ 59%] Built target opencv_photo
Makefile:160: recipe for target 'all' failed
make: *** [all] Error 2
I already put the path for cuda inside .bashrc and reload it but the same error appears.
Below is the path for cuda inside my .bashrc
export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:/usr/local/cuda/lib64"
export CUDA_HOME=/usr/local/cuda
export PATH=${CUDA_HOME}/bin:${PATH}
Thank you for your help.
Your error message indicates that version 7.5 of the CUDA runtime is needed by OpenCV (i.e. it was compiled against that version of CUDA.
Your installed version of CUDA is 8.0. Adding it's library path will not help finding a suitable version for OpenCV.
Build OpenCV against CUDA 8.0, or install CUDA 7.5 and add the library directory to LD_LIBRARY_PATH.
Technically you could also try a mixed build (i.e. just adding the CUDA 7.5 library directory to LD_LIBRARY_PATH, preferably after the CUDA 8.0 path). However carrying two versions of the CUDA runtime will likely lead to problems (I've never tried), and I'd recommend against it.
This is the solution for others who got same problem as me. I use the suggestion from daveselinger here https://github.com/opencv/opencv/issues/6677
git clone the repository and git checkout 3.1.0 with cuda 8 (refer to the link). After that just cmake and make
It worked for me.
$ cd /usr/local/cuda/lib64
$ $ln -s libcudart.so libcudart.so.7.5
There is no difference between libcudart.so.7.5 and libcudart.so.8.0.

Error while building OpenCV 3.1.0 with extra modules on OS X Mavericks

I am a beginner in OpenCV, using OpenCV 3.1.0 (downloaded from OpenCV.org) with Mac OS X 10.9.5.
I was trying to run a code which needs contrib.hpp, then I found the extra modules from Github. There is a command from the page:
$ cd <opencv_build_directory>
$ cmake -DOPENCV_EXTRA_MODULES_PATH=<opencv_contrib>/modules <opencv_source_directory>
$ make -j5
Everything was successful before I did make, it shows an error of no matching function for call to 'calibrateCamera' :
[ 92%] Building CXX object modules/aruco/CMakeFiles/opencv_aruco.dir/src/aruco.cpp.o
/Users/Youko/downloads/opencv_contrib-master/modules/aruco/src/aruco.cpp:1583:12: error:
no matching function for call to 'calibrateCamera'
return calibrateCamera(processedObjectPoints, processedImagePoints, ...
^~~~~~~~~~~~~~~
/Users/Youko/downloads/opencv-3.1.0/modules/calib3d/include/opencv2/calib3d.hpp:844:21: note:
candidate function not viable: requires at most 9 arguments, but 12 were
provided
CV_EXPORTS_W double calibrateCamera( InputArrayOfArrays objectPoints,
^
1 error generated.
make[2]: *** [modules/aruco/CMakeFiles/opencv_aruco.dir/src/aruco.cpp.o] Error 1
make[1]: *** [modules/aruco/CMakeFiles/opencv_aruco.dir/all] Error 2
make: *** [all] Error 2
In the case of I wanna keep the version of Mac OSX, I was thinking of change the version of OpenCV, so I've downloaded OpenCV from Github, and tried to install the OpenCV with following command (it was the same way as how I've installed OpenCV 3.1.0 successfully):
$ cd <opencv_source_directory>
$ mkdir release
$ cd release
$ cmake -G "Unix Makefiles" ..
$ make
$ sudo make install
But there is another problem when I tried make:
[ 44%] Building CXX object modules/videoio/CMakeFiles/opencv_videoio.dir/src/cap_mjpeg_decoder.cpp.o
[ 44%] Building CXX object modules/videoio/CMakeFiles/opencv_videoio.dir/src/cap_avfoundation_mac.mm.o
[ 44%] Linking CXX shared library ../../lib/libopencv_videoio.dylib
ld: framework not found CoreImage
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[2]: *** [lib/libopencv_videoio.3.1.0.dylib] Error 1
make[1]: *** [modules/videoio/CMakeFiles/opencv_videoio.dir/all] Error 2
make: *** [all] Error 2
I thought maybe there was something wrong with cmake, so I tried the following command as well but the same error occurred with make:
$ cmake -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/usr/local ..
I've googled for the problem and it seems like I must need the QuartzCore, but most of people said it should be included in the Xcode (I am using Xcode 6.2 btw). I tried both ways to figure it out but I still have no idea why I can't build the extra modules. (I think the most weird problem is that I cannot install OpenCV cloned from Github, but I just wanna show I tried this way but it wasn't successful FYI.)
I'd be most grateful for any help and suggestions!