9fans / plan9port

Plan 9 from User Space
https://9fans.github.io/plan9port/
Other
1.62k stars 320 forks source link

Unable to compile compress.c #539

Open clintolsen opened 2 years ago

clintolsen commented 2 years ago

I'm on a pretty old CentOS 6.8 system. I encountered this error:


9c  compress.c
/usr/include/signal.h:155: error: expected ‘;’, ‘,’ or ‘)’ before ‘*’ token```

I'm curious if there's an easy workaround for this.
bhuntsman commented 2 years ago

I just tested this. Update the following section in include/u.h

#if !defined(__APPLE__) && !defined(__OpenBSD__) && !defined(__AIX__)
#       define _XOPEN_SOURCE 1000
#       define _XOPEN_SOURCE_EXTENDED 1
#endif

to read:

#if !defined(__APPLE__) && !defined(__OpenBSD__) && !defined(__AIX__)
#       define _XOPEN_SOURCE 500
#       define _XOPEN_SOURCE_EXTENDED 1
#       define _POSIX_C_SOURCE 200112L
#endif

You'll get three redefinition warnings, but oh well. Before submitting a pull request, it would be good to test this more widely and also solicit a review as to if this is the best solution (or even a good solution).

Also note, on CentOS 6.8, you will need to install or build your own version of fontconfig >= 2.11. I built 2.11 from source, (with the configure option --disable-docs) and installed it into /usr/local. I added the following to $PLAN9/LOCAL.config:

CFLAGS="-I/usr/local/include"
LDFLAGS="-L/usr/local/lib"