[Buildroot] How to choose C library dependencies

Илья Валеев ilya-valeev at yandex.ru
Wed May 18 19:55:10 UTC 2016


17.05.2016 02:15, Arnout Vandecappelle пишет:
> On 05/16/16 14:32, Илья Валеев wrote:
>>> On 05/14/16 05:59, Илья Валеев wrote:
>>>> Hello!
>>>> I want to compile ejabberd and run it on my router. I choose erlang
>>>> package with
>>>> SMP support and all modules and ejabberd package, does not
>>>> configure defconfig.
>>>> Then I run /make ejabberd/, copy ejabberd, erlang and busybox from
>>>> /target/
>>>> folder to router and run it.
>>>
>>>  Buildroot in't really meant for that kind of scenario. That said,
>>> it should
>>> be possible to do it. Basically you must create a toolchain that
>>> matches
>>> exactly with what is already installed on the target.
>> Is there any manual how to do this?
>
>  I'm afraid not. First of all you should check the kernel version and
> select the appropriate headers. Then check which libc is installed,
> and if it's uClibc you should also find which kind of threading is
> used by looking at /lib/*threads*.
Kernel is 2.6.36.4, I'll configure it in /make menuconfig/.
I think uClibc installed (see above). Where should be /lib/*threads*? On
host PC? In buildroot tree? In generated image? On target? What mean
asterisks around "threads" word?

>>>> I found that at least ejabberd compiled with glibc dependence and
>>>> won't run
>>>> without it. Running /cd /path/to/ejabberd && ./ejabberdctl start/
>>>> ends with
>>>>> /opt/lib/erlang/bin/erl: exec: line 29:
>>>>> /usr/lib/erlang/erts-7.3/bin/erlexec
>>>> As I found before, it's because erlexec want glibc which missing in
>>>> router.
>>>> Than I enable Linux kernel, set defconfig to bcm and try to run
>>>> /make/ and copy
>>>> these programms from rootfs image to router with same result.
>>>>
>>>> How can I compile these programms (ejabberd, erlang and busybox)
>>>> with uClibc
>>>> dependence?
>>>
>>>  The config file you attached indeed selects uClibc, so I don't see
>>> how it
>>> could possibly link against glibc. How do you know it links with glibc?
>>>
>>>  To verify something like that, do:
>>>
>>> readelf -d output/target/usr/lib/erlang/erts-7.3/bin/erlexec
>>>
>>> and check that all the libraries mentioned there exist on the target.
>>>
>> I've run /readelf -l
>> output/target/usr/lib/erlang/erts-7.3/bin/erlexec/ and it
>> show glibc as "requesting program interpreter".
>
>  glibc? It should be either /lib/ld-uClibc.so.0 or
> /lib/ld-linux-armhf.so.3 or something like that. Anyway, the point is:
> does that exist on the target?
>
>> My erlexec wants:
>> libm.so.1
>> libc.so.1
>  And do these exist on the target? If not, your target is not actually
> uClibc.

These files exist on target filesystem:
libc.so.0 (needs libc.so.1)
ld-uClibc.so.0
libm.so.0 (needs libm.so.1)

If I make symbol link to existing libs, ejabberd still does not start
with this error:
//opt/lib/erlang/erts-7.3/bin/erlexec: symbol '__ctype_b': can't resolve
symbol/
This means, as I know, wrong libs.

>> I copy them to router from buildroot generated rootfs, and error
>> "'/opt/lib/libc.so.1' library contains unsupported TLS" appears. So
>> it seems you
>> are right about toolchain.
>
>  How does it find things in /opt? Did you pass LD_LIBRARY_PATH?

Yes, I change LD_LIBRARY_PATH to erlexec find libraries in /opt too.

> You could copy the entire buildroot rootfs, then you're sure to have
> everything needed.
>
>  Regards,
>  Arnout

Where should be destination of copying? /opt or target filesystem? If
last, it is read only and I should recompile it all to add buildroot
files not to /opt.

>>
>>
>>>
>>>  Regards,
>>>  Arnout
>>>
>>>>
>>>> *Buildroot:* snapshot from 2016.05.13
>>>> *C library in menuconfig:* uClibc with C++ support
>>>> *defconfig:* bcm
>>>> *Target Architecture:* ARM (little endian)
>>>> *Target Architecture Variant:* cortex-A9
>>>> *System running buildroot:* Debian 8 x64
>>>> *Router:* Broadcom BCM4708A0, 2xARM Cortex A9, asuswrt-merlin 380.58_0
>>>> *.config:* in attach
>>>>
>>>> -- 
>>>> Идентификатор открытого ключа: 1D38C8C9
>>>> Отпечаток: 6210 01B6 A34E E490 A9E4  87DD 841D 0ABE 1D38 C8C9
>>>>
>>>>
>>>>
>>>> _______________________________________________
>>>> buildroot mailing list
>>>> buildroot at busybox.net
>>>> http://lists.busybox.net/mailman/listinfo/buildroot
>>>>
>>>
>>>
>>> -- 
>>> Arnout Vandecappelle                          arnout at mind be
>>> Senior Embedded Software Architect            +32-16-286500
>>> Essensium/Mind                                http://www.mind.be
>>> G.Geenslaan 9, 3001 Leuven, Belgium           BE 872 984 063 RPR Leuven
>>> LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle
>>> GPG fingerprint:  7493 020B C7E3 8618 8DEC 222C 82EB F404 F9AC 0DDF
>>
>>
>>
>> _______________________________________________
>> buildroot mailing list
>> buildroot at busybox.net
>> http://lists.busybox.net/mailman/listinfo/buildroot
>>
>
>

-- 
Идентификатор открытого ключа: 1D38C8C9
Отпечаток: 6210 01B6 A34E E490 A9E4  87DD 841D 0ABE 1D38 C8C9

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.busybox.net/pipermail/buildroot/attachments/20160519/31e2d41e/attachment-0001.html>


More information about the buildroot mailing list