On Fri, Jun 28, 2019, 6:19 PM Joel Sherrill <j...@rtems.org> wrote: > > > On Fri, Jun 28, 2019, 8:40 AM Vaibhav Gupta <vaibhavgupt...@gmail.com> > wrote: > >> >> >> On Fri, Jun 28, 2019, 5:57 PM Joel Sherrill <j...@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.
> > --joel > >> >>> On Fri, Jun 28, 2019, 8:12 AM Vaibhav Gupta <vaibhavgupt...@gmail.com> >>> wrote: >>> >>>> Hello, >>>> . >>>> Status: >>>> >>>> 1. I have ported ndbm in newlib. When compiled newlib-cygwin, >>>> function symbols were generated. Created patch. >>>> 2. Applied the patch to RSB and rebuild toolchain. Generated ndbm.h >>>> in 5/sparc-rtems5/include directory. >>>> >>>> Blocker: >>>> >>>> 1. I made a raw program which calls dbm_open, dbm_close, dbm_store, >>>> dbm_fetch. >>>> 2. When I run 'make -j 2', in erc32 directory, it shows undefined >>>> reference to those functions. >>>> >>>> https://github.com/VARoDeK/rtems/compare/test_ndbm_presence_02 >>>> . >>>> home/varodek/development/rtems/5/lib/gcc/sparc-rtems5/7.4.1/../../../../sparc-rtems5/bin/ld: >>>> psxinttypes01/psxinttypes01-init.o: in function `Init': >>>> /home/varodek/development/rtems/kernel/rtems/c/src/../../testsuites/psxtests/psxinttypes01/init.c:231: >>>> undefined reference to `dbm_open' >>>> /home/varodek/development/rtems/5/lib/gcc/sparc-rtems5/7.4.1/../../../../sparc-rtems5/bin/ld: >>>> /home/varodek/development/rtems/kernel/rtems/c/src/../../testsuites/psxtests/psxinttypes01/init.c:232: >>>> undefined reference to `dbm_store' >>>> /home/varodek/development/rtems/5/lib/gcc/sparc-rtems5/7.4.1/../../../../sparc-rtems5/bin/ld: >>>> /home/varodek/development/rtems/kernel/rtems/c/src/../../testsuites/psxtests/psxinttypes01/init.c:236: >>>> undefined reference to `dbm_fetch' >>>> /home/varodek/development/rtems/5/lib/gcc/sparc-rtems5/7.4.1/../../../../sparc-rtems5/bin/ld: >>>> /home/varodek/development/rtems/kernel/rtems/c/src/../../testsuites/psxtests/psxinttypes01/init.c:239: >>>> undefined reference to `dbm_close' >>>> collect2: error: ld returned 1 exit status >>>> make[5]: *** [Makefile:7679: psxinttypes01.exe] Error 1 >>>> make[5]: Leaving directory >>>> '/home/varodek/development/rtems/kernel/erc32/sparc-rtems5/c/erc32/testsuites/psxtests' >>>> make[4]: *** [Makefile:663: psxtests] Error 2 >>>> make[4]: *** Waiting for unfinished jobs.... >>>> . >>>> . >>>> . >>>> Maybe I have compiled it incorrectly, please verify. >>>> >>>> 1. ndbm port: https://github.com/VARoDeK/newlib/compare/port_ndbm >>>> 2. RSB patch: >>>> https://github.com/VARoDeK/rsb/compare/newlib_ndbm_rsb_patch_01 >>>> >>>> Vaibhav Gupta >>>> >>>
_______________________________________________ devel mailing list devel@rtems.org http://lists.rtems.org/mailman/listinfo/devel