thanks for your analysis and attempts
I should have clarified for you to snarf the command lines from make.out
its almost never a good idea to fool with a Mamfile directly
its a bootstrap aid until nmake is built
what we're seeing here is a disconnect between the precomputed
mamake/Mamfile and the real-time nmake/Makefile
the Mamfile is generated (by nmake) on one machine for all machine types
there's a lot of hackery in that process, but in this case not enough
to get -lsocket down to the iffe command line (the Mamfile generation
machine is linux which doesn't have -lsocket)
the Makefile ands up getting -lsocket on the link line because of
the dontcare reference to -lsocket (use if there, don't care if not there)
all this means that the iffe file is insufficient for a bootstrap (no nmake)
build
add this line as the first line in features/poll
ref -lsocket -lnsl
this checks for -lsocket and -lnsl and adds them to all subsequent tests
among other things this should get _lib_socket defined on your machine
you also noted that the #if logic when _lib_socket is not defined is flawed in
sh/io.c
fix this by adding
#undef SHOPT_COSHELL
after
#undef O_SERVICE
this code should not get hit on modern unix
if it does its most likely a flaw in the iffe/#if logic
two good catches
thanks
On Thu, 16 Jun 2011 00:26:08 -0400 Ron Isaacson wrote:
> Thanks, I'm having trouble getting to the bottom of this though... I
> followed your explanation to figure out why _sys_socket is unset. Now
> given this line (src/cmd/ksh93/Mamfile:576):
> exec - iffe -v -c '${CC} ${mam_cc_FLAGS} ${CCFLAGS} ${LDFLAGS} ' ref
> ${mam_cc_L+-L.} ${mam_cc_L+-L${INSTALLROOT}/lib} -I${PACKAGE_ast_INCLUDE}
> -I${INSTALLROOT}/include ${mam_libdll} ${mam_libcoshell} ${mam_libcmd}
> ${mam_libast} ${mam_libm} ${mam_libnsl} : run features/poll
> Which of these variables would you expect -lsocket to be in? I tried
> adding ${mam_libsocket} in addition to ${mam_libnsl} but it didn't do
> anything. Oddly, -lsocket IS added to the final step that links the
> ksh binary, and once you get past <sys/socket.h> not getting included,
> everything works just fine. The 'cc -o ksh' picks up (among other
> things):
> -lm -lsocket -lnsl -lsecdb -lnsl
> but iffe comes up short, as you saw from the log. I imagine that
> whatever's putting -lsocket into the final link command is confusing
> mamake into thinking it's unnecessary at other times.
> As for nmake... I only had INIT and ast-ksh, but I tried adding
> ast-base to get nmake. With this, it does indeed complete successfully
> the first time through, with no help. Interestingly, under nmake, it
> uses the static /usr/lib/libsocket.a rather than -lsocket.
> I looked back at my build logs from 93t+ and earlier, and it's always
> been this way: -lsocket gets stuffed in at the end, and _lib_socket is
> 'no' from features/poll. It never mattered though, because io.c didn't
> do any socket stuff outside of the big conditional:
> #if defined(_lib_socket) && defined(_sys_socket) && defined(_hdr_netinet_in)
> In 93u however, the coshell support does sockety stuff, even if that
> entire block is skipped and the pre-requisites for socket support are
> not in place. I think that's probably a bug in and of itself.
_______________________________________________
ast-users mailing list
[email protected]
https://mailman.research.att.com/mailman/listinfo/ast-users