schaf@socrates.ucsf.edu (Chris Schafmeister%Kollman) (06/27/91)
I am working on a program that uses X11R4 on the RS6000 and I want to distribute the program to other RS6000s without having to move the X11R4 libraries with it. When I tried to link with '-bnoautoimp' the linker had a fit telling me that it could not link standard library routines like 'open', 'close' etc. Thanks in advance. .Chris. (schaf@cgl.ucsf.edu)
lwvanels@athena.mit.edu (Lucien W. Van Elsen) (06/27/91)
In article <schaf.677960266@socrates.ucsf.edu>, schaf@socrates.ucsf.edu (Chris Schafmeister%Kollman) writes: |> I am working on a program that uses X11R4 on the RS6000 |> and I want to distribute the program to other RS6000s without |> having to move the X11R4 libraries with it. When |> I tried to link with '-bnoautoimp' the linker had a fit |> telling me that it could not link standard library routines like |> 'open', 'close' etc. |> |> Thanks in advance. Note- this information is from experimentation; I havn't found a definitive reference on any of this yet (although I would very much appreciate hearing from anyone who has!) In order to link a shared library statically, you need to give an explicit path -L to the library, and provide whatever imports the library needs to resolve. For example, to link 'foo.o' with a non-shared version of the C library, you'd use: cc -o foo -bnso foo.o -bimport:/lib/syscalls.exp -L/lib -lc It is also possible to re-link an executable to use static libraries instead of shared. You need to again explicitly specify any imports the library expects to find, as well as an explicit -L path to the library. For example: godtree /tmp) cat > foo.c main() { printf("Hello, world.\n"); } splat /tmp) cc -o foo foo.c splat /tmp) ls -l foo -rwxr-xr-x 1 lwvanels usr 3158 May 23 13:30 foo* splat /tmp) cc -o foo.new -bnso -bimport:/lib/syscalls.exp foo -L/lib splat /tmp) ls -l foo.new -rwxr-xr-x 1 lwvanels usr 223147 May 23 13:31 foo.new* splat /tmp) ./foo Hello, world. -- Lucien Van Elsen MIT Athena Systems Development
jaime@excalibur.austin.ibm.com (06/27/91)
> From: schaf@socrates.ucsf.edu (Chris Schafmeister%Kollman) > Subject: Shared libraries > > I am working on a program that uses X11R4 on the RS6000 > and I want to distribute the program to other RS6000s without > having to move the X11R4 libraries with it. When > I tried to link with '-bnoautoimp' the linker had a fit > telling me that it could not link standard library routines like > 'open', 'close' etc. > > Thanks in advance. > > .Chris. (schaf@cgl.ucsf.edu) -bI:/lib/syscalls.exp This allows the linker to get the system calls out of the kernel resolved. Jaime Vazquez AIX Technical Support IBM AWD-Austin/2830 6000: jaime@excalibur.austin.ibm.com InterNet: jaime@austin.vnet.ibm.com or jaime%austin@vnet.ibm.com -------------------------------------------------------------------- <Standard disclaimers apply.>
prener@watson.ibm.com (Dan Prener) (06/28/91)
In article <schaf.677960266@socrates.ucsf.edu>, schaf@socrates.ucsf.edu (Chris Schafmeister%Kollman) writes: |> I am working on a program that uses X11R4 on the RS6000 |> and I want to distribute the program to other RS6000s without |> having to move the X11R4 libraries with it. When |> I tried to link with '-bnoautoimp' the linker had a fit |> telling me that it could not link standard library routines like |> 'open', 'close' etc. When you don't use the libraries, in particular libc, in shared mode you have lost the imported symbols which came with them. Add the option -bimport:/lib/syscalls.exp -- Dan Prener (prener @ watson.ibm.com)