on cygwin target, executable only starts if named lisp.exe

Vibhu Mohindra <[email protected]> Fri, 5 Apr 2024 02:52:39 +0200
Newsgroups gmane.lisp.clisp.devel
Message-ID <GVXP195MB1832EA1030E65ABA77B4B1CACA032@GVXP195MB1832.EURP195.PROD.OUTLOOK.COM>
I observe a particular problem on my builds targetting Cygwin but not on my 
builds targetting Mingw.

----

The problem occurs on:
a 64-bit Windows host building
- in Cygwin 64-bit for Cygwin 64-bit
and
- in Cygwin 32-bit for Cygwin 32-bit
but does not occur:
- in Cygwin 32-bit for Mingw 32-bit
or on a 32-bit Windows host building
- in Cygwin 32-bit for Mingw 32-bit

----

The problem is this. The build produces a (lisp.exe, lispinit.mem) pair in, 
say, build1/ and build1/base/. I'll call these core and base respectively. 
Running core, I can do:
(saveinitmem "test2" :executable t)
and get a test2.exe that starts successfully.
But if I run base and save a memory image in the same fashion, I can't 
start the resulting test2.exe. Trying to start it produces a complaint 
about a missing library lisp.exe.

----

Here are some observations, each described independently of all the others.

1) If I save the image with the name "lisp", or otherwise just rename the 
created image file to lisp.exe, then it starts without crashing.

2)
cd build1/base
mv lisp.exe lisp2.exe
./lisp2.exe -M lispinit.mem
fails to start in the same way.
So apparently, the executable must be called lisp.exe.
[core does not have this problem]

3)
ldd build1/base/lisp.exe
produces a list of dlls. But if I rename lisp.exe to e.g. test2.exe, then
ldd build1/base/test2.exe
produces the same list with one extra item in it: "lisp.exe", which is 
unresolved.
[core does not have this problem and shows a single set of dlls regardless 
of the executable's name, and the set never includes "lisp.exe" or the 
executable's name]

4)
strings build1/base/lisp.exe
reveals three occurrences of "lisp.exe". Using a binary editor to replace 
the third one and its trailing zeroes with a name of my choice and trailing 
zeroes, and then renaming the file to have that same name of choice seems 
to solve the problem. The executable then does start without crashing. This 
third occurrence of "lisp.exe" is embedded in a list of what look like dll 
dependency names.
[core only has the first two occurrences of "lisp.exe"]

----

I'm on latest GitLab head:
66924971790e4cbee3d58f36e530caa0ad568e5f (July 2023)
but I believe the problem exists even on an older tree I have
f1aa42219433f019c05e707220538b3634bc233c (September 2022)

The builds above do not use libsigsegv.

----

If anyone makes observations that contradict mine, I'd love to hear, 
because it means I should start afresh and rationalise my build software 
versions and configuration options. I'm posting this in case it's a real 
bug easily reproducible with whatever Cygwin version and configuration 
flags anyone may use.

Thanks in advance,

Vibhu


_______________________________________________
clisp-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/clisp-devel