adamdruppe / arsd

This is a collection of modules that I've released over the years. Most of them stand alone, or have just one or two dependencies in here, so you don't have to download this whole repo.
http://arsd-official.dpldocs.info/arsd.html
531 stars 125 forks source link

Build issue with cgi.d with LDC 1.28.1 on Alpine #347

Closed abraunegg closed 1 year ago

abraunegg commented 1 year ago

Due to an issue identified with dmd-2.101.0 which was raised to me here https://github.com/abraunegg/onedrive/discussions/2218 I updated the cgi.d file to your latest version and this resolved the build error using DMD.

However, when building using LDC using GitHub actions and LDC 1.28.1 on Alpine, the following is being thrown:

#19 [linux/amd64 builder-onedrive 5/5] RUN autoreconf -fiv  && ./configure  && make clean  && make  && make install
#0 0.143 autoreconf: export WARNINGS=
#0 0.145 autoreconf: Entering directory '.'
#0 0.146 autoreconf: configure.ac: not using Gettext
#0 1.147 autoreconf: running: aclocal --force 
#0 1.613 autoreconf: configure.ac: tracing
#0 1.856 autoreconf: configure.ac: not using Libtool
#0 1.858 autoreconf: configure.ac: not using Intltool
#0 1.858 autoreconf: configure.ac: not using Gtkdoc
#0 1.859 autoreconf: running: /usr/bin/autoconf --force
#0 2.108 autoreconf: configure.ac: not using Autoheader
#0 2.109 autoreconf: configure.ac: not using Automake
#0 2.111 autoreconf: './install-sh' is updated
#0 2.111 autoreconf: Leaving directory '.'
#0 2.150 checking for a BSD-compatible install... /usr/bin/install -c
#0 2.389 checking for pkg-config... /usr/bin/pkg-config
#0 2.389 checking pkg-config is at least version 0.9.0... yes
#0 2.391 checking for dmd... no
#0 2.391 checking for ldmd2... ldmd2
#0 2.393 checking version of D compiler... 1.28.1
#0 2.461 checking for curl... yes
#0 2.465 checking for sqlite... yes
#0 2.486 configure: creating ./config.status
#0 2.524 config.status: creating Makefile
#0 2.533 config.status: creating contrib/pacman/PKGBUILD
#0 2.544 config.status: creating contrib/spec/onedrive.spec
#0 2.554 config.status: creating onedrive.1
#0 2.567 config.status: creating contrib/systemd/onedrive.service
#0 2.578 config.status: creating contrib/systemd/onedrive@.service
#0 2.600 rm -f onedrive onedrive.o version
#0 2.600 rm -rf autom4te.cache
#0 2.601 rm -f config.log config.status
#0 2.609 if [ -f .git/HEAD ] ; then \
#0 2.609    git describe --tags > version ; \
#0 2.609 else \
#0 2.609    echo v2.4.22-dev > version ; \
#0 2.609 fi
#0 2.618 ldmd2 -w -g -O -J. -L-lcurl -L-lsqlite3  -L-ldl src/config.d src/itemdb.d src/log.d src/main.d src/monitor.d src/onedrive.d src/qxor.d src/selective.d src/sqlite.d src/sync.d src/upload.d src/util.d src/progress.d src/arsd/cgi.d -ofonedrive
#0 6.[410](https://github.com/abraunegg/onedrive/actions/runs/3473275587/jobs/5805111455#step:8:413) src/arsd/cgi.d(3763): Error: undefined identifier `unistd` in package `core.sys.posix`, perhaps add `static import core.sys.posix.unistd;`
#0 6.[421](https://github.com/abraunegg/onedrive/actions/runs/3473275587/jobs/5805111455#step:8:424) src/arsd/cgi.d(5337): Error: undefined identifier `fork`
#0 6.487 make: *** [Makefile:102: onedrive] Error 1
#19 ERROR: process "/bin/sh -c autoreconf -fiv  && ./configure  && make clean  && make  && make install" did not complete successfully: exit code: 2

#15 [linux/arm64 builder-onedrive 2/5] RUN apk add --update --no-cache alpine-sdk gnupg xz curl-dev sqlite-dev binutils-gold autoconf automake ldc
#15 CANCELED
------
 > [linux/amd64 builder-onedrive 5/5] RUN autoreconf -fiv  && ./configure  && make clean  && make  && make install:
