Bug 8651

Summary: libMonoPosixHelper.so wrong link reference in buildroot image
Product: buildroot Reporter: Markus Egle <Markus.Egle>
Component: OtherAssignee: unassigned
Status: RESOLVED FIXED    
Severity: normal CC: buildroot
Priority: P5    
Version: 2015.11   
Target Milestone: 2016.02   
Hardware: All   
OS: Linux   
Host: Ubuntu 15.10 Target: Intel Atom PC104
Build:
Attachments: Archive with SimpleSerialPortOpen.exe
libmonoposixhelper location patch

Description Markus Egle 2016-02-04 13:15:13 UTC
With the current buildroot 2015.11.1 (initially seen with 2015.05) configured to use mono, the libMonoPosixHelper.so will be searched in the /home/userX/buildroot/output/host/usr/lib/ path. This path and file may exist on my building machine, but not on the target.

I have a working workaround with creating this folder and copy libMonoPosixHelper.so from /usr/lib at startup in the ram disk.
Comment 1 Angelo 2016-02-04 13:32:43 UTC
Dear Markus Egle,

It is probably reletad to this bug:

https://bugzilla.xamarin.com/show_bug.cgi?id=24131

Try that workaround and report your results here. I'll look at this ASAP.
Comment 2 Markus Egle 2016-02-04 14:24:11 UTC
Till now I'm not really familiar with the config/make procedure. 
So I don't know if I have to change the Makefile.in or the config.in or both. 

Found four possible locations to make the testing changes. 


...> find /home/eglem/buildroot -name "*.in"|grep mono|awk '{print "grep -Hn libMonoPosixHelper " $1}'|sh|grep target

/home/eglem/buildroot/output/build/host-mono-4.0.2.5/runtime/Makefile.in:629:	sed 's,target="$(prefix)/$(reloc_libdir)/libMonoPosixHelper$(libsuffix)",target="'$$d'/libMonoPosixHelper.la",' ../data/config > $@t
/home/eglem/buildroot/output/build/host-mono-4.0.2.5/data/config.in:13:	<dllmap dll="MonoPosixHelper" target="@prefix@/@reloc_libdir@/libMonoPosixHelper@libsuffix@" os="!windows" />
/home/eglem/buildroot/output/build/mono-4.0.2.5/runtime/Makefile.in:629:	sed 's,target="$(prefix)/$(reloc_libdir)/libMonoPosixHelper$(libsuffix)",target="'$$d'/libMonoPosixHelper.la",' ../data/config > $@t
/home/eglem/buildroot/output/build/mono-4.0.2.5/data/config.in:13:	<dllmap dll="MonoPosixHelper" target="@prefix@/@reloc_libdir@/libMonoPosixHelper@libsuffix@" os="!windows" />



Then I just remove the prefix?
Comment 3 Angelo 2016-02-05 14:42:12 UTC
Dear Markus Egle,

Could you try to have a look at file /etc/mono/config in your generated image?
Comment 4 Markus Egle 2016-02-05 16:06:44 UTC
The config file on the target shows this wrong path to the lib. 

grep home /etc/mono/config
	<dllmap dll="MonoPosixHelper" target="/home/userX/buildroot/output/host/usr/lib/libMonoPosixHelper.so" os="!windows" />
Comment 5 Angelo 2016-02-05 16:08:35 UTC
Great!

Change that line and it should work. Now we should understand where that file is generated that way ...
Comment 6 Markus Egle 2016-02-05 16:36:55 UTC
Crosschecked it...

- corrected ./buildroot/output/target/etc/mono/config

- removed the libMonoPosixHelper.so copy to home folder... at startup

And it works. Thanks.
Comment 7 Angelo 2016-02-14 21:55:37 UTC
Dear Markus Egle,

Could you send a minimal example that triggers the bug?

Thank you!
Comment 8 Markus Egle 2016-02-16 14:38:16 UTC
Created attachment 6331 [details]
Archive with SimpleSerialPortOpen.exe

            SerialPort sp = new SerialPort("/dev/ttyS0", 19200);
            try
            {
                sp.Open();
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
            }


creates the error that libMonoPosixHelper.so couldn't be found.
Comment 9 Angelo 2016-02-21 09:36:07 UTC
Created attachment 6336 [details]
libmonoposixhelper location patch

Dear Markus Egle,

Could you try the attached patch?

Simply drop it into package/mono folder and rebuild mono.

Thanks!
Comment 10 Markus Egle 2016-02-22 12:20:52 UTC
Fixed.

Applied patch with copying to buildroot/package/mono
After 
> make clean
> make

buildroot/output/target/etc/mono/config shows the correct path for libMonoPosixHelper.so without any prefix and accordingly bzImage works as expected. 

Thanks
Markus
Comment 11 Thomas Petazzoni 2016-02-22 12:27:34 UTC
Reopening the bug, since the patch proposed by Angelo has not been submitted/applied in Buildroot. Angelo, can you submit your patch?
Comment 12 Angelo 2016-02-22 13:06:07 UTC
(In reply to Thomas Petazzoni from comment #11)

Of Course, I'll submit a patch soon.

Sincerely, angelo
Comment 13 Arnout Vandecappelle 2016-02-25 23:35:01 UTC
9cc9c224f9675d1e724974a0915093e55519db8b has been committed.