bugMIT/GNU Scheme - Bugs: bug #40148, Error during compilation...

 
 

bug #40148: Error during compilation mit-scheme-c-9.1.1 with musl libc

Submitter:  None
Submitted:  Mon 30 Sep 2013 04:07:18 PM UTC
   
 
Category:  compiler Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Incorrect behavior
Status:  None Privacy:  Public
Assigned to:  riastradh Originator Name: 
Originator Email:  -email is unavailable- Open/Closed:  Closed
Keywords: 
* Mandatory Fields

Add a New Comment Rich Markup
   

Jump to the original submission

Mon 30 Sep 2013 10:20:39 PM UTC, comment #13: 

POSIX doesn't define <sys/ucontext.h>, but nor does POSIX define NGREG, and the intent about what header file you are supposed to include to get NGREG is not clear to me.  (It could be another file altogether, e.g. <machine/mcontext.h>, although I don't think this is the case for Linux.)

I'm going to close this bug and address the remaining issues in the other bugs.

Taylor R. Campbell <riastradh>
Group Member
Mon 30 Sep 2013 09:28:30 PM UTC, comment #12: 

there is no such thing as <sys/ucontext.h> on POSIX compliant systems.

glibc has it, but that's just a legacy header.
since its <ucontext.h> includes <sys/ucontext.h> anyway, both work equally well for GLIBC.

so yes, please do change it.

i'll open bug reports for the remaining issues in the meantime...

George Skabinsky <gska>
Mon 30 Sep 2013 08:08:18 PM UTC, comment #11: 

I already fixed the poll.h issue.  For ucontext.h, it's not clear to me that <ucontext.h> is the right way to get NGREG instead of <sys/ucontext.h>, but I'll change it to <ucontext.h> if you like.

There are a lot of issues in this bug report, and I doubt whether I'll remember them all.  Could you please file the outstanding issues as separate bugs so that I can keep track of them?

Taylor R. Campbell <riastradh>
Group Member
Mon 30 Sep 2013 07:14:51 PM UTC, comment #10: 

btw, the same applies to poll.h
warning: #warning redirecting incorrect #include <sys/poll.h> to <poll.h> [-Wcpp]

man 0p poll.h

<poll.h>(0P)                                      POSIX Programmer's Manual                                      <poll.h>(0P)



NAME
       poll.h - definitions for the poll() function

SYNOPSIS
       #include <poll.h>

George Skabinsky <gska>
Mon 30 Sep 2013 07:03:24 PM UTC, comment #9: 

sorry, man 0p ucontext.h

George Skabinsky <gska>
Mon 30 Sep 2013 07:02:37 PM UTC, comment #8: 

thanks, but sys/ is wrong:

man 0p ucontext says:


<ucontext.h>(0P)                                               POSIX Programmer's Manual                                              <ucontext.h>(0P)



NAME
       ucontext.h - user context

SYNOPSIS
       #include <ucontext.h>

George Skabinsky <gska>
Mon 30 Sep 2013 06:58:30 PM UTC, comment #7: 

The build system is indeed badly in need of renovation, especially for the liarc build.  Most of the scripts in src/etc/ should be reworked into makefile rules with proper dependencies, like I've done for the native build, and `./configure && make -j123 && make install' ought to work out of the box.

I have been occasionally fixing little bits of the build system, but I don't have time to rototill the whole thing.  If you have time to fix it, or even fix small issues (such as checking that -lX11 works early), I would be happy to review patches.  However, I don't want to just paper over the issues with more band-aids.

I misread the ucontext issue, sorry; not sure where my brain got ucontext_t involved.  I've committed a change to include <sys/ucontext.h> on Linux, in commit a5f16b63ef26ff2ae8b06e76ab564f1e146cfee4 -- I believe this should do what you want.

By the way, `set -e' is easier than writing `|| exit 1' after every command in a shell script.  I normally use `set -Ceu' in my shell scripts.

Taylor R. Campbell <riastradh>
Group Member
Mon 30 Sep 2013 06:17:09 PM UTC, comment #6: 

as for the xcb dependencies:
the configure script should check if its available and only build the stuff using it when it's available, instead of failing after a hourlong build

George Skabinsky <gska>
Mon 30 Sep 2013 06:15:27 PM UTC, comment #5: 

s/invoking the (currently non-existing) configure/
invoking the (currently non-existing) top-level configure/

George Skabinsky <gska>
Mon 30 Sep 2013 06:14:27 PM UTC, comment #4: 

it's pretty unfortunate that the user has to hack around to get a proper build, instead of just doing ./configure && make -j9 && make install

since this is a "portable C distribution" there can be no doubt that the user invoking the (currently non-existing) configure script intends to build the C-bootstrap, and doesnt have a scheme compiler installed.

so why forcing him to study documentation on how to build instead of just offering something that works out of the box ?

George Skabinsky <gska>
Mon 30 Sep 2013 06:10:22 PM UTC, comment #3: 

the build is easy to parallelize, just not with the stupid etc script


this here seems to work


patch -p1 < "$K"/mit-scheme-typo.patch || exit 1
patch -p1 < "$K"/mit-scheme-NGREG.patch || exit 1

cp config.cache src/

# the "smart" configure scripts appends -O3 AFTER our CFLAGS
# there's no good reason to dictate which optimization we want to use
sed -i 's@[-]O3@@' src/configure src/microcode/configure

cd src

CFLAGS="-D_GNU_SOURCE $optcflags -O0 -g0" LDFLAGS="$optldflags" \
./configure -C --prefix=`pwd`/boot-root \
  --enable-native-code=c --disable-host-scheme-test || exit 1

make -j$MAKE_THREADS stamp_install-liarc-boot-compiler || exit 1