#0 2.601 rm -f config.log config.status
#0 2.609 if [ -f .git/HEAD ] ; then \
#0 2.609    git describe --tags > version ; \
#0 2.609 else \
#0 2.609    echo v2.4.22-dev > version ; \
#0 2.609 fi
#0 2.618 ldmd2 -w -g -O -J. -L-lcurl -L-lsqlite3  -L-ldl src/config.d src/itemdb.d src/log.d src/main.d src/monitor.d src/onedrive.d src/qxor.d src/selective.d src/sqlite.d src/sync.d src/upload.d src/util.d src/progress.d src/arsd/cgi.d -ofonedrive
#0 6.410 src/arsd/cgi.d(3763): Error: undefined identifier `unistd` in package `core.sys.posix`, perhaps add `static import core.sys.posix.unistd;`
#0 6.421 src/arsd/cgi.d(5337): Error: undefined identifier `fork`
#0 6.487 make: *** [Makefile:102: onedrive] Error 1

I tried to replicate using Fedora and unable to do so - the build using LDC 1.28.1 works without issue ...

(ldc-1.28.1)[alex@onedrive-client-dev onedrive]$ ./configure
checking for a BSD-compatible install... /usr/bin/install -c
checking for pkg-config... /usr/bin/pkg-config
checking pkg-config is at least version 0.9.0... yes
checking for dmd... ldc2
checking version of D compiler... 1.28.1
checking for curl... yes
checking for sqlite... yes
configure: creating ./config.status
config.status: creating Makefile
config.status: creating contrib/pacman/PKGBUILD
config.status: creating contrib/spec/onedrive.spec
config.status: creating onedrive.1
config.status: creating contrib/systemd/onedrive.service
config.status: creating contrib/systemd/onedrive@.service
(ldc-1.28.1)[alex@onedrive-client-dev onedrive]$ make clean; make;
rm -f onedrive onedrive.o version
rm -rf autom4te.cache
rm -f config.log config.status
if [ -f .git/HEAD ] ; then \
        git describe --tags > version ; \
else \
        echo v2.4.22-dev > version ; \
fi
ldc2 -w -g -O -J. -L-lcurl -L-lsqlite3  -L-ldl src/config.d src/itemdb.d src/log.d src/main.d src/monitor.d src/onedrive.d src/qxor.d src/selective.d src/sqlite.d src/sync.d src/upload.d src/util.d src/progress.d src/arsd/cgi.d -ofonedrive
(ldc-1.28.1)[alex@onedrive-client-dev onedrive]$ 

Any suggestions?

GitHub Actions Build Log: https://github.com/abraunegg/onedrive/actions/runs/3473275587/jobs/5805111455

adamdruppe commented 1 year ago

Quite possible it is an import that is version guarded and that version guard changed in the new compiler. I'll take a look at it shortly, still have to do day job for a couple more hours.

adamdruppe commented 1 year ago

actually does Alpine use Musl as the libc? that might be it, i have a version block

        version(CRuntime_Musl) {} else {
                import core.sys.posix.unistd;

(line 6685 in my copy but ive been editing a lot of docs so it might not line up anymore with the git version)

and that posixspawn probably should be versioned out but the unistd ought to work either way.

maybe the compiler got stricter about imports in the new version.

might suggest changing that to

version(Posix) {
                import core.sys.posix.unistd; // do this in all posix versions
        version(CRuntime_Musl) {} else {
             // it used to be here
                private extern(C) int posix_spawn(pid_t*, const char*, void*,
                void*, const char**, const char**);
        }
}

and it might fix it for you.

adamdruppe commented 1 year ago

yeah that was it. added to my test script now too so i won't miss this kind of thing again:

https://github.com/adamdruppe/arsd/commit/5ac21ebb922fb7e65323fde9f7c952f9307e3f5c

sorry for the inconvenience, this was my mistake!

abraunegg commented 1 year ago

@adamdruppe

yeah that was it. added to my test script now too so i won't miss this kind of thing again

All good :) Currently testing your proposed fix above (https://github.com/abraunegg/onedrive/pull/2220) and the Alpine build was successful - so looks good - https://github.com/abraunegg/onedrive/actions/runs/3473965331/jobs/5806591180

adamdruppe commented 1 year ago

Well, I see it passed the test so I'll go ahead and close this now. But let me know if something else comes up and we'll take care of it then. Thanks for the report.