Error: undefined reference to ndbm functions

Joel Sherrill joel at rtems.org
Mon Jul 1 13:55:47 UTC 2019


On Mon, Jul 1, 2019 at 8:05 AM Vaibhav Gupta <vaibhavgupta40 at gmail.com>
wrote:

>
>
> On Mon, Jul 1, 2019 at 6:21 PM Vaibhav Gupta <vaibhavgupta40 at gmail.com>
> wrote:
>
>>
>>
>> On Mon, Jul 1, 2019 at 6:18 PM Aditya Upadhyay <aadit0402 at gmail.com>
>> wrote:
>>
>>> On Mon, Jul 1, 2019 at 6:10 PM Vaibhav Gupta <vaibhavgupta40 at gmail.com>
>>> wrote:
>>> >
>>> >
>>> >
>>> > On Mon, Jul 1, 2019 at 6:07 PM Aditya Upadhyay <aadit0402 at gmail.com>
>>> wrote:
>>> >>
>>> >> On Mon, Jul 1, 2019 at 5:58 PM Joel Sherrill <joel at rtems.org> wrote:
>>> >> >
>>> >> > If you have finished ndbm, please do not attempt to write memcpy
>>> for SPARC. It is not as important as having fenv.h methods. We have a
>>> default memcpy implementation for all architectures. The hope was to find
>>> an already implemented optimized version with history for the SPARC. But so
>>> far we haven't found one with appropriate license. It will be difficult to
>>> implement, ensure correctness, and really gain speed.
>>> >> >
>>> >> > So work on filling a gap in what APIs are provided. Fenv.h
>>> >> >
>>> >> > Also we need to work on merging your ndbm work.
>>> >> >
>>> >> Newlib-Cygwin uses db_local.h and it was ported from FreeBSD. Since
>>> >> that, A lot thing has changed.
>>> >> If we replace this db_local.h to current freeBSD db.h, then we also
>>> >> need to make changes in other file such
>>> >> as hash.c.
>>> >>
>>> >> What is your view on this? Shall we ask this on newlib mailing list?
>>> >
>>> > I stepped up for this after the suggestion of gedare. Planned to
>>> update whole of search directory.
>>> > I asked this query on newlib, but they haven't replied yet. We can
>>> re-send this query.
>>>
>>> Yeah. You can resend that mail.  Did you find any porting source for
>>> fenv methods?
>>>
>> Just now started looking.
>>
>
In general, updating the newlib source is the best solution since it is
always
a snapshot of something else like a *BSD at some point in the past.

Ask again but proceed otherwise.

Personally, I would consider this two newlib patches. One to update
db_local.h and
the other to add ndbm. It may take a third to add ndbm documentation to the
top
of the source files.

Then a patch to RTEMS to add tests.

And a patch to rtems-docs to update the POSIX tracking spreadsheet.


> If not, Then you can take a look here:
>>> https://github.com/freebsd/freebsd/blob/master/lib/msun/arm/fenv.c
>>
>> FreeBSD is not having fenv implementation for SPARC architecture.
> I found it in NetBSD
> https://github.com/NetBSD/src/blob/trunk/sys/arch/sparc/include/fenv.h
> https://github.com/NetBSD/src/blob/trunk/lib/libm/arch/sparc/fenv.c
> .
> I also got implementation for ARM in NetBSD
> https://github.com/NetBSD/src/blob/trunk/sys/arch/arm/include/fenv.h
> https://github.com/NetBSD/src/blob/trunk/lib/libm/arch/arm/fenv.c
> But FreeBSD is having updated version for ARM.
>

FreeBSD is the preference when an architecture is supported by FreeBSD but
NetBSD is the BSD with more supported architectures. So use FreeBSD first,
then NetBSD. If NetBSD doesn't have it, then there is a good chance we won't
find it unless it is an older architecture like m68k which might have to be
fetched
from an old release.

--joel


