Summary
chicken-install may fail if TMPDIR is mounted noexec (depending on setup-file details)
Metadata
- Id: 196220412ae08eca9a0446ff1e5c84f9b8204a55
- Trac id: 1218
- Type: defect
- Reporter: iraikov
- Owner:
- Cc:
- Status: closed
- Component: extensions
- Estimated difficulty: hard
- Resolution: fixed
- Priority: major
- Milestone: 5.0
- Version: 4.10.x
- Changetime: 2017-10-14 14:30:54 UTC
- Created: 2015-08-29 23:55:23 UTC
- Keywords: coops
Description
chicken-install coops results in the following error:
installing coops:1.93 ... changing current directory to /tmp/temp4661.6142/coops
'/home/igr/bin/chicken/bin/csi' -bnq -setup-mode -e "(require-library setup-api)" -e "(import setup-api)" -e "(setup-error-handling)" -e "(extension-name-and-version '(\"coops\" \"1.93\"))" 'coops.setup' '/home/igr/bin/chicken/bin/csc' -feature compiling-extension -setup-mode -s -O3 -d1 coops-module.scm -JS -o coops.so '/home/igr/bin/chicken/bin/csc' -feature compiling-extension -setup-mode -s -O3 -d0 coops.import.scm '/home/igr/bin/chicken/bin/csc' -feature compiling-extension -setup-mode -s -O3 -d1 coops-primitive-objects -JS
Error: (load) during expansion of (import ...) - unable to load compiled module - ./coops.import.so: failed to map segment from shared object: Operation not permitted: "./coops.import.so"
Changes and comments
[2015-08-30 07:22:07 UTC] evhan wrote:
Unable to replicate on Linux or OpenBSD. On what platform did this occur?
[2015-08-30 07:48:31 UTC] iraikov wrote:
Ubuntu Linux 14.04 / gcc 4.8.4
Replying to evhan: > Unable to replicate on Linux or OpenBSD. On what platform did this occur?
[2015-08-30 08:05:21 UTC] iraikov wrote:
One more thing, did you try a fresh CHICKEN installation, or did you already have coops installed?
Replying to evhan: > Unable to replicate on Linux or OpenBSD. On what platform did this occur?
[2015-08-30 12:57:44 UTC] sjamaan wrote:
This sounds like a noexec mount of /tmp.
I don't know whether that's fixable (I don't know much about coops and its installation procedure), but this causes trouble with several other eggs, IIRC. So perhaps it's not really a coops bug (though one could argue it's a bug in chicken-install, if a very difficult one to fix)
[2015-08-30 17:04:49 UTC] iraikov wrote:
True, /tmp is mounted noexec on this system. I remember now that I ran into this issue with an unrelated piece of software a few weeks ago.
I was able to find a workaround by changing the first line in coops.setup
(compile -s -O3 -d1 coops-module.scm -JS -o coops.so)
to
(compile -s -O3 -d1 coops.scm -JS)
And switching around the files coops-module.scm and coops.scm so that now coops.scm includes coops-module.scm.
Is it the -o option to chicken-install that does not work with noexec-mounted /tmp? If so, I will re-title this issue accordingly.
Replying to sjamaan: > This sounds like a noexec mount of /tmp. > > I don't know whether that's fixable (I don't know much about coops and its installation procedure), but this causes trouble with several other eggs, IIRC. So perhaps it's not really a coops bug (though one could argue it's a bug in chicken-install, if a very difficult one to fix)
[2015-09-15 21:09:32 UTC] sjamaan wrote:
I tried to reproduce what you said you did to the files, but I keep getting the same error message.
However, it worked if I simply moved the import files to the end (even with the orignal versions of coops.scm and coops-module.scm), so they're compiled after all the other files. That's because the (import foo) statements will then fall back to simply loading the source files instead. This may be a good "solution" for coops and similar eggs (perhaps 90% of our eggs, in fact), but it won't work in the general case:
If you have an egg consisting of two modules, let's say module A and B, where A depends on B at compile-time (perhaps B offers some important macros), it must be able to load it. If module B contains FFI calls, it must be compiled.
Of course this is a pretty contrived example: most eggs are not this complicated. So I guess this "bug" should be considered to be in coops after all.
[2015-09-26 16:13:22 UTC] sjamaan changed summary
[2015-11-28 20:51:11 UTC] sjamaan changed milestone from 4.11.0 to 5.0
[2015-11-28 20:51:11 UTC] sjamaan wrote:
I'd say this is a setup-file problem specific to the egg. We **may** be able to fix this in a general way with the new setup file language in CHICKEN 5, but I doubt it; it's a fundamental problem that you can't load a library at compile time that you've just generated but not yet installed.
In any case, not something that we can fix with CHICKEN 4.
[2016-08-25 20:23:16 UTC] sjamaan set difficulty to hard
[2017-04-22 15:37:03 UTC] sjamaan wrote:
The new setup language cleanly separates build from install, which means the problem still exists.
I think the clean separation is desirable because you want to be able to build separately, and also because if the building of coops works and is installed, but coops-primitive-objects fails, this means the egg would be half-installed.
I don't know if it's even something we can fix (or even should fix?). Perhaps it should be documented as a limitation. I think even detecting this situation is difficult.
[2017-04-23 17:57:31 UTC] felix wrote:
Note that in C5, building of eggs takes place in the cache (usually `~/.chicken-install-cache`, or `$CHICKEN_EGG_CACHE`), so `$TMPDIR` is irrelevant in this case.
[2017-04-23 22:49:22 UTC] iraikov wrote:
Oh, it does sound like this might make the issue irrelevant. Apologies for not trying out C5 earlier. Let me just build it and see if I can install eggs with it.
Replying to felix: > Note that in C5, building of eggs takes place in the cache (usually `~/.chicken-install-cache`, or `$CHICKEN_EGG_CACHE`), so `$TMPDIR` is irrelevant in this case.
[2017-10-14 14:30:54 UTC] sjamaan changed status from new to closed
[2017-10-14 14:30:54 UTC] sjamaan set resolution to fixed
[2017-10-14 14:30:54 UTC] sjamaan wrote:
Should work with C5. Please reopen if it's not working