When I compile Wine on FreeBSD and Solaris I keep getting 'undefined sybol' errors for all the C library symbols. So I usually add the following to 'configure.ac'.
Index: configure.ac =================================================================== RCS file: /home/wine/wine/configure.ac,v retrieving revision 1.14 diff -u -r1.14 configure.ac --- configure.ac 31 Mar 2002 19:23:41 -0000 1.14 +++ configure.ac 31 Mar 2002 20:45:37 -0000 @@ -77,6 +77,8 @@
dnl **** Check for some libraries ****
+dnl Check for -lc for FreeBSD and Solaris +AC_CHECK_LIB(c,getpid) dnl Check for -lm AC_CHECK_LIB(m,sqrt) dnl Check for -li386 for NetBSD and OpenBSD
But is it the right eay to do things? What worries me is that I found some messages related to libtool that claim that -lc should not be explicitly linked in on FreeBSD (and OpenBSD): http://mail.gnu.org/pipermail/libtool/2001-November/005782.html
But maybe things are different if you use -symbolic.
On Sun, Mar 31, 2002 at 07:47:18PM -0800, Francois Gouget wrote:
When I compile Wine on FreeBSD and Solaris I keep getting 'undefined sybol' errors for all the C library symbols. So I usually add the following to 'configure.ac'.
Index: configure.ac
RCS file: /home/wine/wine/configure.ac,v retrieving revision 1.14 diff -u -r1.14 configure.ac --- configure.ac 31 Mar 2002 19:23:41 -0000 1.14 +++ configure.ac 31 Mar 2002 20:45:37 -0000 @@ -77,6 +77,8 @@
dnl **** Check for some libraries ****
+dnl Check for -lc for FreeBSD and Solaris +AC_CHECK_LIB(c,getpid) dnl Check for -lm AC_CHECK_LIB(m,sqrt) dnl Check for -li386 for NetBSD and OpenBSD
But is it the right eay to do things? What worries me is that I found some messages related to libtool that claim that -lc should not be explicitly linked in on FreeBSD (and OpenBSD): http://mail.gnu.org/pipermail/libtool/2001-November/005782.html
It should not be linked on Linux.
Hmm, what about something like:
AC_CHECK_FUNC(getpid,,AC_CHECK_LIB(c,getpid))
or similar?
Ciao, Marcus
Marcus Meissner wrote: [...]
It should not be linked on Linux.
I found an application that will crash if I link it in on FreeBSD. So it does seem that it should not be linked in even on FreeBSD (or maybe the crash has to do with the order in which it is linked in). Confirmed... it is a link order problem for that one.
Hmm, what about something like:
AC_CHECK_FUNC(getpid,,AC_CHECK_LIB(c,getpid))
or similar?
Unfortunately this does not work. I get: checking for getpid... yes checking for sqrt in -lm... yes
The problem is that it appears you don't need to specify it if you don't use -Bsymbolic but you need to link it in if you use it:
This works:
$ gcc -shared advapi32.spec.o advapi.o crypt.o eventlog.o registry.o security.o service.o -o advapi32.dll.so -L../../dlls -L../../library -lwine -lm $ echo $? 0
but this doesn't:
$ gcc -shared -Wl,-Bsymbolic advapi32.spec.o advapi.o crypt.o eventlog.o registry.o security.o service.o -o advapi32.dll.so -L../../dlls -L../../library -lwine -lm advapi.o: In function `GetUserNameA': /mnt/home/fgouget/wine/wine.ref/freebsd/dlls/advapi32/../../../src/dlls/advapi32/advapi.c(.text+0x16): undefined reference to `getuid' /mnt/home/fgouget/wine/wine.ref/freebsd/dlls/advapi32/../../../src/dlls/advapi32/advapi.c(.text+0x1c): undefined reference to `getpwuid' /mnt/home/fgouget/wine/wine.ref/freebsd/dlls/advapi32/../../../src/dlls/advapi32/advapi.c(.text+0x3a): undefined reference to `strerror' ... $ echo $? 0
Hmm, $?==0 but it still really bothers me to have all these undefined reference messages. And if I add -lc everything is fine again:
$ gcc -shared -Wl,-Bsymbolic advapi32.spec.o advapi.o crypt.o eventlog.o registry.o security.o service.o -o advapi32.dll.so -L../../dlls -L../../library -lwine -lm -lc $ echo $? 0
Also, I could not get ldd to work on advapi32.dll.so for any of the above files. $ ldd advapi32.dll.so advapi32.dll.so: ldd: advapi32.dll.so: Exec format error advapi32.dll.so: exit status 1
What's wrong???