> Thanks :D !!
>>
>>>
>>>
>>> >>
>>> >>
>>> >> > --joel
>>> >> >
>>> >> > On Mon, Jul 1, 2019, 5:54 AM Vaibhav Gupta <
>>> vaibhavgupta40 at gmail.com> wrote:
>>> >> >>
>>> >> >> Hello,
>>> >> >> I am reading about memcpy to write it for newlib.
>>> >> >> Should I also write wmemcpy along with it?
>>> https://pubs.opengroup.org/onlinepubs/009695399/functions/wmemcpy.html
>>> >> >> .
>>> >> >> Regarding ndbm reference. RSB has not generated library files.
>>> >> >> - but in newlib source tree, when I compiled newlib, while porting
>>> ndbm, it generated lib_a-ndbm.o object file.
>>> >> >> - I am planning to use that object file to compile ndbm testsuite.
>>> >> >> .
>>> >> >> When Object file and C file are present in same directory, we can
>>> use :
>>> >> >> $ gcc trial.c mylib.o
>>> >> >> But I am not able to find out, how to use this in Makefile.am.
>>> >> >> LDADD replaces all global variables while compiling.
>>> >> >>
>>> >> >> I tried various codes, but could not solve it. I just want to use
>>> the object file (lib_a-ndbm.o)
>>> >> >> created while building newlib, to compile ndbm testsuite.
>>> >> >>
>>> >> >> I need guidance for this.
>>> >> >>
>>> >> >> Vaibhav Gupta
>>> >> >>
>>> >> >> On Fri, Jun 28, 2019 at 9:57 PM Gedare Bloom <gedare at rtems.org>
>>> wrote:
>>> >> >>>
>>> >> >>> On Fri, Jun 28, 2019 at 7:20 AM Vaibhav Gupta <
>>> vaibhavgupta40 at gmail.com> wrote:
>>> >> >>> >
>>> >> >>> >
>>> >> >>> >
>>> >> >>> > On Fri, Jun 28, 2019, 6:19 PM Joel Sherrill <joel at rtems.org>
>>> wrote:
>>> >> >>> >>
>>> >> >>> >>
>>> >> >>> >>
>>> >> >>> >> On Fri, Jun 28, 2019, 8:40 AM Vaibhav Gupta <
>>> vaibhavgupta40 at gmail.com> wrote:
>>> >> >>> >>>
>>> >> >>> >>>
>>> >> >>> >>>
>>> >> >>> >>> On Fri, Jun 28, 2019, 5:57 PM Joel Sherrill <joel at rtems.org>
>>> wrote:
>>> >> >>> >>>>
>>> >> >>> >>>> You need to add the library to the gcc command that links
>>> the program. If the libndbm is in the library search path, add -lndbm.
>>> >> >>> >>>>
>>> >> >>> >>>> I don't recall the exact Makefile variable to set for this
>>> to show up. Look at the paranoia sample. It should be doing this with -lm.
>>> >> >>> >>>>
>>> >> >>> >>>> --joel
>>> >> >>> >>>
>>> >> >>> >>> Okay, I will try this!
>>> >> >>> >>
>>> >> >>> >>
>>> >> >>> >> The following web page is a pretty good description of
>>> building a library using a native GCC and linking it into a program. It
>>> includes some of the theory going on so this might help you.
>>> >> >>> >>
>>> >> >>> >>
>>> https://www.cs.swarthmore.edu/~newhall/unixhelp/howto_C_libraries.html
>>> >> >>> >>
>>> >> >>> >> Guys.. this comes up periodically, even though this is really
>>> basic tool usage to me, is this something we should provide some guidance
>>> on?
>>> >> >>> >
>>> >> >>> > Actually, i tried this before, but I cannot find libndbm in my
>>> development directory. I guess it is not generated.
>>> >> >>> > .
>>> >> >>> > One thing I can do is, the newlib-cygwin i compiled while
>>> porting ndbm, it generated ndbm library. I can use that.
>>> >> >>>
>>> >> >>> Yes, the library should be 'bundled' with the updated compiler
>>> >> >>> toolchain. You need to be sure you are using this toolchain. Is it
>>> >> >>> what you installed to /home/varodek/development/rtems/5 ?
>>> >> >>>
>>> >> >>> Gedare
>>>
>>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rtems.org/pipermail/devel/attachments/20190701/b7314136/attachment-0002.html>


More information about the devel mailing list