Building AWS secure tunneling localproxy on rPi - amazon-web-services

I'm trying to compile the AWS iot localproxy on an rPi (have tried 3 and 4 and getting the same issue). I follow the instructions here >> https://github.com/aws-samples/aws-iot-securetunneling-localproxy
I have been sucessful compiling on macOS and the binary works, but when building on an rPi I get the folowing error...
[ 4%] Linking CXX executable bin/localproxytest
/usr/bin/ld: /usr/local/lib/arm-linux-gnueabihf/libprotobuf-lite.a(arena.cc.o): in function `google::protobuf::internal::ThreadSafeArena::Init(bool)':
arena.cc:(.text+0xa60): undefined reference to `__atomic_fetch_add_8'
collect2: error: ld returned 1 exit status
make[2]: *** [CMakeFiles/localproxytest.dir/build.make:292: bin/localproxytest] Error 1
make[1]: *** [CMakeFiles/Makefile2:97: CMakeFiles/localproxytest.dir/all] Error 2
make: *** [Makefile:103: all] Error 2
It seems to be a problem linking to '__atomic_fetch_add_8' or the atomic libs? Any clues on how to resolve? Anyone been successful building this on an rPi?

I believe there is an issue with CMake and the order of linking with ld.
In CMakeLists.txt
Moving atomic to be the last link command after all the sources fixed this for me
https://github.com/aws-samples/aws-iot-securetunneling-localproxy/blob/main/CMakeLists.txt#L94
if(NOT APPLE AND NOT MSVC) target_link_libraries(${AWS_TUNNEL_LOCAL_PROXY_TARGET_NAME} atomic) target_link_libraries(${AWS_TUNNEL_LOCAL_PROXY_TEST_NAME} atomic) endif()
should be below
https://github.com/aws-samples/aws-iot-securetunneling-localproxy/blob/main/CMakeLists.txt#L111
target_link_libraries(${AWS_TUNNEL_LOCAL_PROXY_TEST_NAME} ${Protobuf_LITE_STATIC_LIBRARY})

Related

How to link OpenCl library to Clion IDE

I am writing a HellowWorld example using opencl library in Clion.
My problem is problem is that i get the error message
[ 50%] Linking CXX executable HelloWorldOpencl
/usr/lib64/gcc/x86_64-suse-linux/7/../../../../x86_64-suse-linux/bin/ld: CMakeFiles/HelloWorldOpencl.dir/main.cpp.o: in function `main':
/home/belkacem/CLionProjects/HelloWorldOpencl/main.cpp:11: undefined reference to `clGetPlatformIDs'
collect2: error: ld returned 1 exit status
gmake[2]: *** [CMakeFiles/HelloWorldOpencl.dir/build.make:84: HelloWorldOpencl] Error 1
gmake[1]: *** [CMakeFiles/Makefile2:76: CMakeFiles/HelloWorldOpencl.dir/all] Error 2
gmake: *** [Makefile:84: all] Error 2
my opencl is installed correctly in the following directiries
libOpenCL1 - OpenCL ICD Bindings
/etc/alternatives/libOpenCL.so.1
/usr/lib64/libOpenCL.so.1
/usr/lib64/ocl-icd
/usr/lib64/ocl-icd/libOpenCL.so.1
/usr/lib64/ocl-icd/libOpenCL.so.1.0.0
/usr/share/doc/packages/libOpenCL1
/usr/share/doc/packages/libOpenCL1/README
7 files total
How i can link the library with Clion IDE?
Your OpenCL installation might be incomplete - you should have a library libOpenCL.so somewhere, and also at least one ICD file in the /etc/OpenCL/vendors directory.

linking error cxx: cannot find -lvulkan

When I tried to compile example from Anvil framework for Vulkan I get following errors:
[ 97%] Linking CXX executable OutOfOrderRasterization
/usr/bin/ld: cannot find -lvulkan
collect2: error: ld returned 1 exit status
CMakeFiles/OutOfOrderRasterization.dir/build.make:126: recipe for target 'OutOfOrderRasterization' failed
make[2]: *** [OutOfOrderRasterization] Error 1
CMakeFiles/Makefile2:72: recipe for target 'CMakeFiles/OutOfOrderRasterization.dir/all' failed
make[1]: *** [CMakeFiles/OutOfOrderRasterization.dir/all] Error 2
Makefile:83: recipe for target 'all' failed
make: *** [all] Error 2
How i need to configure Vulkan to resolve it? (Ubuntu)
Check you LIBRARY paths. You might need to download and install vulkan. There should a .so file in one your library paths(/usr/lib{,64},/lib{,64}, /usr/share/lib{,64}) named to the effect of libvulkan.numbers.so.
See this ask ubuntu question: https://askubuntu.com/questions/796442/ld-cannot-find-lvulkan
CMake versions 3.7 and later ship with a FindVulkan.cmake module that finds the Vulkan includes and library for you if you have a Vulkan SDK installed and the VULKAN_SDK environment variable set. The CMake module also finds the includes and library if you have installed a Vulkan package to your system directories. The Getting Started guide on the LunarXchange website has some additional detail.

