This is the mail archive of the
java@gcc.gnu.org
mailing list for the Java project.
Re: libjava build failure on branch for sparc-sun-solaris2.7
- To: Jeff Sturm <jsturm at one-point dot com>
- Subject: Re: libjava build failure on branch for sparc-sun-solaris2.7
- From: Phil Edwards <pedwards at disaster dot jaj dot com>
- Date: Wed, 23 May 2001 00:15:56 -0400
- Cc: Joe Buck <jbuck at synopsys dot COM>, gcc at gcc dot gnu dot org, java at gcc dot gnu dot org
- References: <200105222225.PAA16403@toledo.synopsys.com> <3B0AF3AF.3931922@one-point.com>
On Wed, May 23, 2001 at 12:18:07AM +0100, Jeff Sturm wrote:
> Joe Buck wrote:
> > Undefined first referenced
> > symbol in file
> > java::net::PlainSocketImpl::bind(java::net::InetAddress*, int)./.libs/libgcj.so
>
> I saw this too. It turns out that Solaris <sys/socket.h> does:
>
> #define bind __xnet_bind
>
> however only when _XOPEN_SOURCE is defined. That changed with this
> patch:
>
> 2001-05-15 Mark Mitchell <mark@codesourcery.com>
> * config/sparc/sol2.h (CPLUSPLUS_CPP_SPEC): Define.
>
> I tried undef'ing bind etc. in my libjava tree. Although that worked
> for my build, it feels like a dirty hack to me.
>
> What's the right way to keep the preprocessor from interfering with java
> names?
Strictly speaking, fixincl, I think.
Alternatively, provide the symbol that Solaris is looking for. There are
two implementations of bind(3) available. From a Solaris man page:
# (3SOCKET)
# These functions constitute the sockets library, lib-
# socket. This library is implemented as a shared
# object, libsocket.so, and as an archive, libsocket.a,
# but is not automatically linked by the C compilation
# system. Specify -lsocket on the cc command line to
# link with this library. See libsocket(3LIB).
#
# (3XNET)
# These functions constitute X/Open networking inter-
# faces which comply with the X/Open CAE Specification,
# Networking Services, Issue 4 (September, 1994). This
# library is implemented as a shared object, libxnet.so,
# but is not automatically linked by the C compilation
# system. Specify -lxnet on the cc command line to link
# with this library. See libxnet(3LIB) and standards(5)
# for compilation information.
The native sockets library also requires the NSL library. So you have your
choice of '-lxnet' or '-lsocket -lnsl'. The (more standardly-conforming)
_XOPEN_SOURCE indicates the first should be used.
The first library also has a slightly different socket() declaration;
the third parameter is of type socklen_t rather than int.
Phil
--
pedwards at disaster dot jaj dot com | pme at sources dot redhat dot com
devphil at several other less interesting addresses in various dot domains
The gods do not protect fools. Fools are protected by more capable fools.