Build fails on FreeBSD and NetBSD
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Ikarus Scheme |
Fix Released
|
Medium
|
Abdulaziz Ghuloum |
Bug Description
On both FreeBSD 6.2 and NetBSD 3.1, the build fails with this error message:
=======
Making all in scheme
../src/ikarus -b ./ikarus.boot.orig --r6rs-script makefile.ss
looking for foreign name ik_foreign_call
failed to find foreign name ik_foreign_call: Undefined symbol "ik_foreign_call"
*** Error code 255
=======
$ uname -a
on those systems returns
=======
NetBSD aix 3.1 NetBSD 3.1 (GENERIC.MPACPI) #0: Tue Oct 31 04:47:22 UTC 2006 <email address hidden>
=======
and
=======
FreeBSD hondo 6.2-STABLE FreeBSD 6.2-STABLE #0: Sun Sep 16 04:17:59 CEST 2007 wfenske@
=======
The message comes from src/ikarus-fasl.c. function ik_relocate_code().
Apparently the call dlsym(RTLD_DEFAULT, name) fails. I inserted another
debug message and it seems like "ik_foreign_call" is the first symbol dlsym
tries to locate. That means this piece of code doesn't work at all on FreeBSD
or NetBSD.
For comparison I built Ikarus on a Linux system and everything worked just
fine, as I expected.
Changed in ikarus: | |
status: | Fix Committed → Fix Released |
There is a flag that must be passed to gcc in order to make functions
in the executable visible to dlsym. On linux, it's "-rdynamic", and
on Mac OS, you don't need to do anything. I don't know what it is
for the bsds. If you know how to get gcc to compile the following
program such that the two printed lines show the same address, then
you'd have solved the problem. Otherwise, I'd have to look around
for a bsd machine to try to figure it out. Keep me posted.
Aziz,,,
#include <stdio.h>
#include <dlfcn.h>
int foo(int x){
return x*x;
}
int main(int args, char** argv){ "foo=0x% 08x\n", (int)foo); "foo=0x% 08x\n", (int)dlsym( RTLD_DEFAULT, "foo"));
printf(
printf(
return 0;
}