libjava build failure on branch for sparc-sun-solaris2.7

Phil Edwards pedwards@disaster.jaj.com
Tue May 22 22:33:00 GMT 2001


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.


More information about the Java mailing list

AltStyle によって変換されたページ (->オリジナル) /