oups forgot to include the gambit-list in my repluy ;)
-------- Original Message -------- Subject: Re: [gambit-list] Hello World segfaults on me Date: Sun, 03 Feb 2008 10:15:47 -0500 From: David St-Hilaire sthilaid@iro.umontreal.ca To: Francisco Listas francisco.listas@gmail.com References: 8d9da3cf0802030633j40e82a56gdc3e6d55fe53915a@mail.gmail.com
Francisco Listas wrote:
I am running Ubuntu 7.10, and I've just installed (using synaptic) Gambit-C. To try my installation, I just wrote (in file hello.scm) this hello world program:
(display "Hello World!\n")
Running: gsi hello.scm
Produces the expected output.
Running: gsc hello.scm
Produces hello.o1 executable file, but when I run it, a segfault occurs: ./hello.o1
Thats where your error lies. Here is what you should do instead:
dave@david ~/temp $ echo '(display "allo tout le monde!\n")' > test.scm dave@david ~/temp $ gsi test.scm allo tout le monde! dave@david ~/temp $ gsc test.scm dave@david ~/temp $ gsi test allo tout le monde! dave@david ~/temp $
I am not 100% sure here but I believe that the .o1 file format is some kind of gambit byte code. To get an executable, you need to do the following:
dave@david ~/temp $ echo '(display "allo tout le monde!\n")' > test.scm dave@david ~/temp $ gsc -link test.scm dave@david ~/temp $ gcc test.c test_.c -lgambc dave@david ~/temp $ ./a.out allo tout le monde! dave@david ~/temp $
Hope that could help you! :D
David
Afficher les réponses par date
David St-Hilaire wrote:
oups forgot to include the gambit-list in my repluy ;)
-------- Original Message -------- Subject: Re: [gambit-list] Hello World segfaults on me Date: Sun, 03 Feb 2008 10:15:47 -0500 From: David St-Hilaire sthilaid@iro.umontreal.ca To: Francisco Listas francisco.listas@gmail.com References: 8d9da3cf0802030633j40e82a56gdc3e6d55fe53915a@mail.gmail.com
Francisco Listas wrote:
I am running Ubuntu 7.10, and I've just installed (using synaptic) Gambit-C. To try my installation, I just wrote (in file hello.scm) this hello world program:
(display "Hello World!\n")
Running: gsi hello.scm
Produces the expected output.
Running: gsc hello.scm
Produces hello.o1 executable file, but when I run it, a segfault occurs: ./hello.o1
Thats where your error lies. Here is what you should do instead:
dave@david ~/temp $ echo '(display "allo tout le monde!\n")' > test.scm dave@david ~/temp $ gsi test.scm allo tout le monde! dave@david ~/temp $ gsc test.scm dave@david ~/temp $ gsi test allo tout le monde! dave@david ~/temp $
I am not 100% sure here but I believe that the .o1 file format is some kind of gambit byte code. To get an executable, you need to do the following:
dave@david ~/temp $ echo '(display "allo tout le monde!\n")' > test.scm dave@david ~/temp $ gsc -link test.scm dave@david ~/temp $ gcc test.c test_.c -lgambc dave@david ~/temp $ ./a.out allo tout le monde! dave@david ~/temp $
Hope that could help you! :D
David
Gambit-list mailing list Gambit-list@iro.umontreal.ca https://webmail.iro.umontreal.ca/mailman/listinfo/gambit-list
Yes it works!, I thought it was something wrong with my toolchain, but it was just a problem between the keyboard and my chair. Thanks, I have to read the documentation more carefully. Merci David
David St-Hilaire wrote:
I am not 100% sure here but I believe that the .o1 file format is some kind of gambit byte code.
It's not byte code, but a shared library.
$ file test.o1 test.o1: ELF 32-bit LSB shared object, Intel 80386, version 1 (SYSV), not stripped $ file /lib/libc-2.3.2.so /lib/libc-2.3.2.so: ELF 32-bit LSB shared object, Intel 80386, version 1 (SYSV), stripped $ objdump -d test.o1 # outputs disassembled machine code
Christian.
I wrote:
It's not byte code, but a shared library.
$ file test.o1 test.o1: ELF 32-bit LSB shared object, Intel 80386, version 1 (SYSV), not stripped $ file /lib/libc-2.3.2.so /lib/libc-2.3.2.so: ELF 32-bit LSB shared object, Intel 80386, version 1 (SYSV), stripped
(Minor addition:
Actually that's a bit of a bad comparison example, since libc.so really is executable, which is the exception.
Usually shared libraries are not executable directly, and usually also don't carry the executable bit in their file permissions. Marc, if there isn't any reason for the executable flag on the Gambit loadable objects, dropping it may prevent confusion. I actually did wonder when I started using Gambit why those files are +x, but then just ignored the fact.
Christian. )
Christian Jaeger wrote:
I wrote:
It's not byte code, but a shared library.
$ file test.o1 test.o1: ELF 32-bit LSB shared object, Intel 80386, version 1 (SYSV), not stripped $ file /lib/libc-2.3.2.so /lib/libc-2.3.2.so: ELF 32-bit LSB shared object, Intel 80386, version 1 (SYSV), stripped
(Minor addition:
Actually that's a bit of a bad comparison example, since libc.so really is executable, which is the exception.
Usually shared libraries are not executable directly, and usually also don't carry the executable bit in their file permissions. Marc, if there isn't any reason for the executable flag on the Gambit loadable objects, dropping it may prevent confusion. I actually did wonder when I started using Gambit why those files are +x, but then just ignored the fact.
Christian. ) _______________________________________________ Gambit-list mailing list Gambit-list@iro.umontreal.ca https://webmail.iro.umontreal.ca/mailman/listinfo/gambit-list
I agree, the executable flag on the library is confusing. Thank you for solving my issue! Regards, FCo