Summary
Static egg linkling seems to be broken
Metadata
- Id: 680745064c094819d68e279f59d7c013290f0122
- Trac id: 1433
- Type: defect
- Reporter: felix
- Owner:
- Cc: sjamaan
- Status: closed
- Component: core libraries
- Estimated difficulty: medium
- Resolution: worksforme
- Priority: critical
- Milestone: 5.0
- Version: 5.0.0
- Changetime: 2017-12-29 20:52:24 UTC
- Created: 2017-12-26 17:32:40 UTC
- Keywords:
Description
Compiling this with `srfi-1` egg installed attempts to load a shared library and fails
(import srfi-1)
With `csc -static x.scm -kv -debug 2:
'/home/felix/chicken/chicken-5-master/bin/chicken' 'x.scm' -output-file 'x.c' -static -verbose -debug 2 -emit-link-file x.link Note: re-importing already imported identifier: assoc Note: re-importing already imported identifier: member [canonicalized] (##core#callunit library) (##core#callunit eval) (##core#callunit expand) (##core#callunit srfi-1) (##core#undefined) (##core#undefined) (##core#undefined) (scheme#eval '(import-for-syntax scheme chicken.base chicken.syntax)) (scheme#eval '(import scheme chicken.base chicken.syntax)) (##core#undefined) (scheme#newline) ((chicken.base#implicit-exit-handler)) 'gcc' 'x.c' -o 'x.o' -c -fno-strict-aliasing -fwrapv -DHAVE_CHICKEN_CONFIG_H -DC_ENABLE_PTABLES -g -Wall -Wno-unused -I/home/felix/chicken/chicken-5-master/include/chicken 'gcc' 'x.o' '/home/felix/chicken/chicken-5-master/lib/chicken/9/srfi-1.o' -o 'x' -L/home/felix/chicken/chicken-5-master/lib -Wl,-R'/home/felix/chicken/chicken-5-master/lib' /home/felix/chicken/chicken-5-master/lib/libchicken.a -lm -ldl [debug] application startup... [debug] heap resized to 1048576 bytes [debug] stack bottom is 0x7fff624cffd0. [debug] entering toplevel... [debug] entering library... [debug] entering build-version... [debug] entering eval... [debug] entering chicken-syntax... [debug] entering expand... [debug] entering internal... [debug] entering modules... [debug] entering srfi-1... ; loading /home/felix/chicken/chicken-5-master/lib/chicken/9/chicken.import.so ... Error: (load) during expansion of (import-syntax ...) - unable to load compiled module - cannot load compiled code dynamically - this is a statically linked executable: "/home/felix/chicken/chicken-5-master/lib/chicken/9/chicken.import.so" Call history: <syntax> (import scheme chicken.base chicken.syntax) <syntax> (##core#begin (##core#require library scheme#) (##core#require library chicken.base#) (##core#requir... <syntax> (##core#require library scheme#) <syntax> (##sys#load-library (##core#quote library)) <syntax> (##core#quote library) <syntax> (##core#require library chicken.base#) <syntax> (##sys#load-library (##core#quote library)) <syntax> (##core#quote library) <syntax> (##core#begin (##core#require expand chicken.syntax#)) <syntax> (##core#require expand chicken.syntax#) <syntax> (##sys#load-library (##core#quote expand)) <syntax> (##core#quote expand) <eval> (##sys#load-library (##core#quote library)) <eval> (##sys#load-library (##core#quote library)) <eval> (##sys#load-library (##core#quote expand)) <syntax> (import-syntax (except scheme member assoc) chicken) <-- ␄
Changes and comments
[2017-12-26 17:42:09 UTC] felix wrote:
Actually, the command is:
`csc -static x.scm -kv -debug 2 && ./x -:rd`
It looks like srfi-1.scm actually is triggering the loading of `chicken.import.so`, which it shouldn't.
[2017-12-26 17:42:09 UTC] felix wrote:
1514306586017446
[2017-12-26 22:26:42 UTC] evhan wrote:
Hey Felix, I can't reproduce this. What revision of CHICKEN and the srfi-1 egg is this?
The output I see is this, which is what's expected, I think:
$ /nowhere/bin/csc -static x.scm -kv -debug 2 && ./x -:rd '/nowhere/bin/chicken' 'x.scm' -output-file 'x.c' -static -verbose -debug 2 -emit-link-file x.link Note: re-importing already imported identifier: assoc Note: re-importing already imported identifier: member [canonicalized] (##core#callunit library) (##core#callunit eval) (##core#callunit expand) (##core#callunit srfi-1) (##core#undefined) (##core#undefined) (##core#undefined) (##core#undefined) ((chicken.base#implicit-exit-handler)) 'gcc' 'x.c' -o 'x.o' -c -fno-strict-aliasing -fwrapv -DHAVE_CHICKEN_CONFIG_H -DC_ENABLE_PTABLES -Os -fomit-frame-pointer -I/nowhere/include/chicken 'gcc' 'x.o' '/nowhere/lib/chicken/9/srfi-1.o' -o 'x' -L/nowhere/lib -Wl,-R'/nowhere/lib' /nowhere/lib/libchicken.a -lm -ldl [debug] application startup... [debug] heap resized to 1048576 bytes [debug] stack bottom is 0x7fff1c6ddf60. [debug] entering toplevel... [debug] entering library... [debug] entering build-version... [debug] entering eval... [debug] entering chicken-syntax... [debug] entering expand... [debug] entering internal... [debug] entering modules... [debug] resizing mutation stack from 8k to 16k ... [debug] entering srfi-1... chicken.base#implicit-exit-handler [debug] forcing finalizers... [debug] application terminated normally
Versions:
$ /nowhere/bin/chicken -version
(c) 2008-2017, The CHICKEN Team
(c) 2000-2007, Felix L. Winkelmann
Version 5.0.0 (rev 57ec6d2b)
linux-unix-gnu-x86-64 [ 64bit dload ptables ]
$ git show -q # in the chicken-5-eggs repo
commit 36c190d79b415a91ecbbea3cb95f946ae837dd5e
Author: felix <felix@call-with-current-continuation.org>
Date: Mon Dec 25 15:00:29 2017 +0100
Added big-chicken
[2017-12-27 00:47:28 UTC] felix wrote:
Replying to evhan: > Hey Felix, I can't reproduce this. What revision of CHICKEN and the srfi-1 egg is this?
Using the same srfi-1 version and master HEAD (with and without Peter's last 3 patches). But I'll try again.
[2017-12-27 01:00:08 UTC] felix wrote:
I tried once more, with clean install locations and this seems indeed only happen with the recent three patches by sjamaan:
0001-Remove-obsolete-deprecated-stuff.patch 0002-Drop-weird-macro-workarounds-in-favour-of-chicken.in.patch 0003-Include-definitions-of-default-modules-into-modules..patch
[2017-12-27 21:19:58 UTC] sjamaan wrote:
I built a clean version of CHICKEN 5 with and without the patches, and didn't get the error. Maybe you were using a stale copy of srfi-1?
If you're using the "local" repository you will need to uninstall and git clean -df before retrying, I think.
[2017-12-27 23:34:19 UTC] felix wrote:
Replying to sjamaan: > I built a clean version of CHICKEN 5 with and without the patches, and didn't get the error. Maybe you were using a stale copy of srfi-1? > > If you're using the "local" repository you will need to uninstall and git clean -df before retrying, I think.
Did you purge the egg install cache? And can you give me the complete genealogy of the csc you are finally using? (including intermediate steps of producing (boot-)chickens)
[2017-12-28 08:51:41 UTC] sjamaan wrote:
Replying to felix: > Replying to sjamaan: > > I built a clean version of CHICKEN 5 with and without the patches, and didn't get the error. Maybe you were using a stale copy of srfi-1? > > > > If you're using the "local" repository you will need to uninstall and git clean -df before retrying, I think. > > Did you purge the egg install cache? And can you give me the complete genealogy of the csc you are finally using? (including intermediate steps of producing (boot-)chickens)
From the top (on a clean Linux system without CHICKEN 5):
First install pre4:
$ rm -rf ~/.chicken-install.cache $ wget https://code.call-cc.org/dev-snapshots/2017/12/14/chicken-5.0.0pre4.tar.gz $ tar xzf chicken-5.0.0pre4.tar.gz $ cd chicken-5.0.0pre4 $ make PLATFORM=linux PREFIX=/home/peter/chickens/5.0.0pre4 install
Next, apply patches and build a boot-chicken, then use that to build the actual CHICKEN:
$ cd ../chicken-core $ git clean -df $ git am < ~/0001-Remove-obsolete-deprecated-stuff.patch $ git am < ~/0002-Drop-weird-macro-workarounds-in-favour-of-chicken.in.patch $ git am < ~/0003-Include-definitions-of-default-modules-into-modules..patch $ make PLATFORM=linux CHICKEN=/home/peter/chickens/5.0.0pre4/bin/chicken boot-chicken $ make PLATFORM=linux CHICKEN=./chicken-boot PREFIX=/home/peter/chickens/chicken-5 install
Now, run the test program:
$ cd /tmp $ ~/chickens/chicken-5/bin/chicken-install srfi-1 $ echo '(import srfi-1)' > test.scm $ ~/chickens/chicken-5/bin/csc -static test.scm -kv -debug 2
Let's check it's statically linked (no libchicken in there):
$ ldd test
linux-vdso.so.1 (0x00007fffa6ff1000)
libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007f9507f4a000)
libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007f9507d46000)
libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f95079a7000)
/lib64/ld-linux-x86-64.so.2 (0x00007f9508686000)
OK, great. Now let's run it:
$ ./test -:rd [debug] application startup... [debug] heap resized to 1048576 bytes [debug] stack bottom is 0x7ffdf3e09100. [debug] entering toplevel... [debug] entering library... [debug] entering build-version... [debug] entering eval... [debug] entering chicken-syntax... [debug] entering expand... [debug] entering internal... [debug] entering modules... [debug] entering srfi-1... scheme#eval scheme#eval chicken.base#implicit-exit-handler [debug] forcing finalizers... [debug] application terminated normally
This gave me no errors.
[2017-12-28 08:52:31 UTC] sjamaan wrote:
Oh, BTW, I had revision `57ec6d2b4dc6110db0b24f48cae2cfa0e29fa48a` of `master` checked out in my `chicken-core` git repo.
[2017-12-29 20:52:24 UTC] felix set resolution to worksforme
[2017-12-29 20:52:24 UTC] felix wrote:
I seem to have conflated several issues.