undefined reference to `shm_open'

Niko Lau niko84embedded at googlemail.com
Tue Dec 15 18:20:14 UTC 2009


2009/12/15 Ian Harrold <ian.harrold at gmail.com>:
>
>
> On Tue, Dec 15, 2009 at 10:31 AM, Niko Lau <niko84embedded at googlemail.com>
> wrote:
>>
>> 2009/12/15 Lennart Sorensen <lsorense at csclub.uwaterloo.ca>:
>> > On Tue, Dec 15, 2009 at 05:16:05PM +0100, Niko Lau wrote:
>> >> I want to use the libv4l2 for my arm platform with uclibc cross
>> >> compiler.
>> >> When I link a appl with that lib I get the following error:
>> >> arm-linux-uclibc-gcc -Wall -O2 -g -I../libv4l2/include
>> >> -L../libv4l2/lib  -o capture capture.c -lv4l2 -lv4lconvert
>> >> ../libv4l2/lib/libv4lconvert.so: undefined reference to `shm_open'
>> >> collect2: ld returned 1 exit status
>> >> make: *** [test] Fehler 1
>> >>
>> >> The lib is built with the same compiler without any error.
>> >> Can someone give me a hint what the problem is. Since it works with a
>> >> glibc compiler i think the problem is the uclibc.
>> >
>> > The man page (for the glibc version) says you have to link with -lrt.
>> > I don't see you doing that.  Do you have to?  Does uclibc have such
>> > a thing and does it do shm_open?  I guess it must or the header files
>> > would have failed yoiur earlier compile already.
>> >
>> > --
>> > Len Sorensen
>> >
>>
>> The -lrt flag is set during libv4lconvert building. I can see shm_open
>> in the include file (/sys/mman.h)
>> so i think uclibc has shm_open.
>>
>> Niko
>
>
> Did you compile uclibc with "UCLIBC_HAS_REALTIME" option for real time
> support?  I beleive this to be correct.
>
> shm_open() implementation is in /librt/shm.c  and defined in
> /include/sys/shm.h
>
> So if your code capture.c uses shm, then you need to link the implementation
> -lrt in the compile to fix the linker error.   If that still doesn't work
> then perhaps you didn't compile uclibc to support shm?

Ok it looks like shm is not fully implemented yet.

-lrt in compile line doesnt work. UCLIBC_HAS_REALTIME is on, but there
is no /librt/shm.c.

Thanks for the help.
Niko


More information about the uClibc mailing list