multiple definition of __getreent

Sujay Raj sujayraaj at gmail.com
Sun Jun 21 17:24:59 UTC 2015


@Chris , I used  'target_link_libraries' in mk_bin/CMakeLists.txt to link
libc.a and libbsd.a to the monkey-bin target

@Joel, removing -O0 doesn't work too.

I needed libc for three function , initgroups, timegm, and sendfile.

Today I figured that monkey can function without 'initgroups' , if it is
given all privileges, which I think will be the case when it runs on rtems
(I tested on linux and when run from root, it can work without initgroups)
. And I wrote a my_timegm function emulating what timegm does. So these two
functions aren't needed anymore. (both were tested and working on linux)

The problem comes with sendfile.

So, just to get things working, I also wrote a make shift version of
sendfile using read/write (which is working on linux, but is theoretically
slow).

Doing the above removed the requirement of linking libc.a totally.

So yeah, we now have a working version of monkey on rtems using libbsd,
which is ready to be tested on qemu. Though, this is not the ideal
circumstances that we would have hoped for, and I certainly would want
monkey to be using the default sendfile from the library.

Regards,
Sujay Raj

On Sun, Jun 21, 2015 at 5:00 AM, Joel Sherrill <joel.sherrill at oarcorp.com>
wrote:

> I suspect it is because he is compiling at -O0.
>
> On June 20, 2015 6:13:23 PM CDT, Chris Johns <chrisj at rtems.org> wrote:
> >On 20/06/2015 2:34 am, Sujay Raj wrote:
> >> Hi ,
> >>
> >> I am working on porting the monkey http server to rtems.
> >>
> >> I am working on the bsp: xilinx_zynq_a9_qemu , target: arm-rtems4.11.
> >>
> >> There are two libraries that I am supposed to link to create my final
> >> executable, one is libbsd.a and the other is libc.
> >>
> >> libbsd.a links alright, but whenever I try to link libc to create the
> >> final executable , I get an error:
> >>
> >>
>
> >/home/raaj/development/rtems/4.11/bsps/arm-rtems4.11/xilinx_zynq_a9_qemu/lib/librtemscpu.a(default-configuration.o):
> >> In function `__getreent':
> >>
> >>
>
> >/home/raaj/development/rtems/xilinx_zynq_a9_qemu/arm-rtems4.11/c/xilinx_zynq_a9_qemu/cpukit/libmisc/../../cpukit/../../../xilinx_zynq_a9_qemu/lib/include/rtems/confdefs.h:2420:
> >> multiple definition of `__getreent'
> >>
> >>
>
> >/home/raaj/development/rtems/4.11/tools/lib/gcc/arm-rtems4.11/4.9.2/../../../../arm-rtems4.11/lib/thumb/armv7-a/neon/hard/libc.a(lib_a-getreent.o):
> >>
> >>
>
> >/home/raaj/development/rtems/rtems-source-builder/rtems/build/arm-rtems4.11-gcc-4.9.2-newlib-2.2.0.20150423-x86_64-linux-gnu-1/build/arm-rtems4.11/thumb/armv7-a/neon/hard/newlib/libc/reent/../../../../../../../../../gcc-4.9.2/newlib/libc/reent/getreent.c:13:
> >> first defined here
> >>
> >>
> >>
> >> The CFLAGS I am using to compile are :
> >>
> >> -march=armv7-a -mthumb -mfpu=neon -mfloat-abi=hard -mtune=cortex-a9
> >-O0
> >> -g -qrtems -B/home/raaj/development/rtems/4.11/bsps/arm-rtems4.11/lib
> >>
>
> >-B/home/raaj/development/rtems/4.11/bsps/arm-rtems4.11/xilinx_zynq_a9_qemu/lib/
> >> --specs bsp_specs
> >>
> >>
> >>
> >> note: I require libc for three function , initgroups, timegm, and
> >sendfile.
> >>
> >> note: I am working on a cmake build system
> >>
> >> If the information given here is insufficient, kindly ask.
> >>
> >
> >Can you please post the full command line you are using to link with ?
> >
> >Thanks
> >Chris
> >_______________________________________________
> >devel mailing list
> >devel at rtems.org
> >http://lists.rtems.org/mailman/listinfo/devel
>
> --joel
> _______________________________________________
> devel mailing list
> devel at rtems.org
> http://lists.rtems.org/mailman/listinfo/devel
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rtems.org/pipermail/devel/attachments/20150621/1a7436a9/attachment.html>


More information about the devel mailing list