[Ecls-list] Build-shared-library gives multiple definitions error
Daniel Dickison
danieldickison at cmu.edu
Mon Aug 7 12:08:54 UTC 2006
I'm running ECL on Mac OS X 10.4.7 and having trouble with the
c:build-shared-library command. Specifically, the linker (ld) fails
because it encounters multiple definitions of the _init_* routine.
I tested it with a simple hello world program, and it seems the
object file resulting from compile-file and the intermediate file
that c:build-shared-library create both contains the symbol
_init_ECL_HELLO. I'm doing (compile-file "ecl-hello" :system-p t)
first, then (c:build-shared-library "libecl-hello.dylib" :lisp-files
'("ecl-hello")) --- am I doing this incorrectly? Otherwise, how
might I fix this problem? Thanks in advance for any input.
Here are the details. I have a file, ecl-hello.lisp, with the
following:
(defun hello ()
(print "Hello world!"))
Then, I run ecl in the file's directory and compile the file to a .o
file:
> (compile-file "ecl-hello" :system-p t)
;;; ...
;;; Note: Invoking external command:
;;; gcc -g -O2 -fPIC -fno-common -fstrict-aliasing -Ddarwin -O "-I/
usr/local/lib/ecl/" -w -c "/Users/ddickiso/src/X-Plane/X-Plane-Lisp/
ECL-test/ecl-hello.c" -o "/Users/ddickiso/src/X-Plane/X-Plane-Lisp/
ECL-test/ecl-hello.o"
;;; OPTIMIZE levels: Safety=2, Space=0, Speed=3
;;; Finished compiling ecl-hello.
#P"/Users/ddickiso/src/X-Plane/X-Plane-Lisp/ECL-test/ecl-hello.o"
NIL
NIL
So far so good. Then, I get the error when I do:
> (c:build-shared-library #P"libecl-hello.dylib" :lisp-files '("ecl-
hello"))
;;; Note: Invoking external command:
;;; gcc -g -O2 -fPIC -fno-common -fstrict-aliasing -Ddarwin -O "-I/
usr/local/lib/ecl/" -w -c "/Users/ddickiso/src/X-Plane/X-Plane-Lisp/
ECL-test/ECLINITIE09lp.c" -o "/Users/ddickiso/src/X-Plane/X-Plane-
Lisp/ECL-test/ECLINITIE09lp.o"
;;; Note: Invoking external command:
;;; gcc -o "/Users/ddickiso/src/X-Plane/X-Plane-Lisp/ECL-test/libecl-
hello.dylib" -L"/usr/local/lib/ecl/" "/Users/ddickiso/src/X-Plane/X-
Plane-Lisp/ECL-test/ECLINITIE09lp.o" "/Users/ddickiso/src/X-Plane/X-
Plane-Lisp/ECL-test/ecl-hello.o" -dynamiclib -flat_namespace -
undefined suppress -lecl -lm
ld: multiple definitions of symbol _init_ECL_HELLO
/Users/ddickiso/src/X-Plane/X-Plane-Lisp/ECL-test/ECLINITIE09lp.o
definition of _init_ECL_HELLO in section (__TEXT,__text)
/Users/ddickiso/src/X-Plane/X-Plane-Lisp/ECL-test/ecl-hello.o
definition of _init_ECL_HELLO in section (__TEXT,__text)
/usr/bin/libtool: internal link edit command failed
(SYSTEM "gcc -o \"/Users/ddickiso/src/X-Plane/X-Plane-Lisp/ECL-test/
libecl-hello.dylib\" -L\"/usr/local/lib/ecl/\" \"/Users/ddickiso/src/
X-Plane/X-Plane-Lisp/ECL-test/ECLINITIE09lp.o\" \"/Users/ddickiso/src/
X-Plane/X-Plane-Lisp/ECL-test/ecl-hello.o\" -dynamiclib -
flat_namespace -undefined suppress -lecl -lm ") returned non-
zero value 1
Broken at C::SHARED-CC.
>> :pop
More information about the ecl-devel
mailing list