External builds with Dev Studio 5.3

@jyijyi,
Some joker deleted the thread or made it so I can’t access it anymore. Here’s what I found out:

OK, I created a sample app, then copied your .c, .cdef and .adef files over and built it. It errored out (all warnings are treated as errors), with a couple of functions that were defined but not used. I commented those out and their corresponding used static variables, and rebuilt. It built fine. But when I went to send it to the device and try to run, I get this error:
Could not stat file at ‘/tmp/libcurl.so.5’. No such file or directory
May 29 13:57:24 swi-mdm9x28 user.err Legato: =ERR= | supervisor[654]/supervisor T=main | app.c CreateFileLink() 1588 | Failed to create link at ‘/usr/lib/libcurl.so.5’ in app ‘HttpGet’.

My understanding is not what’s happening here. It appears in THIS case, it’s trying to create a link to files from the local drive on the device. In my case, I’m saying here’s a bundle that you need to copy over TO the device, because they don’t exist there. I also have the requires directive as well, but that’s in my .cdef.

In my own .adef, I put the .so’s that I needed in a bundle and had it put them in the local directory (./). They are there on the device. So I figured, that I could just have it create a link to it from there. I’ve tried, ./, and I’ve tried a full path, i.e. /legato/…/read-only/libmylib.so.5, and it just comes back with the same message, cannot stat the file libmylib.so.5 no matter what path I put in front, the same error that I get with the build of HttpGet. I’ve included it here.HttpGet.rar (118.3 KB)
Thanks for your help on this.
Evets

@jyijyi,
I’ve even tried copying the files to /usr/lib (again) and using the requires: directive in the adef to create the link for the app, but I get the same message: "could not stat file at ‘libcurl.so.5’. No such file or directory.

Evets

@jyijyi,
In playing around with your HttpGet program, I manually copied the libcurl.so.5 library over to the /tmp directory, and the first warning went away… I had to do that with subsequent needed files like libgnutls.so.28, libnettle.so.4, libhogweed.so.2 but copied them to /usr/lib directory, and all issues that were creating links went away, and replaced by:
httpGet: error while loading shared libraries: libcurl.so.4: cannot open shared object file: No such file or directory.

Which is exactly what I’m getting on my project. What else can I try?

Evets

I tried on WP8548 FW R15, libgnutls.so.28, libnettle.so.4, libhogweed.so.2 should be originally on /usr/lib, you don’t need to copy by yourself.
The reason you need to copy libcurl.so.5 to /tmp is because I change in .adef file :


// /usr/lib/libcurl.so.5 /usr/lib/
/tmp/libcurl.so.5 /usr/lib/


I want to show you that you need to copy the required library to a particular folder and let the application to import to the sandbox.
BTW, I cannot see your error message:
httpGet: error while loading shared libraries: libcurl.so.4: cannot open shared object file: No such file or directory.

And I can succussfully run the application on my board:


