Thread: undefined reference to _sys_nerr
Hello! System is NT4 SP6, cygwin 1.1, gcc 2.95.2, PG7RC2. Having fixed the dllmain problem, I got the following one: The step that assembles postgres.exe fails with the following messages: utils/SUBSYS.o(text+0x42de7):elog.c: undefined reference to '_sys_nerr' utils/SUBSYS.o(text+0x437b3):exc.c: undefined reference to '_sys_nerr' collect2: ld returned 1 exit status make[1]: *** [postgres] Error 1 ... How should one cope with that? Thanks, Juhan Ernits
I have run into the same sequence of problems as Juhan Ernits, and I still do not have a solution. I just tried a few commands that might shed some light on the problem of undefined sys_nerr: bash-2.04$ nm /lib/libc.a | grep errno 00000000 ? __imp__h_errno 00000000 T ___errno 00000000 ? __imp____errno bash-2.04$ nm /lib/libc.a | grep sys_nerr 00000000 ? __imp___sys_nerr We see that the C library does define errno, but not sys_nerr. Searching the other libraries I found that sys_nerr and sys_errlist are both defined in the libraries /usr/lib/libmsvcrt20.a and /usr/lib/libmsvcrt40.a I do not know what these libraries are for, or why sys_errlist is not in libc.a, does anyone have a hint? (Oh, could be that msvcrt stands for Microsoft Visual C Runtime?) If libc does not have sys_errlist, where does strerror() get its data from? Should we rather rely on strerror to check the validity of the argument, and output the alternative string only if strerror returns a null pointer or a pointer to an empty string? Yours Enrique Perez-Terron Juhan Ernits <Juhan@suhkur.cc.ioc.ee> wrote: >Hello! > >System is NT4 SP6, cygwin 1.1, gcc 2.95.2, PG7RC2. >Having fixed the dllmain problem, I got the following one: >The step that assembles postgres.exe fails with the following messages: > >utils/SUBSYS.o(text+0x42de7):elog.c: undefined reference to '_sys_nerr' >utils/SUBSYS.o(text+0x437b3):exc.c: undefined reference to '_sys_nerr' >collect2: ld returned 1 exit status >make[1]: *** [postgres] Error 1 >... > >How should one cope with that? >Thanks, >Juhan Ernits
Enrique Perez Terron writes: > If libc does not have sys_errlist, where does strerror() get its data from? I think the coding in elog.c and exc.c is kind of pointless (other locations happily use strerror indiscriminately) and obviously not portable. It should probably be changed. > Should we rather rely on strerror to check the validity of the argument, > and output the alternative string only if strerror returns a null pointer > or a pointer to an empty string? strerror should always return some error message, even if the argument isn't valid. That's its whole point, versus using sys_errlist[errno] (which is probably not portable either). > Juhan Ernits <Juhan@suhkur.cc.ioc.ee> wrote: > >Hello! > > > >System is NT4 SP6, cygwin 1.1, gcc 2.95.2, PG7RC2. > >Having fixed the dllmain problem, I got the following one: > >The step that assembles postgres.exe fails with the following messages: > > > >utils/SUBSYS.o(text+0x42de7):elog.c: undefined reference to '_sys_nerr' > >utils/SUBSYS.o(text+0x437b3):exc.c: undefined reference to '_sys_nerr' > >collect2: ld returned 1 exit status > >make[1]: *** [postgres] Error 1 > >... -- Peter Eisentraut Sernanders väg 10:115 peter_e@gmx.net 75262 Uppsala http://yi.org/peter-e/ Sweden