gwatt / chez-exe

Chez Scheme self hosting executable
Other
179 stars 40 forks source link

Can't compile chez-exe con Linux #9

Closed ghost closed 4 years ago

ghost commented 4 years ago

Specs:

Trying to compile chez-exe results in the following compilation error:

$ scheme --script gen-config.ss --prefix /usr --bootpath /usr/lib/csv9.5.2/ta6le
$ make -j4
[...]
/usr/bin/ld: ./full-chez.a(kernel.o): in function `new_open_output_fd_helper':
/builddir/ChezScheme-9.5.2/ta6le/c/new-io.c:351: undefined reference to `gzdopen'
/usr/bin/ld: ./full-chez.a(kernel.o): in function `S_new_open_input_fd':
/builddir/ChezScheme-9.5.2/ta6le/c/new-io.c:210: undefined reference to `gzdopen'
/usr/bin/ld: /builddir/ChezScheme-9.5.2/ta6le/c/new-io.c:217: undefined reference to `gzdirect'
/usr/bin/ld: /builddir/ChezScheme-9.5.2/ta6le/c/new-io.c:226: undefined reference to `gzclose'
/usr/bin/ld: /builddir/ChezScheme-9.5.2/ta6le/c/new-io.c:226: undefined reference to `gzerror'
/usr/bin/ld: /builddir/ChezScheme-9.5.2/ta6le/c/new-io.c:226: undefined reference to `gzclearerr'
/usr/bin/ld: ./full-chez.a(kernel.o): in function `S_compress_input_fd':
/builddir/ChezScheme-9.5.2/ta6le/c/new-io.c:246: undefined reference to `gzdopen'
/usr/bin/ld: /builddir/ChezScheme-9.5.2/ta6le/c/new-io.c:252: undefined reference to `gzdirect'
/usr/bin/ld: /builddir/ChezScheme-9.5.2/ta6le/c/new-io.c:261: undefined reference to `gzclose'
/usr/bin/ld: /builddir/ChezScheme-9.5.2/ta6le/c/new-io.c:261: undefined reference to `gzerror'
/usr/bin/ld: /builddir/ChezScheme-9.5.2/ta6le/c/new-io.c:261: undefined reference to `gzclearerr'
/usr/bin/ld: ./full-chez.a(kernel.o): in function `S_compress_output_fd':
/builddir/ChezScheme-9.5.2/ta6le/c/new-io.c:275: undefined reference to `gzdopen'
/usr/bin/ld: ./full-chez.a(kernel.o): in function `S_close_fd':
/builddir/ChezScheme-9.5.2/ta6le/c/new-io.c:404: undefined reference to `gzclose'
/usr/bin/ld: /builddir/ChezScheme-9.5.2/ta6le/c/new-io.c:404: undefined reference to `gzerror'
/usr/bin/ld: /builddir/ChezScheme-9.5.2/ta6le/c/new-io.c:404: undefined reference to `gzclearerr'
/usr/bin/ld: ./full-chez.a(kernel.o): in function `S_bytevector_read':
/builddir/ChezScheme-9.5.2/ta6le/c/new-io.c:464: undefined reference to `gzerror'
/usr/bin/ld: /builddir/ChezScheme-9.5.2/ta6le/c/new-io.c:464: undefined reference to `gzclearerr'
/usr/bin/ld: /builddir/ChezScheme-9.5.2/ta6le/c/new-io.c:464: undefined reference to `gzread'
/usr/bin/ld: ./full-chez.a(kernel.o): in function `S_bytevector_write':
/builddir/ChezScheme-9.5.2/ta6le/c/new-io.c:566: undefined reference to `gzerror'
/usr/bin/ld: /builddir/ChezScheme-9.5.2/ta6le/c/new-io.c:566: undefined reference to `gzclearerr'
/usr/bin/ld: /builddir/ChezScheme-9.5.2/ta6le/c/new-io.c:566: undefined reference to `gzwrite'
/usr/bin/ld: ./full-chez.a(kernel.o): in function `S_put_byte':
/builddir/ChezScheme-9.5.2/ta6le/c/new-io.c:621: undefined reference to `gzerror'
/usr/bin/ld: /builddir/ChezScheme-9.5.2/ta6le/c/new-io.c:621: undefined reference to `gzclearerr'
/usr/bin/ld: /builddir/ChezScheme-9.5.2/ta6le/c/new-io.c:621: undefined reference to `gzwrite'
/usr/bin/ld: ./full-chez.a(kernel.o): in function `S_get_fd_pos':
/builddir/ChezScheme-9.5.2/ta6le/c/new-io.c:654: undefined reference to `gzseek'
/usr/bin/ld: ./full-chez.a(kernel.o): in function `S_set_fd_pos':
/builddir/ChezScheme-9.5.2/ta6le/c/new-io.c:673: undefined reference to `gzseek'
/usr/bin/ld: ./full-chez.a(kernel.o): in function `S_bytevector_compress_size':
/builddir/ChezScheme-9.5.2/ta6le/c/new-io.c:799: undefined reference to `compressBound'
/usr/bin/ld: ./full-chez.a(kernel.o): in function `S_bytevector_compress':
/builddir/ChezScheme-9.5.2/ta6le/c/new-io.c:817: undefined reference to `compress'
/usr/bin/ld: ./full-chez.a(kernel.o): in function `S_bytevector_uncompress':
/builddir/ChezScheme-9.5.2/ta6le/c/new-io.c:838: undefined reference to `uncompress'
/usr/bin/ld: ./full-chez.a(kernel.o): in function `uf_read':
/builddir/ChezScheme-9.5.2/ta6le/c/fasl.c:349: undefined reference to `gzread'
/usr/bin/ld: /builddir/ChezScheme-9.5.2/ta6le/c/fasl.c:355: undefined reference to `gzerror'
/usr/bin/ld: /builddir/ChezScheme-9.5.2/ta6le/c/fasl.c:356: undefined reference to `gzclearerr'
/usr/bin/ld: ./full-chez.a(kernel.o): in function `zget_uptr':
/builddir/ChezScheme-9.5.2/ta6le/c/scheme.c:815: undefined reference to `gzgetc'
/usr/bin/ld: /builddir/ChezScheme-9.5.2/ta6le/c/scheme.c:811: undefined reference to `gzgetc'
/usr/bin/ld: ./full-chez.a(kernel.o): in function `load':
/builddir/ChezScheme-9.5.2/ta6le/c/scheme.c:926: undefined reference to `gzclose'
/usr/bin/ld: ./full-chez.a(kernel.o): in function `zgetstr':
/builddir/ChezScheme-9.5.2/ta6le/c/scheme.c:829: undefined reference to `gzgetc'
/usr/bin/ld: /builddir/ChezScheme-9.5.2/ta6le/c/scheme.c:831: undefined reference to `gzungetc'
/usr/bin/ld: ./full-chez.a(kernel.o): in function `find_boot':
/builddir/ChezScheme-9.5.2/ta6le/c/scheme.c:588: undefined reference to `gzdopen'
/usr/bin/ld: /builddir/ChezScheme-9.5.2/ta6le/c/scheme.c:757: undefined reference to `gzungetc'
/usr/bin/ld: /builddir/ChezScheme-9.5.2/ta6le/c/scheme.c:768: undefined reference to `gzrewind'
/usr/bin/ld: /builddir/ChezScheme-9.5.2/ta6le/c/scheme.c:769: undefined reference to `gzread'
/usr/bin/ld: /builddir/ChezScheme-9.5.2/ta6le/c/scheme.c:775: undefined reference to `gzungetc'
/usr/bin/ld: /builddir/ChezScheme-9.5.2/ta6le/c/scheme.c:774: undefined reference to `gzgetc'
/usr/bin/ld: /builddir/ChezScheme-9.5.2/ta6le/c/scheme.c:780: undefined reference to `gzclose'
/usr/bin/ld: /builddir/ChezScheme-9.5.2/ta6le/c/scheme.c:787: undefined reference to `gzgetc'
/usr/bin/ld: /builddir/ChezScheme-9.5.2/ta6le/c/scheme.c:790: undefined reference to `gzclose'
/usr/bin/ld: /builddir/ChezScheme-9.5.2/ta6le/c/scheme.c:651: undefined reference to `gzclose'
/usr/bin/ld: /builddir/ChezScheme-9.5.2/ta6le/c/scheme.c:741: undefined reference to `gzgetc'
/usr/bin/ld: /builddir/ChezScheme-9.5.2/ta6le/c/scheme.c:743: undefined reference to `gzclose'
/usr/bin/ld: /builddir/ChezScheme-9.5.2/ta6le/c/scheme.c:748: undefined reference to `gzgetc'
/usr/bin/ld: /builddir/ChezScheme-9.5.2/ta6le/c/scheme.c:751: undefined reference to `gzclose'
/usr/bin/ld: /builddir/ChezScheme-9.5.2/ta6le/c/scheme.c:637: undefined reference to `gzclose'
/usr/bin/ld: /builddir/ChezScheme-9.5.2/ta6le/c/scheme.c:644: undefined reference to `gzclose'
/usr/bin/ld: /builddir/ChezScheme-9.5.2/ta6le/c/scheme.c:614: undefined reference to `gzgetc'
/usr/bin/ld: /builddir/ChezScheme-9.5.2/ta6le/c/scheme.c:761: undefined reference to `gzclose'
/usr/bin/ld: /builddir/ChezScheme-9.5.2/ta6le/c/scheme.c:765: undefined reference to `gzgetc'
/usr/bin/ld: /builddir/ChezScheme-9.5.2/ta6le/c/scheme.c:629: undefined reference to `gzclose'
/usr/bin/ld: /builddir/ChezScheme-9.5.2/ta6le/c/scheme.c:595: undefined reference to `gzopen'
/usr/bin/ld: /builddir/ChezScheme-9.5.2/ta6le/c/scheme.c:772: undefined reference to `gzgetc'
/usr/bin/ld: /builddir/ChezScheme-9.5.2/ta6le/c/scheme.c:677: undefined reference to `gzopen'
/usr/bin/ld: /builddir/ChezScheme-9.5.2/ta6le/c/scheme.c:695: undefined reference to `gzgetc'
/usr/bin/ld: /builddir/ChezScheme-9.5.2/ta6le/c/scheme.c:731: undefined reference to `gzclose'
/usr/bin/ld: /builddir/ChezScheme-9.5.2/ta6le/c/scheme.c:690: undefined reference to `gzgetc'
/usr/bin/ld: /builddir/ChezScheme-9.5.2/ta6le/c/scheme.c:691: undefined reference to `gzgetc'
/usr/bin/ld: /builddir/ChezScheme-9.5.2/ta6le/c/scheme.c:692: undefined reference to `gzgetc'
/usr/bin/ld: /builddir/ChezScheme-9.5.2/ta6le/c/scheme.c:693: undefined reference to `gzgetc'
/usr/bin/ld: /builddir/ChezScheme-9.5.2/ta6le/c/scheme.c:694: undefined reference to `gzgetc'
/usr/bin/ld: ./full-chez.a(kernel.o):/builddir/ChezScheme-9.5.2/ta6le/c/scheme.c:615: more undefined references to `gzgetc' follow
collect2: error: ld returned 1 exit status
gwatt commented 4 years ago