make c-clean distclean || exit 1


CFLAGS="-D_GNU_SOURCE $optcflags" LDFLAGS="$optldflags" \
./configure -C --prefix="$butch_prefix" \
  --enable-native-code=c --disable-host-scheme-test || exit 1

make -j$MAKE_THREADS stamp_compile-liarc-bundles build-bands || exit 1

make -j$MAKE_THREADS clean-boot-root || exit 1

make DESTDIR="$butch_install_dir" install || exit 1

cd ..

George Skabinsky <gska>
Mon 30 Sep 2013 06:07:26 PM UTC, comment #2: 

" The ucontext_t issue looks like a bug in musl libc -- <signal.h> is supposed to define ucontext_t, according to POSIX: "


wrong: the problem is not ucontext_t, but NGREG

George Skabinsky <gska>
Mon 30 Sep 2013 05:31:49 PM UTC, comment #1: 

- The nanotime issue has already been fixed in Git, in commit 00f7a86f7da162db5504952b968f2268bbe215ea.

- The ucontext_t issue looks like a bug in musl libc -- <signal.h> is supposed to define ucontext_t, according to POSIX: <http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/signal.h.html>.  We can put in a workaround for musl libc, but it would be better to fix this upstream.

- For X11, it looks like you're using static libX11 for some reason.  Is there a reason you're doing that instead of using dynamic libX11?  If you do want static libX11, on ELF systems, you have to know what other libraries libX11 needs, such as perhaps libxcb.  You can adjust this with the `--x-libraries' argument to configure (or, make-liarc.sh):  ./configure --x-libraries=-L/home/rooster/local/lib\ -lX11\ -lxcb

- You should be able to pass CFLAGS as an argument to configure or make-liarc.sh:  ./etc/make-liarc.sh CFLAGS=-fwrangle-frobbotzim  This doesn't get passed along for the bootstrap build, though; perhaps it ought to.

- Sorry, for the C-based distribution, nobody's made the build parallelizable.  The native build is parallelizable in Git.  Are you on a non-x86 system, or could you try using the native distribution instead?

Taylor R. Campbell <riastradh>
Group Member
Mon 30 Sep 2013 04:07:18 PM UTC, original submission:  

The following error occurs while I'm trying to compile mit-scheme-c-9.1.1 with musl-gcc wrapper.


/home/rooster/pkg/musl-0.9.13/include/sys/poll.h:1:2: warning: #warning redirecting incorrect #include <sys/poll.h> to <poll.h> [-Wcpp]
uxenv.c:185:1: error: conflicting types for ‘OS_nanotime_since_utc_epoch’
In file included from uxenv.c:30:0:
osenv.h:61:13: note: previous declaration of ‘OS_nanotime_since_utc_epoch’ was here
uxenv.c: In function ‘OS_nanotime_since_utc_epoch’:
uxenv.c:190:5: error: invalid type argument of ‘->’ (have ‘struct scheme_nanotime’)
uxenv.c:191:5: error: invalid type argument of ‘->’ (have ‘struct scheme_nanotime’)
make[1]: * [uxenv.o] Error 1
make[1]: Leaving directory `/home/rooster/src/mit-scheme-c-9.1.1/src/microcode'
make: * [compile-microcode] Error 2
roost0 ~/src/mit-scheme-c-9.1.1/src $

After the patch (in attached files) applied.

It fails to link.
/home/rooster/local/lib/libX11.a(OpenDis.o): In function `XOpenDisplay':
OpenDis.c:(.text+0x81e): undefined reference to `xcb_get_setup'
OpenDis.c:(.text+0xa33): undefined reference to `xcb_get_maximum_request_length'
/home/rooster/local/lib/libX11.a(xcb_disp.o): In function `_XConnectXCB':
xcb_disp.c:(.text+0x187): undefined reference to `xcb_parse_display'
xcb_disp.c:(.text+0x1e8): undefined reference to `xcb_connect_to_display_with_auth_info'
xcb_disp.c:(.text+0x206): undefined reference to `xcb_get_file_descriptor'
xcb_disp.c:(.text+0x221): undefined reference to `xcb_generate_id'
xcb_disp.c:(.text+0x29b): undefined reference to `xcb_connection_has_error'
xcb_disp.c:(.text+0x2bc): undefined reference to `xcb_connect'
collect2: error: ld returned 1 exit status
make[1]: * [prx11.so] Error 1
make[1]: Leaving directory `/home/rooster/src/mit-scheme-c-9.1.1/src/microcode'
make: * [compile-microcode] Error 2
roost0 ~/src/mit-scheme-c-9.1.1/src $


Also, it's impossible to pass CFLAGS to the scripts and only single-thread compiling is supported.

Anonymous

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

Attached Files
file #29268:  mit-scheme-fail1.log added by None (60KiB - application/octet-stream)
file #29269:  mit-scheme_musl_comp.patch added by None (580B - application/octet-stream)
file #29270:  mit-scheme-fail2.log added by None (148KiB - application/octet-stream)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by gska (Posted a comment)
  • -email is unavailable- added by riastradh (Posted a comment)
  • -email is unavailable- added by None (Submitted the item)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only logged-in users can vote.

     

    Follow 7 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2013-09-30 riastradh StatusIn Progress None
        Open/ClosedOpen Closed
    2013-09-30 riastradh StatusNone In Progress
        Assigned toNone riastradh
    2013-09-30 None Attached File- Added mit-scheme-fail1.log, #29268
        Attached File- Added mit-scheme_musl_comp.patch, #29269
        Attached File- Added mit-scheme-fail2.log, #29270

    Back to the top

    Powered by Savane 3.13-4448.
    Corresponding source code