Compiling opencv for ARM platform

I want to put C++ opencv algorithm on ARM-Linux based camera.
I am able to do Configure and Generate steps for opencv build using CMake.
Then when I try to do “make” operation on terminal I am facing some issue.
->>>>>>>>>>>>>>>>>Issue->>>
Linking CXX shared library ../../lib/libopencv_core.so
/opt/montavista_pro_arm_v5t_le/bin/../lib/gcc/armv5tl-montavista-linux-gnueabi/4.2.0/../../../../armv5tl-montavista-linux-gnueabi/bin/ld: cannot find -lz
collect2: ld returned 1 exit status
make[2]: *** [lib/libopencv_core.so.3.0.0] Error 1
make[1]: *** [modules/core/CMakeFiles/opencv_core.dir/all] Error 2
make: *** [all] Error 2
->>>>>>>>>>>>>>>>
I searched online. I tried to do some stuff from link http://answers.opencv.org/question/33564/opencv-master-branch-compilation-issue/ . I removed ${ZLIB_LIBRARIES} option in modules/core/CMakeLists.txt.
But still I am facing same issue.
Can you please help me with that.

Compiling ROS on RPI fails at opencv with undefined reference to 'header'

I'm trying to compile ROS (Robot Operating System) on a Raspberry Pi (Raspbian) following these instructions and got to the point to compile ROS, which fails at compiling opencv with undefined reference to 'header':
[ 97%] Built target opencv_videostab
[ 98%] Built target opencv_haartraining_engine
Linking CXX executable ../../bin/opencv_createsamples
../../lib/libopencv_highgui.so.2.4.6: undefined reference to `header'
collect2: ld returned 1 exit status
make[2]: *** [bin/opencv_createsamples] Error 1
make[1]: *** [apps/haartraining/CMakeFiles/opencv_createsamples.dir/all] Error 2
make: *** [all] Error 2
<== Failed to process package 'opencv2':
Command '/home/ilagi/ros_catkin_ws/install_isolated/env.sh make -j1 -l1' returned non-zero exit status 2
I googled to try to figure out what header file might be missing, but unfortunately didn't get anywhere.
I hope somebody will have an idea about at least the directions to go from here.
Thanks
I guess I'm going to answer my own question. I don't exactly know which dependency caused this particular error, but I had recompiled ffmpeg based on the instructions provided at http://ariandy1.wordpress.com/2013/02/13/raspberry-pi-rasbian-opencv/ and now I managed to get ROS to compile opencv.

Issue with CMake project building

I have the following problem. On my Ubuntu I try to build a project and receive the following linker error(s) so far:
/usr/bin/ld:
/usr/lib/gcc/x86_64-linux-gnu/4.8/../../../x86_64-linux-gnu/libboost_thread.a(once.o): undefined reference to symbol 'pthread_once##GLIBC_2.2.5'
/lib/x86_64-linux-gnu/libpthread.so.0: error adding symbols: DSO
missing from command line collect2: error: ld returned 1 exit status
make[2]: *** [sunprint] Error 1 make[1]: ***
[CMakeFiles/sunprint.dir/all] Error 2 make: *** [all] Error 2
*** Failure: Exit code 2 ***
I'm running under ubuntu 13 desktop, GCC 4.8, boost ver. is 1.54. As an IDE I'm working with
is the KDevelop.
I can provide any additional info about this issue if needed, but now I'm stuck with
this linking problem.
Any ideas?
Thanx in advance.
add_definitions only adds inputs for the preprocessor, which is in action even before the compiler starts its business and even much farther away from linking the executable, the step ld is supposed to be doing.
What you want to have ld resolve link-time dependencies is the CMake command target_link_libraries, which, for a given target, add a number of libs to link against after compilation.
In you case, the appropriate invocation could look like this
target_link_libraries(${PROJECT_NAME} [...] -lpthread [...]) #obviously without the '[...]' and the correct target name
I had a similar problem but with mpich. Both:
target_link_libraries(${PROJECT_NAME} [...] -lmpich [...])
and
target_link_libraries(${PROJECT_NAME} [...] mpich [...])
worked properly.