[Expat-discuss] Don't want wrapper scripts.
Greg Martin
Greg.Martin at TELUS.COM
Tue Apr 26 17:24:29 CEST 2005
I haven't been following this thread but it looks to me like you're linking to shared libraries. Try linking to libs with a .a delimiter instead of .so. gcc has a -static switch for the linker. If you are going to use shared libraries they will have to be in the library path. You appear to be on a
UNIX like system. Try man ld and man gcc for more info.
> -----Original Message-----
> From: expat-discuss-bounces at libexpat.org
> [mailto:expat-discuss-bounces at libexpat.org] On Behalf Of Andrew Hardy
> Sent: Tuesday, April 26, 2005 7:59 AM
> To: expat-discuss at libexpat.org
> Subject: [Expat-discuss] Don't want wrapper scripts.
>
> I just want to compile my programs that link in the expat library.
>
> Why can't I do this!
>
> Why do I have to use libtools and have the wrapper scripts
> and my executables placed in .libs?
>
> I have a line in the make that makes my object file, then
> links this with the library, and I get no compilation or
> linking errors, but I cannpot seem to run the executable cos
> it cannot find libexpat.so.0, so I have added this file to
> the linking line in the make file and I get the following at
> the command line when I make, but I still cannot run the executable!
>
> How do I just create the executable so it has everything it
> needs to run and nothing else?
>
> gcc -g -O2 -Wall -Wmissing-prototypes -Wstrict-prototypes
> -fexceptions -DHAVE_EXPAT_CONFIG_H -I../expat/lib -I. -o
> myprog.o -c myprog.c gcc -g -O2 -Wall -Wmissing-prototypes
> -Wstrict-prototypes -fexceptions -DHAVE_EXPAT_CONFIG_H
> -I../expat/lib -I. -o myprog myprog.o
> ../expat/lib/libexpat.so.0.5.0 -L../expat/lib -lexpat
> ld: warning: file ../expat/lib/libexpat.so: linked to
> ../expat/lib/libexpat.so.0.5.0: attempted multiple inclusion of file
>
> host> myprog
> ld.so.1: myprog: fatal: libexpat.so.0: open failed: No such
> file or directory Killed
> host>
>
> Can some-body help me?
>
> Andrew H.
>
>
>
>
>
> ----- Forwarded by Andrew Hardy/MAIN/MC1 on 26/04/2005 14:51 -----
> |---------+---------------------------------->
> | | "Andrew Hardy" |
> | | <Andrew.Hardy at marconi.c|
> | | om> |
> | | Sent by: |
> | | expat-discuss-bounces at l|
> | | ibexpat.org |
> | | |
> | | |
> | | 26/04/2005 14:07 |
> | | |
> |---------+---------------------------------->
>
> >-------------------------------------------------------------
> --------------------------------------------------------------
> -----------------------|
> |
>
> |
> | To: expat-discuss at libexpat.org
>
> |
> | cc:
>
> |
> | Subject: Re: [Expat-discuss] Don't want wrapper
> scripts.
> |
>
> >-------------------------------------------------------------
> --------------------------------------------------------------
> -----------------------|
>
>
>
>
>
> ----- Forwarded by Andrew Hardy/MAIN/MC1 on 26/04/2005 14:07 -----
> |---------+---------------------------->
> | | Andrew Hardy |
> | | |
> | | 26/04/2005 14:04 |
> | | |
> |---------+---------------------------->
>
> >-------------------------------------------------------------
> --------------------------------------------------------------
> -----------------------|
>
> |
> |
> | To: "Carlos Atabales" <catabales at hotmail.com>@MCEXT
> |
> | cc:
> |
> | Subject: Re: [Expat-discuss] Don't want wrapper
> scripts.(Document
> link: Andrew Hardy)
> |
>
> >-------------------------------------------------------------
> --------------------------------------------------------------
> -----------------------|
>
>
>
>
> I have tried what you have said.
>
> It's a little bit different because the code I am compiling
> and linking is not locaed where outline is and your code
> snippet would not work.
>
> At the command line I see this happening:
>
> gcc -g -O2 -Wall -Wmissing-prototypes -Wstrict-prototypes
> -fexceptions -DHAVE_EXPAT_CONFIG_H -I../expat/lib -I. -o
> myprog.o -c myprog.c gcc -g -O2 -Wall -Wmissing-prototypes
> -Wstrict-prototypes -fexceptions -DHAVE_EXPAT_CONFIG_H
> -I../expat/lib -I. -o myprog myprog.o -L../expat/lib -lexpat
>
> But when I run the executable, I get this
>
> host> myprog
> ld.so.1: myprog: fatal: libexpat.so.0: open failed: No such
> file or directory Killed
> host>
>
> Can you advise.
>
> Thanks,
>
> Andrew.
>
>
>
>
>
> |---------+---------------------------------->
> | | "Carlos Atabales" |
> | | <catabales at hotmail.com>|| |
> Sent
> by: |
> | | expat-discuss-bounces at l|
> | | ibexpat.org |
> | | |
> | | |
> | | 21/04/2005 23:08 |
> | | |
> |---------+---------------------------------->
>
> >-------------------------------------------------------------
> --------------------------------------------------------------
> -----------------------|
>
> |
> |
> | To: expat-discuss at libexpat.org
> |
> | cc:
> |
> | Subject: [Expat-discuss] Don't want wrapper scripts.
> |
>
> >-------------------------------------------------------------
> --------------------------------------------------------------
> -----------------------|
>
>
>
>
>
> default makefile write wrapper scripts, not binaries programs.
> this are the firsts line in a program.
> # The outline program cannot be directly executed until all
> the libtool # libraries that it depends on are installed.
> #
> # This wrapper script should never be moved out of the build
> directory.
> # If it is, it will not operate correctly.
> it's the solution a yuor problems....
>
> CC=cc
> FLAGS= -L../lib -I../lib
> LIBS= -lexpat
> outline: outline.c
> $(CC) $(FLAGS) -o outline outline.c $(LIBS)
>
> clean:
> rm outline outline.o
> ------------
>
> this is examples in directory /home/catabales/expat-1.95.8/examples
>
> [catabales at desarrollo examples]$ file outline
> outline: Bourne shell script text executable
>
> [catabales at desarrollo examples]$ more outline #! /bin/sh
>
> # outline - temporary wrapper script for .libs/outline #
> Generated by ltmain.sh - GNU libtool 1.4.2 (1.922.2.53 2001/09/11
> 03:18:52)
> #
> # The outline program cannot be directly executed until all
> the libtool # libraries that it depends on are installed.
> #
> # This wrapper script should never be moved out of the build
> directory.
> # If it is, it will not operate correctly.
>
> # Sed substitution that helps us do robust quoting. It
> backslashifies # metacharacters that are still active within
> double-quoted strings.
> Xsed='sed -e 1s/^X//'
> sed_quote_subst='s/\([\\`\\"$\\\\]\)/\\\1/g'
> .......etc
>
> ------------------------------------
>
> I compile and install the library in one location and I
> compile and link my programs in another.
>
> I had problems at first, but now I know that my programs are
> correctly compiling and linking in the library, because I
> copy the binaries to an independant location and they run and
> work fine as expected.
>
> However, Where I make my programs I still get the wrapper
> scripts in ./ and the binaries in ./.lib
>
> Here is a snippet of my makefile, but be aware there is more
> to make it work right, I just think the change I may be able
> to make is probably some-where in here.
>
> SHELL = /bin/bash
> srcdir = ../expat
> top_builddir = ../expat
> LIBRARY = $(srcdir)/libexpat.la
> LIBTOOL = $(SHELL) $(top_builddir)/libtool INCLUDES =
> -I$(srcdir)/lib -I.
> CFLAGS = -g -O2 -Wall -Wmissing-prototypes
> -Wstrict-prototypes -fexceptions -DHAVE_EXPAT_CONFIG_H
> LTFLAGS = --silent COMPILE = gcc $(CFLAGS) $(DEFS)
> $(INCLUDES) LINK_EXE = $(LIBTOOL) $(LTFLAGS) --mode=link
> $(COMPILE) -o $@
>
> etc...
>
> Can any-one tell me how I might just generate the target
> binaries into ./ and not the wrapper scripts.
>
> Many thanks in anticipation,
>
> Andrew.
>
> _________________________________________________________________
> MSN Amor: busca tu ½ naranja http://latam.msn.com/amor/
>
> _______________________________________________
> Expat-discuss mailing list
> Expat-discuss at libexpat.org
> http://mail.libexpat.org/mailman/listinfo/expat-discuss
>
>
>
>
>
>
> _______________________________________________
> Expat-discuss mailing list
> Expat-discuss at libexpat.org
> http://mail.libexpat.org/mailman/listinfo/expat-discuss
>
>
>
>
> _______________________________________________
> Expat-discuss mailing list
> Expat-discuss at libexpat.org
> http://mail.libexpat.org/mailman/listinfo/expat-discuss
>
More information about the Expat-discuss
mailing list