May 30 01:44:07 | httpGet[2534] | | HTTP Get!
May 30 01:44:11 | httpGet[2534] | | Succesfully received data:
May 30 01:44:11 | httpGet[2534] | | {“args”:{},“headers”:{“Accept”:“/”,“Connection”:“close”,“Host”:“httpbin.org”},“origin”:“14.0.227.228”,“url”:“https://httpbin.org/get”}


I don’t see libcurl.so.4 is required in .adef file and I cannot find libcurl.so.4 in the module’s file system…

@jyijyi
Actually, I get this after I’ve copied all the needed files manually to their locations. Then the loader can’t find the file, even though they are in the /usr/lib directory. I don’t get anymore messages about not being able to stat a file (libhogweed… etc) because they are already there. It’s the loader that can’t find them when you try to run the file.
I am running this on a WP7601, Release 8. What are you running it on?

Then I cannot reproduce on

  1. MangoH green board with WP8548 FW R15
  2. MangoH Red board with WP7702 FW R9

Are we using same environment?

May be you can double confirm if issue happens to your environment only.

@jyijyi
I have tried this both via Window Dev Studio 5.3.1 and Linux Dev Studio 5.3.1. I have tried this on both WP7601-1 and WP7601 devices on our board as well as a Mango Green board. Again, this is release 8. there is a newer release, that I will try to rebuild with release 9 and see if that makes any difference.

Thanks,
Evets

@jyijyi,
Release 9 was no difference, other than there were some separate .adef changes I had to make in my own system.

So, here’s something that’s odd to me. If I put in a bundle:/file: directive:
libcurl.so.5 /lib/usr/libcurl.so.5

After the install, shouldn’t I find that in the /legato/systems/current/apps/myapp/read-only/usr/lib folder? because I don’t, in fact I can’t find it anywhere.

I’ve also tried:
libcurl.so.5 /tmp

And that doesn’t work either.
And I’ve tried:
libcurl.so.5 ./

And I find it in the …/read-only folder after the install.

I just tried on WP76 R9 release, I don’t see problem to import library to run attached http_get sample code.
Maybe you can have a try.
http_get_WP76.rar (2.8 MB)

Hi @jyijyi
Strange, I could not run as is. In fact it didn’t even view it as a project. I didn’t have that problem last time with the other project you gave me. The DS kept trying to “convert it to a XText project”. I’m not sure what that is. Anyway, I did what I did before and created a new project and then put the .adef, .cdef and .c files in it. Again though, I couldn’t compile as is, as mine has “treat all warnings as errors” on, so I had to #if out a couple of functions and variables.
It ran, but I will say, this is not the same case. In my case, I have an outside library, not available on the device. libcurl.so.4.4 is available on the device. In the other version, you were using libcurl.so.5 which isn’t avaliable on the device.
Secondly, in the requires section of the .cdef, I had to change under lib:
curl
to
/usr/lib/libcurl.so.4.4
as DS said the format wasn’t correct, and that /usr/lib/libcurl.so.4.4 needed a path as well.

I will try this method on my app and see if it works.

Thanks for the help on this. It’s definitely a tough one.

Evets

@jyijyi,
After changing my requires in my .cdef and .adef, the loader still complains about not finding the lib.so file. It creates the link, but the loader can’t find it when the program tries to launch.

I guess you own library cannot be used on the wp module…
Can you modify my application so that i can see your problem?

I’m wondering if this is a Dev Studio problem. Since I’m not making it with mkapp directly, I’ve had a lot of issues where it can’t find files and such. Maybe it’s the way it gets linked in Dev Studio somehow.

You can create a layer in yocto source and compile your library by “make”
After that, your own library will be integrated into the /usr/lib inside the yocto.cwe image just like those libcurl.so.4.4 library.

Yes, in the end that’s what I’ll have to do. I was hoping that I could get it to work without that. Not a big deal other than there were a few additional libraries needed and I wanted to get this thing to run to make sure that it did before I went to that effort, since the library in question requires at least 5 other libraries not included in the 9x28 build. Also, there were some additional libraries that i needed for the iptables, that aren’t included, but when I added them back in, I get this message saying it’s not compatible with the 9x28 device. I just couldn’t find what file makes that determination.

Hi @jyijyi,
I did find a current work around for this.

  1. The device must be in sandboxed mode. I’ve not been able to run this outside of sandboxed mode to get this to work. In my case, I really need to run with sandbox:false, but I can deal without it for now. Without sandbox mode, I get the “can’t find libcurl.so.5 file” from the loader, or other .so files depending on the exe.
  2. Make sure you have /lib and /usr/lib in the required dir: sections.
  3. Add any needed additional libraries in bundles and put them in /lib. I had better luck with this than /usr/lib, not sure why.

Oh, and I found that I can’t debug in R9. I have to use R8. When in R9, it switches to the debugger perspective, but never gets to a breakpoint. On the device, it just says the app is not running.

Evets

I don’t see problem in setting breakpoint in debug mode for R9 in hello world application.

ati3
Manufacturer: Sierra Wireless, Incorporated
Model: WP7608
Revision: SWI9X07Y_02.16.02.00 000000 jenkins 2018/04/19 19:59:02
IMEI: 352913090100734
IMEI SV: 4
FSN: XG805285330204
+GCAP: +CGSM

OK

Legato Ver: 18.03.0_b463e04cf08fb8d8f1ea5ee00d7894c0_modified
Yocto Ver: SWI9X07Y_02.16.02.00 2018-04-19_22:03:13
OS Ver: Linux version 3.18.44 (jenkins@jenkins) (gcc version 6.2.0 (GCC) ) #2 PREEMPT Thu Apr 19 22:05:25 UTC 2018
LK Ver: SWI9X07Y_02.16.02.00
RootFS Ver: SWI9X07Y_02.16.02.00 2018-04-19_22:03:13
UserFS Ver: unknown
MCU Ver: 002.009

OK

@jyijyi, Yes. I don’t have a problem debugging HelloWorld in R9 either. But in my app, I have two processes. In R8, it comes up with a dialog that asks me which one I want to debug. In R9, it says it can’t get the process from the .adef file. I can build and download it just fine, just can’t debug it. I’ve even tried commenting out the other process and all it’s dependencies, but it still gives me the same message.

Evets

Do you mean you have two components inside your legato application?
I don’t see problem in setting breakpoint in one of the two components.
DS will ask you which components you want to debug.

Hi @EvetsMostel & @jyijyi

I suspect some tweaks in the adef file that would confuse the DS’s adef parser.
You can turn off the option in Window > Preferences > Developer Studio > Legato Editors > Ignore Parsing Errors to try to figure out what it can be.