This is the mail archive of the cygwin-apps mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Question about clisp version naming


On Tue, 2015-03-17 at 21:09 -0400, Ken Brown wrote:
> On 3/17/2015 8:54 PM, Ken Brown wrote:
> > It didn't occur to me to check the syntax of the def file, although it
> > should have (see below).  The one produced by the build (before I
> > changed the approach) starts like this:
> >
> > EXPORTS
> > IMPORTS
> >      lisp.exe.time_t_from_filetime
> >      lisp.exe.time_t_to_filetime
> >      lisp.exe.fd_read
> >
> > And the gcc command line with error message is:
> >
> > gcc -ggdb -O2 -pipe -Wimplicit-function-declaration -W -Wswitch
> > -Wcomment -Wpointer-arith -Wreturn-type -Wmissing-declarations
> > -Wimplicit -Wno-sign-compare -Wno-format-nonliteral -O
> > -falign-functions=4 -DENABLE_UNICODE -DDYNAMIC_MODULES -DDLL_EXPORT
> > -DPIC -Wl,--stack,0x800000 -Wl,--export-all-symbols modules.o calls.o
> > bogomips.o -lcrypt -luser32 -lole32 -loleaut32 -L/usr/lib/w32api -luuid
> > -lversion gettext.o lisp.a lisp.def libgnu.a /usr/lib/libintl.dll.a
> > /usr/lib/libreadline.dll.a -lncurses /usr/lib/libiconv.dll.a -o lisp.exe
> > /usr/lib/gcc/x86_64-pc-cygwin/4.9.2/../../../../x86_64-pc-cygwin/bin/ld:
> > lisp.def:3: syntax error
> > /usr/lib/gcc/x86_64-pc-cygwin/4.9.2/../../../../x86_64-pc-cygwin/bin/ld:lisp.def:
> > file format not recognized; treating as linker script
> >
> > Having just (!) noticed that this says there's a syntax error in line 3,
> >   I tried deleting line 2.  This resulted in a slew of errors like this:
> >
> > calls.o: In function `error_OS_stream':
> > /home/kbrown/src/cygclisp/clisp-2.49-4.20150312hg15611.x86_64/src/clisp/modules/syscalls/calls.c:183:
> > undefined reference to `__imp_OS_error'
> > /home/kbrown/src/cygclisp/clisp-2.49-4.20150312hg15611.x86_64/src/clisp/modules/syscalls/calls.c:183:(.text+0x11d):
> > relocation truncated to fit: R_X86_64_PC32 against undefined symbol
> > `__imp_OS_error'
> >
> > Next I tried deleting line 1 instead.  This time the linking completed.
> >   But when I ran the resulting executable, I got this:
> >
> > $ ./lisp.exe --version
> > module 'syscalls' requires package OS.
> >
> > That's the same error Achim reported.
> >
> > I'm stumped.  There must be a way around this, but I don't know enough
> > about .def files to know what else to try.
> 
> Maybe this will work after all.  I continued the build process with the 
> modified lisp.def (line 1 removed), and the resulting clisp.exe (which 
> is a wrapper that calls lisp.exe with suitable arguments) seems to work.
> 
> I'll keep playing with this, but if anyone can explain to me what's 
> going on, I'd appreciate it.  I'm not happy just randomly modifying 
> lisp.def without really knowing what I'm doing.

A .def file can be used for two purposes:

1) to specify which symbols to export in a DLL/EXE, in place of
dllexport or -Wl,--export-all-symbols (EXPORTS)

2) to resolve symbols by declaring them in other DLL/EXE(s), in place of
a .dll.a (IMPORTS)

It appears that they were trying to use the same .def file for both
linking lisp.exe (EXPORTS) and the dynmods (IMPORTS), and that is
invalid syntax.  However, according to your paste, lisp.exe is already
linked with -Wl,--export-all-symbols, so lisp.def EXPORTS isn't needed
when linking lisp.exe, only when linking the dynmods.  So removing
EXPORTS and leaving in IMPORTS should work.

--
Yaakov



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]