It looks like void linux forces Chez Scheme to dynamically link against zlib; the normal behavior is for Chez Scheme to build its own static library version of zlib to link against. Luckily, when running gen-config you can specify extra command line arguments and those will always be used when building programs with compile-chez-program:

./gen-config.ss (whatever normal options you specify) -lzlib
ghost commented 4 years ago

I've cloned ChezScheme's master repo inside chez-exe, wrote a simple automation script with the flags and it worked:

#!/bin/bash

arch=ta6le
procs=5
instdirprefix=/usr/local

cd ChezScheme
git pull origin master
./configure --disable-x11 --threads
make -j$procs
cd ..
scheme --script gen-config.ss --prefix "$instdirprefix" \
    --scheme "$GITREPOS/chez-exe/ChezScheme/$arch/bin/scheme" \
    --bootpath "$GITREPOS/chez-exe/ChezScheme/$arch/boot/$arch"
make -j$procs

echo "Installation prefix set to \"$instdirprefix\""
echo "Issue a 'sudo make install' to install the program."
echo "Issue a 'sudo make uninstall' to uninstall the program."

Note: Makefile for chez-exe was modified to include an uninstall task.

I will try to build chez-exe with the 9.5.2 version installed with the pkg manager tho and see if I can accomplish the same thing.

ghost commented 4 years ago

Good news: the following flags worked!

./gen-config.ss --prefix /usr --scheme /usr/bin/scheme --bootpath /usr/lib/csv9.5.2/ta6le -lz

Packages used (Void Linux):

ghost commented 4 years ago

I've forked the project to add my own modifications, let me know if you could eventually accept a merge request from my fork :smiley:

gwatt commented 4 years ago

Merge requests are welcome.