Skip to content
This repository has been archived by the owner on Oct 12, 2023. It is now read-only.

Having trouble with "simulated device to cloud upload sample" #53

Closed
fcolumbu opened this issue Nov 21, 2016 · 6 comments
Closed

Having trouble with "simulated device to cloud upload sample" #53

fcolumbu opened this issue Nov 21, 2016 · 6 comments
Assignees

Comments

@fcolumbu
Copy link

fcolumbu commented Nov 21, 2016

I have my Azure IoT hub all setup and all the keys appropriately set in the json file. I even moved both files to the same directory to rule out path errors but the result is the same:

drwxrwxr-x 5 fcolumbu fcolumbu 4096 Nov 20 16:44 bindings
drwxrwxr-x 8 fcolumbu fcolumbu 4096 Nov 20 16:52 build
-rw-rw-r-- 1 fcolumbu fcolumbu 76 Nov 20 16:44 CHANGELOG.md
-rw-rw-r-- 1 fcolumbu fcolumbu 9392 Nov 20 16:44 CMakeLists.txt
-rw-rw-r-- 1 fcolumbu fcolumbu 3183 Nov 20 16:44 Contributing.md
drwxrwxr-x 8 fcolumbu fcolumbu 4096 Nov 20 16:44 core
-rw-rw-r-- 1 fcolumbu fcolumbu 5080 Nov 20 16:44 dependencies.cmake
-rw-rw-r-- 1 fcolumbu fcolumbu 1321 Nov 20 16:44 dependencies-test.cmake
drwxrwxr-x 11 fcolumbu fcolumbu 4096 Nov 20 16:44 deps
drwxrwxr-x 3 fcolumbu fcolumbu 4096 Nov 20 16:44 doc
-rw-rw-r-- 1 fcolumbu fcolumbu 4701 Nov 20 16:44 gatewayFunctions.cmake
drwxrwxr-x 6 fcolumbu fcolumbu 4096 Nov 20 16:52 install-deps
drwxrwxr-x 2 fcolumbu fcolumbu 4096 Nov 20 16:44 jenkins
-rw-rw-r-- 1 fcolumbu fcolumbu 1109 Nov 20 16:44 License.txt
drwxrwxr-x 10 fcolumbu fcolumbu 4096 Nov 20 16:44 modules
-rw-rw-r-- 1 fcolumbu fcolumbu 5456 Nov 20 16:44 README.md
drwxrwxr-x 10 fcolumbu fcolumbu 4096 Nov 20 16:44 samples
-rw-rw-r-- 1 fcolumbu fcolumbu 1955 Nov 20 19:35 simulated_device_cloud_upload_lin.json
-rwxrwxr-x 1 fcolumbu fcolumbu 300471 Nov 20 19:34 simulated_device_cloud_upload_sample
-rw-rw-r-- 1 fcolumbu fcolumbu 47081 Nov 20 16:44 ThirdPartyNotices.txt
drwxrwxr-x 4 fcolumbu fcolumbu 4096 Nov 20 17:55 tools
fcolumbu@fcolumbu-virtual-machine:~/azure-iot-gateway-sdk$ ./simulated_device_cloud_upload_sample simulated_device_cloud_upload_lin.json
./simulated_device_cloud_upload_sample: error while loading shared libraries: libnanomsg.so.5.0.0: cannot open shared object file: No such file or directory
fcolumbu@fcolumbu-virtual-machine:~/azure-iot-gateway-sdk$

Looks like this is not a new issue but the issue was closed without a clear resolution.

nanomsg/nanomsg#737

Here is one of the comments, "(Disclosure: I wrote mangos -- but I'm also the "maintainer" of nanomsg, so you can consider the advice to prefer mangos more or less "official" from the nanomsg team. :-)"

Recommendations?

@andrew-buckley
Copy link
Contributor

andrew-buckley commented Nov 21, 2016

Hi @fcolumbu, can you share a few more details:

  1. How did you build the project? Using the build.sh script? Or using cmake commands directly?
  2. If you built using cmake, did you change where it installs dependencies by default?
  3. Can you run 'ldd' on libnanomsg.so.5.0.0? It will either be in /usr/local/lib or elsewhere depending on whether you chose to change the install location.

