Adding AMQPCPP C++ libraries for TCP Socket Connection, TX2 device

I want to install some c++ libraries in order to handle a TCP connection from my host machine, to a TX2 device on the same wifi network. I have downloaded the AMQPCPP library from:

I followed the instructions for installing using Make. This did put .so files in the /usr/lib directory and a bunch of .h files in the /usr/include directory for the amqpcpp.

I believe to deploy proper binaries to the Jetson, they must be included in /usr/aarch64-linux-gnu. So I have copided the .so file from /usr/lib to /usr/aarch64-linux-gnu/lib and .h files from /usr/include to /usr/aarch64-linux-gnu/include.

A lot of manual copy and paste has been done to get files that I’m certain I need. Is this the way I’m suppossed to do this or is there a more systematic approach for getting these files to build properly and deploy to the Jetson device?

The ultimate goal is to use rabbitmq and run a messaging server over the wifi network. This is being run on Ubuntu 18.04 with the 2019.2 Isaac SDK.

I did add build files to the directory “~/isaac/third_party” using the tensorrt as a template. Here is what one build in the third_party folder looks like below and named “amqpcpp.BUILD”:

cc_library(
name = “amqpcpp”,
includes = [“include”,],
srcs = glob([“lib/libamqpcpp.so*”]),
hdrs = glob([“include/amqpcpp.h”, “include/amqpcpp/.h", "include/amqpcpp/**/.h”]),
visibility = [“//visibility:public”],
include_prefix = “include”,
linkopts = [
“-L/usr/lib”,
],
linkstatic = True,
)

A second build file is shown in the below comment as well:

And also a second build file named “amqpcpp_jetson.BUILD”

cc_library(
name = “amqpcpp_jetson”,
includes = [“include”],
srcs = glob([“lib/libamqpcpp.so*”]),
hdrs = glob([“include/amqpcpp.h”, “include/amqpcpp/.h", "include/amqpcpp/**/.h”]),
visibility = [“//visibility:public”],
include_prefix = “include”,
linkopts = [
“-L/usr/aarch64-linux-gnu/lib”,
],
linkstatic = True,
)

Added to main "BUILD: file in issac/third_party:

cc_library(
name = “amqpcppLib”,
visibility = [“//visibility:public”],
deps = select({
“//engine/build:platform_x86_64”: [“@amqpcpp”],
“//engine/build:platform_jetpack42”: [“@amqpcpp_aarch64_jetson”],
}),
)

cc_library(
name = “libeventLib”,
visibility = [“//visibility:public”],
deps = select({
“//engine/build:platform_x86_64”: [“@libevent”],
“//engine/build:platform_jetpack42”: [“@libevent_aarch64_jetson”],
}),
)

These are appended below the original libraries.

@repositories were added to package.bzl file (found in isaac/third_party).

Must have “load(”//engine/build:isaac.bzl", “isaac_new_local_repository”)" at top.

isaac_new_local_repository(
  name       = "amqpcpp",
  path       = "/usr",
  build_file = clean_dep("//third_party:amqpcpp.BUILD"),
  licenses   = ["//:LICENSE"],
)

isaac_new_local_repository(
  name       = "amqpcpp_jetson",
  path       = "/usr/aarch64-linux-gnu",
  build_file = clean_dep("//third_party:amqpcpp_jetson.BUILD"),
  licenses   = ["//:LICENSE"],
)

I get a clean build using ‘bazel build ’.
At this point I cannot deploy to the TX2 device.

One of the warning message on deploy:
“/usr/lib/gcc-cross/aarch64-linux-gnu/7/…/…/…/…/aarch64-linux-gnu/bin/ld: skipping incompatible /usr/aarch64-linux-gnu/lib/libamqpcpp.so when searching for -lamqpcpp”

At this point when I try to deploy to the Jetson, all .so files in /usr/aarch64-linux-gnu/lib regarding amqcpp are skipped due to incompatibility. Given this is not an error, it does lead to “unable to find -lamqpcpp” and “collect2: error: ld returned 1 exit status”

I changed the “amqpcpp_Jetson.BUILD” file to:

cc_library(
name = “amqpcpp_jetson”,
srcs = glob([“lib/aarch64-linux-gnu/amqpcpp/lib/libamqpcpp.so*”]),
hdrs = glob([“/lib/aarch64-linux-gnu/amqpcpp/include/amqpcpp.h”,
“/lib/aarch64-linux-gnu/amqpcpp/include/amqpcpp/.h",
"/lib/aarch64-linux-gnu/amqpcpp/include/amqpcpp/**/
.h”]),
visibility = [“//visibility:public”],
strip_include_prefix = “lib/aarch64-linux-gnu/amqpcpp/include”,
linkopts = [“-L/usr/lib/aarch64-linux-gnu/amqpcpp/lib”],
linkstatic = True,
)

It seemed as though I specified the repository path as “/usr/lib/aarch64-linux-gnu/”, when searching for .so files, the path being searched was /usr/lib. At this point I can now deploy to the robot. However, when I run my application, I get the following error:

“2019-09-23 09:26:01.850 ERROR engine/alice/backend/modules.cpp@307: iam-devices:rabbitMq: /home/iam/deploy/jake/moveBolt-pkg//external/com_nvidia_isaac/packages/iam-devices/librabbitMq_module.so: cannot open shared object file: No such file or directory
2019-09-23 09:26:01.850 PANIC engine/alice/backend/modules.cpp@309: Could not load all required modules for application”

rabbitMq is the module I created in my build file where my actual project is located. Removing any mention of the rabbitMq file will let me run my application without any issue and other modules I created and added have no problem. The main difference between this one and the others is that I have a third_party dependency referencing all the above comments I added.

I have run into a similar issue like this before. When deploying, librabbitMq.so module is put in my package folder under ~/deploy/jake/moveBolt-pkg/packages/iam-devices just like all my other modules, but when running the program, the location that is searched for the rabbitMq module is in:

“/home/iam/deploy/jake/moveBolt-pkg//external/com_nvidia_isaac/packages/iam-devices/librabbitMq_module.so”

This does not exist. Below is the creation of my module:

isaac_cc_module(
name=“rabbitMq”,
srcs=[“isaac/OrchestratorGoalListener.cpp”],
hdrs=[“isaac/OrchestratorGoalListener.hpp”, “isaac/conn_handler.h”],
deps=[“//third_party:amqpcpp”, “//third_party:libevent”]
)

It is also included at the top of the build file under mdoules as “//packages/iam-devices:rabbitMq”. It is also in my “*.app.json” file under modules as “iam-devices:rabbitMq”. (iam-devices is under the packages folder of my isaac root directory)

I have narrowed down the problem even further. I am using the conn_handler.h file from:

https://github.com/hoxnox/examples.amqp-cpp/blob/master/conn_handler.h

I did have to change line 9 to

LibEventHandlerMyError(struct event_base* evbase) : LibEventHandler(evbase), evbase_(evbase) {}

Bazel did not like the self initialization.

This takes care of the events for the amqpcpp. I have a codelet that includes the above .h file. When I try to delcare a handle in my codelet, such as:

ConnHandler handler;

This is when I get the error from post #6. Otherwise, the application will run everything else without issue before I start trying to use the conn_handler.h file or any of the ampqcpp library.

Is it possible the new libraries are just not being deployed to the robot? So when I try to access them, there is a crash because they don’t exist on the TX2 possibly? When I do a bazel build of my target application, there is not problem, probably because the libraries exist for sure on my machine in these locations:

/usr/include
/usr/lib
/usr/aarch64-linux-gnu/lib
/usr/aarch64-linux-gnu/include

/usr/lib/aarch64-linux-gnu
/usr/lib/aarch64-linux-gnu

Under the last 2, the folder for openssl, amqpcpp, and libevents have their own folders with includes and lib folders. The only location I manually placed files, was in /usr/aarch64-linux-gnu/ directories. I had to do this in order to build the project and deploy.