<div dir="auto"><div><br><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Fri, Jun 28, 2019, 6:19 PM Joel Sherrill <<a href="mailto:joel@rtems.org">joel@rtems.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="auto"><div><br><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Fri, Jun 28, 2019, 8:40 AM Vaibhav Gupta <<a href="mailto:vaibhavgupta40@gmail.com" target="_blank" rel="noreferrer">vaibhavgupta40@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="auto"><div><br><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Fri, Jun 28, 2019, 5:57 PM Joel Sherrill <<a href="mailto:joel@rtems.org" rel="noreferrer noreferrer" target="_blank">joel@rtems.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="auto">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.<div dir="auto"><br></div><div dir="auto">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.</div><div dir="auto"><br></div><div dir="auto">--joel</div></div></blockquote></div></div><div dir="auto">Okay, I will try this!</div></div></blockquote></div></div><div dir="auto"><br></div><div dir="auto">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.</div><div dir="auto"><br></div><div dir="auto"><a href="https://www.cs.swarthmore.edu/~newhall/unixhelp/howto_C_libraries.html" target="_blank" rel="noreferrer">https://www.cs.swarthmore.edu/~newhall/unixhelp/howto_C_libraries.html</a><br></div><div dir="auto"><br></div><div dir="auto">Guys.. this comes up periodically, even though this is really basic tool usage to me, is this something we should provide some guidance on?</div></div></blockquote></div></div><div dir="auto">Actually, i tried this before, but I cannot find libndbm in my development directory. I guess it is not generated.</div><div dir="auto">.</div><div dir="auto">One thing I can do is, the newlib-cygwin i compiled while porting ndbm, it generated ndbm library. I can use that.</div><div dir="auto"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="auto"><div dir="auto"><br></div><div dir="auto">--joel</div><div dir="auto"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="auto"><div dir="auto"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Fri, Jun 28, 2019, 8:12 AM Vaibhav Gupta <<a href="mailto:vaibhavgupta40@gmail.com" rel="noreferrer noreferrer noreferrer" target="_blank">vaibhavgupta40@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div>Hello,</div><div>.<br></div><div>Status:<br></div><div><ol><li>I have ported ndbm in newlib. When compiled newlib-cygwin, function symbols were generated. Created patch.</li><li>Applied the patch to RSB and rebuild toolchain. Generated ndbm.h in 5/sparc-rtems5/include directory.</li></ol><div>Blocker:</div><div><ol><li>I made a raw program which calls dbm_open, dbm_close, dbm_store, dbm_fetch.</li><li>When  I run 'make -j 2', in erc32 directory, it shows undefined reference to those functions.</li></ol><div><a href="https://github.com/VARoDeK/rtems/compare/test_ndbm_presence_02" rel="noreferrer noreferrer noreferrer noreferrer" target="_blank">https://github.com/VARoDeK/rtems/compare/test_ndbm_presence_02</a></div><div>.</div><div>home/varodek/development/rtems/5/lib/gcc/sparc-rtems5/7.4.1/../../../../sparc-rtems5/bin/ld: psxinttypes01/psxinttypes01-init.o: in function `Init':<br>/home/varodek/development/rtems/kernel/rtems/c/src/../../testsuites/psxtests/psxinttypes01/init.c:231: undefined reference to `dbm_open'<br>/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'<br>/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'<br>/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'<br>collect2: error: ld returned 1 exit status<br>make[5]: *** [Makefile:7679: psxinttypes01.exe] Error 1<br>make[5]: Leaving directory '/home/varodek/development/rtems/kernel/erc32/sparc-rtems5/c/erc32/testsuites/psxtests'<br>make[4]: *** [Makefile:663: psxtests] Error 2<br>make[4]: *** Waiting for unfinished jobs....<br></div><div>.</div><div>.<br></div><div>.</div><div>Maybe I have compiled it incorrectly, please verify.</div><div><ol><li>ndbm port: <a href="https://github.com/VARoDeK/newlib/compare/port_ndbm" rel="noreferrer noreferrer noreferrer noreferrer" target="_blank">https://github.com/VARoDeK/newlib/compare/port_ndbm</a></li><li>RSB patch: <a href="https://github.com/VARoDeK/rsb/compare/newlib_ndbm_rsb_patch_01" rel="noreferrer noreferrer noreferrer noreferrer" target="_blank">https://github.com/VARoDeK/rsb/compare/newlib_ndbm_rsb_patch_01</a></li></ol><div>Vaibhav Gupta<br></div></div></div></div></div>
</blockquote></div>
</blockquote></div></div></div>
</blockquote></div></div></div>
</blockquote></div></div></div>