swanson@UXE.CSO.UIUC.EDU (Amy Swanson) (10/20/89)
I am attempting to compile "notes" on our SGIs (both 4D/20s and 4D/240s) but have run into a snag. Since we run Yellow Pages on all our systems, I need to compile with the sun and bsd include files as well as link with the sun and bsd libraries. The include files are no big deal; I can alter the Makefile to use these. It's the linking that's creating BIG problems with me. According to SGI docs, (from intro(3)) using a command like this: cc -I/usr/include/sun -I/usr/include/bsd prog.c -lsun -lbsd will tell the system to use the YP routines such as "getpwent" which under- stands the "+" in the password entries. But, how do I get the "-l" options attached to the cc lines? The Makefile that comes with notes uses the internal rules for compiling the source code, creating the object files, and then links the objects with flags provided in the Makefile. So, as I under- stand it, I would need to alter the internal rules for Make to get the code compiled for use with YP. Now, to complicate matters, I have actually manually compiled all the source with the above syntax, and it still sees me as "Anonymous" unless I place myself in /etc/passwd as a local entry (w/o the +). That leaves the "install" command as the culprit... Someone else is attempting to create an "installit" program to allow users to install their own software in designated directories; this program uses "install" and is bombing out on the YP entries. The only way we can see to fix this is to get the source to "install" and recompile it using the Yellow Pages stuff (sun and bsd include files and libraries). So, two questions: 1) Does anyone have/know of a work-around for this? 2) Why wasn't the source code on the SGIs complied to use the sun and bsd libraries automatically? If you don't run YP, then the default is to use the normal stuff anyway, so everyone would have been happy! *sigh* Amy Swanson SGI/Alliant Systems Administrator NCSA - National Center for Supercomputing Applications University of Illinois at Champaign-Urbana email: amys@ncsa.uiuc.edu
brendan@illyria.wpd.sgi.com (Brendan Eich) (10/21/89)
> But, how do I get the "-l" options > attached to the cc lines? The Makefile that comes with notes uses the > internal rules for compiling the source code, creating the object files, and > then links the objects with flags provided in the Makefile. So, as I under- > stand it, I would need to alter the internal rules for Make to get the code > compiled for use with YP. The -l option should be used when compiling a .c into an executable, and when linking one or more .o's into a single executable. I don't know the particulars of the notes makefile, but it could use an inference (internal) make rule only to do the former (the .c: inference rule -- you can see it via make -n -p). The way to get those -l's through is to set LDFLAGS to include -lsun -lbsd in the makefile. If the makefile links one or more .o files into a program, it must be using an explicit rule, and should list $(LDFLAGS) among the arguments to $(CC), *after* the objects. > Now, to complicate matters, I have actually manually compiled all the > source with the above syntax, and it still sees me as "Anonymous" unless I > place myself in /etc/passwd as a local entry (w/o the +). That leaves the > "install" command as the culprit... If you were using -l when compiling .c's into .o's, no linking would be done (nor would you get a usage error). Could this be the mistake? The libsun code will query YP. Almost all SGI commands that use getpwent(3C) routines link with it. > Someone else is attempting to create an "installit" program to allow > users to install their own software in designated directories; this program > uses "install" and is bombing out on the YP entries. The only way we can see > to fix this is to get the source to "install" and recompile it using the > Yellow Pages stuff (sun and bsd include files and libraries). /etc/install (documented in install(1)) does use YP. If this is the install program you're describing, perhaps the YP client on which you're running it is not bound to a YP server. Since 4D1-3.1, SGI's libsun YP-passwd code will use /etc/passwd and treat + as a username character if ypbind has not bound your domain. Try ypwhich(1) to see if you're bound. > 2) Why wasn't the source code on the SGIs complied to use the sun and > bsd libraries automatically? If you don't run YP, then the > default is to use the normal stuff anyway, so everyone would have > been happy! Everything except passwd(1), netstat(1), and a few other hard cases, *is* linked with libsun. Some people complain that linking with YP leaves them at hanging when YP servers are unavailable. We've tried to take the sting out of YP by falling back on the local /etc files when service is lost. > Amy Swanson Regards, Brendan Eich Silicon Graphics, Inc. brendan@sgi.com