Thanks,
-Andrew

@andrew-buckley
Copy link
Contributor

andrew-buckley commented Nov 21, 2016

Actually it looks like you built using the build scripts. Can you run an 'ldd' command on the libnanomsg.so.5.0.0 located in ~/azure-iot-gateway-sdk/install-deps/lib/?

@fcolumbu
Copy link
Author

Hi Andrew,

I used "build.sh" to install the sdk and related code. Here is the ldd output and location of the library:

fcolumbu@fcolumbu-virtual-machine:/usr/local/lib$ sudo find / -name libnanomsg.so.5.0.0 -print | grep libnanomsg.so.5.0.0
[sudo] password for fcolumbu:
/home/fcolumbu/azure-iot-gateway-sdk/deps/nanomsg/build/libnanomsg.so.5.0.0
/home/fcolumbu/azure-iot-gateway-sdk/install-deps/lib/x86_64-linux-gnu/libnanomsg.so.5.0.0
fcolumbu@fcolumbu-virtual-machine:/usr/local/lib$ ldd /home/fcolumbu/azure-iot-gateway-sdk/deps/nanomsg/build/libnanomsg.so.5.0.0
linux-vdso.so.1 => (0x00007fffaf13f000)
libanl.so.1 => /lib/x86_64-linux-gnu/libanl.so.1 (0x00007fdfc3134000)
librt.so.1 => /lib/x86_64-linux-gnu/librt.so.1 (0x00007fdfc2f2c000)
libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007fdfc2d0d000)
libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007fdfc2948000)
/lib64/ld-linux-x86-64.so.2 (0x000055efc9158000)
fcolumbu@fcolumbu-virtual-machine:/usr/local/lib$

Thanks,

Frank

@andrew-buckley
Copy link
Contributor

andrew-buckley commented Dec 1, 2016

We are still working on the fix for this issue. If you're interested, the fix required must happen in 2 places. We've made this pull request in the nanomsg repository to fix the pkgconfig configuration file to point to the correct location of the library. And from our end, we're working on fixing the RPATH of our targets to point to the correct location of the installed libraries that should work on all systems.

For now, can you try setting your LD_LIBRARY_PATH to "/home/fcolumbu/azure-iot-gateway-sdk/install-deps/lib/x86_64-linux-gnu/" and see if that helps?

Thanks,
-Andrew

@fcolumbu
Copy link
Author

fcolumbu commented Dec 1, 2016

Gave it a try:

export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/home/fcolumbu/azure-iot-gateway-sdk/install-deps/lib/x86_64-linux-gnu/
fcolumbu@fcolumbu-virtual-machine:~/azure-iot-gateway-sdk$ ./simulated_device_cloud_upload_sample simulated_device_cloud_upload_lin.json
Error: Time:Thu Dec 1 14:52:02 2016 File:/home/fcolumbu/azure-iot-gateway-sdk/core/src/module_loaders/dynamic_loader.c Func:DynamicModuleLoader_Load Line:75 DynamicLibrary_LoadLibrary() returned NULL
Error: Time:Thu Dec 1 14:52:02 2016 File:/home/fcolumbu/azure-iot-gateway-sdk/core/src/gateway_internal.c Func:gateway_addmodule_internal Line:399 Failed to add module because the module could not be loaded.
Error: Time:Thu Dec 1 14:52:02 2016 File:/home/fcolumbu/azure-iot-gateway-sdk/core/src/gateway_createfromjson.c Func:Gateway_CreateFromJson Line:75 Failed to create gateway using lower level library.
Error: Time:Thu Dec 1 14:52:02 2016 File:/home/fcolumbu/azure-iot-gateway-sdk/samples/simulated_device_cloud_upload/src/main.c Func:main Line:35 Failed to create gateway
fcolumbu@fcolumbu-virtual-machine:~/azure-iot-gateway-sdk$

Will wait for your bug fix.

Thank you

@andrew-buckley
Copy link
Contributor

The json for that sample expects you to run the sample from the build directory which may be why it's unable to find the modules it's looking for. We're changing documentation right now to document this. Can you try running the sample from the build directory rather than from the project root?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants