dub icon indicating copy to clipboard operation
dub copied to clipboard

Build fails with gdc 13.x

Open ximion opened this issue 2 years ago • 36 comments

System information

  • dub version: 1.30 & master
  • OS Platform and distribution: Linux (Debian)
  • compiler version gdc 12.2.0

Bug Description

When trying to compile dub using GDC, the build fails while the previous 1.29 version built fine. Error message:

Command `["gdmd", "-of/tmp/dub/bin/dub", "-I/tmp/dub/source", "-version=DubUseCurl", "-version=DubApplication", "-g", "-O", "-w", "@build-files.txt"]` failed, output was:
Serializing composite type Flags!(BuildRequirement) which has no serializable fields
Serializing composite type Flags!(BuildOption) which has no serializable fields
source/dub/internal/dyaml/stdsumtype.d:2053:13: error: static assert:  "`handlers[0]` of type `template` never matches"
 2053 |             static assert(matches[].canFind(hid),
      |             ^
source/dub/internal/dyaml/stdsumtype.d:1717:52: note: instantiated from here: ‘matchImpl!(const(SumType!(NativePath, Version)))’
 1717 |         return matchImpl!(Yes.exhaustive, handlers)(args);
      |                                                    ^
source/dub/commandline.d:2319:43: note: instantiated from here: ‘match!(const(SumType!(NativePath, Version)))’
 2319 |                                 ovr.target.match!(
      |                                           ^

How to reproduce?

Try to build dub using gdc

Expected Behavior

Either the build succeeds as it did before, or dub emits a message that the compiler/version is unsupported for building dub.

ximion avatar Feb 01 '23 17:02 ximion

https://github.com/dlang/dub/pull/2548 for WIP changes, but was needing a GDC update.

Your error message looks like the match there doesn't use const properly.

WebFreak001 avatar Feb 01 '23 18:02 WebFreak001

Bad commit 8a25429f80cd7b6e1e34504b39f9219537fc5320

ibuclaw avatar Feb 01 '23 18:02 ibuclaw

If there was a (even temporary) fix available soonish, we could still get dub 1.30 into the next Debian release. Otherwise this will need a freeze exception, and even though it's a low popularity package, it technically also is a toolchain package which means it's not guaranteed to get that exception (switching to LDC would mean loosing architecture support, which comes with its own administrative issues).

ximion avatar Feb 01 '23 18:02 ximion

building master seems to work on my machine with gdc (GCC) 12.2.1 20230111

WebFreak001 avatar Feb 01 '23 20:02 WebFreak001

It fails here with the same error, using gdc (Debian 12.2.0-14) 12.2.0 - did the .1 patch release change anything maybe?

ximion avatar Feb 01 '23 20:02 ximion

building master seems to work on my machine with gdc (GCC) 12.2.1 20230111

You need to build with -Werror to see the message.

ibuclaw avatar Feb 01 '23 20:02 ibuclaw

invocation:

gdc -o /home/webfreak/.dub/cache/dub/1.27.0+commit.469.g06347027/build/application-debug-linux.posix-x86_64-gdc_v12.2.1-BF7153F2B14FBD99D3D27B7E78C530C9EBE7EF34F2463B70B875A011BEDBF6BE/dub -fdebug -g -Werror -Wall -fversion=DubUseCurl -fversion=DubApplication -fversion=Have_dub -Isource/ source/app.d source/dub/commandline.d source/dub/compilers/buildsettings.d source/dub/compilers/compiler.d source/dub/compilers/dmd.d source/dub/compilers/gdc.d source/dub/compilers/ldc.d source/dub/compilers/utils.d source/dub/data/settings.d source/dub/dependency.d source/dub/dependencyresolver.d source/dub/description.d source/dub/dub.d source/dub/generators/build.d source/dub/generators/cmake.d source/dub/generators/generator.d source/dub/generators/sublimetext.d source/dub/generators/targetdescription.d source/dub/generators/visuald.d source/dub/init.d source/dub/internal/colorize/colors.d source/dub/internal/colorize/cwrite.d source/dub/internal/colorize/package.d source/dub/internal/colorize/winterm.d source/dub/internal/configy/Attributes.d source/dub/internal/configy/DubTest.d source/dub/internal/configy/Exceptions.d source/dub/internal/configy/FieldRef.d source/dub/internal/configy/Read.d source/dub/internal/configy/Test.d source/dub/internal/configy/Utils.d source/dub/internal/dyaml/composer.d source/dub/internal/dyaml/constructor.d source/dub/internal/dyaml/dumper.d source/dub/internal/dyaml/emitter.d source/dub/internal/dyaml/encoding.d source/dub/internal/dyaml/escapes.d source/dub/internal/dyaml/event.d source/dub/internal/dyaml/exception.d source/dub/internal/dyaml/linebreak.d source/dub/internal/dyaml/loader.d source/dub/internal/dyaml/node.d source/dub/internal/dyaml/package.d source/dub/internal/dyaml/parser.d source/dub/internal/dyaml/queue.d source/dub/internal/dyaml/reader.d source/dub/internal/dyaml/representer.d source/dub/internal/dyaml/resolver.d source/dub/internal/dyaml/scanner.d source/dub/internal/dyaml/serializer.d source/dub/internal/dyaml/stdsumtype.d source/dub/internal/dyaml/style.d source/dub/internal/dyaml/tagdirective.d source/dub/internal/dyaml/token.d source/dub/internal/git.d source/dub/internal/libInputVisitor.d source/dub/internal/logging.d source/dub/internal/sdlang/ast.d source/dub/internal/sdlang/exception.d source/dub/internal/sdlang/lexer.d source/dub/internal/sdlang/package.d source/dub/internal/sdlang/parser.d source/dub/internal/sdlang/symbol.d source/dub/internal/sdlang/token.d source/dub/internal/sdlang/util.d source/dub/internal/tinyendian.d source/dub/internal/undead/xml.d source/dub/internal/utils.d source/dub/internal/vibecompat/core/file.d source/dub/internal/vibecompat/data/json.d source/dub/internal/vibecompat/data/serialization.d source/dub/internal/vibecompat/data/utils.d source/dub/internal/vibecompat/inet/path.d source/dub/internal/vibecompat/inet/url.d source/dub/package_.d source/dub/packagemanager.d source/dub/packagesupplier.d source/dub/packagesuppliers/fallback.d source/dub/packagesuppliers/filesystem.d source/dub/packagesuppliers/maven.d source/dub/packagesuppliers/package.d source/dub/packagesuppliers/packagesupplier.d source/dub/packagesuppliers/registry.d source/dub/platform.d source/dub/project.d source/dub/recipe/io.d source/dub/recipe/json.d source/dub/recipe/packagerecipe.d source/dub/recipe/sdl.d source/dub/recipe/selection.d source/dub/semver.d source/dub/version_.d

WebFreak001 avatar Feb 01 '23 21:02 WebFreak001

building master seems to work on my machine with gdc (GCC) 12.2.1 20230111

You need to build with -Werror to see the message.

Indeed! Removing the -w compile flag "fixes" this error.

ximion avatar Feb 01 '23 21:02 ximion

on alpine with GDC 12.2.1 the build seems to "work", but gets a linker error at the end:

https://github.com/dlang/dub/actions/runs/4068606217/jobs/7007362399

WebFreak001 avatar Feb 01 '23 21:02 WebFreak001

invocation:

gdc -o /home/webfreak/.dub/cache/dub/1.27.0+commit.469.g06347027/build/application-debug-linux.posix-x86_64-gdc_v12.2.1-BF7153F2B14FBD99D3D27B7E78C530C9EBE7EF34F2463B70B875A011BEDBF6BE/dub -fdebug -g -Werror -Wall -fversion=DubUseCurl -fversion=DubApplication -fversion=Have_dub -Isource/ source/app.d source/dub/commandline.d source/dub/compilers/buildsettings.d source/dub/compilers/compiler.d source/dub/compilers/dmd.d source/dub/compilers/gdc.d source/dub/compilers/ldc.d source/dub/compilers/utils.d source/dub/data/settings.d source/dub/dependency.d source/dub/dependencyresolver.d source/dub/description.d source/dub/dub.d source/dub/generators/build.d source/dub/generators/cmake.d source/dub/generators/generator.d source/dub/generators/sublimetext.d source/dub/generators/targetdescription.d source/dub/generators/visuald.d source/dub/init.d source/dub/internal/colorize/colors.d source/dub/internal/colorize/cwrite.d source/dub/internal/colorize/package.d source/dub/internal/colorize/winterm.d source/dub/internal/configy/Attributes.d source/dub/internal/configy/DubTest.d source/dub/internal/configy/Exceptions.d source/dub/internal/configy/FieldRef.d source/dub/internal/configy/Read.d source/dub/internal/configy/Test.d source/dub/internal/configy/Utils.d source/dub/internal/dyaml/composer.d source/dub/internal/dyaml/constructor.d source/dub/internal/dyaml/dumper.d source/dub/internal/dyaml/emitter.d source/dub/internal/dyaml/encoding.d source/dub/internal/dyaml/escapes.d source/dub/internal/dyaml/event.d source/dub/internal/dyaml/exception.d source/dub/internal/dyaml/linebreak.d source/dub/internal/dyaml/loader.d source/dub/internal/dyaml/node.d source/dub/internal/dyaml/package.d source/dub/internal/dyaml/parser.d source/dub/internal/dyaml/queue.d source/dub/internal/dyaml/reader.d source/dub/internal/dyaml/representer.d source/dub/internal/dyaml/resolver.d source/dub/internal/dyaml/scanner.d source/dub/internal/dyaml/serializer.d source/dub/internal/dyaml/stdsumtype.d source/dub/internal/dyaml/style.d source/dub/internal/dyaml/tagdirective.d source/dub/internal/dyaml/token.d source/dub/internal/git.d source/dub/internal/libInputVisitor.d source/dub/internal/logging.d source/dub/internal/sdlang/ast.d source/dub/internal/sdlang/exception.d source/dub/internal/sdlang/lexer.d source/dub/internal/sdlang/package.d source/dub/internal/sdlang/parser.d source/dub/internal/sdlang/symbol.d source/dub/internal/sdlang/token.d source/dub/internal/sdlang/util.d source/dub/internal/tinyendian.d source/dub/internal/undead/xml.d source/dub/internal/utils.d source/dub/internal/vibecompat/core/file.d source/dub/internal/vibecompat/data/json.d source/dub/internal/vibecompat/data/serialization.d source/dub/internal/vibecompat/data/utils.d source/dub/internal/vibecompat/inet/path.d source/dub/internal/vibecompat/inet/url.d source/dub/package_.d source/dub/packagemanager.d source/dub/packagesupplier.d source/dub/packagesuppliers/fallback.d source/dub/packagesuppliers/filesystem.d source/dub/packagesuppliers/maven.d source/dub/packagesuppliers/package.d source/dub/packagesuppliers/packagesupplier.d source/dub/packagesuppliers/registry.d source/dub/platform.d source/dub/project.d source/dub/recipe/io.d source/dub/recipe/json.d source/dub/recipe/packagerecipe.d source/dub/recipe/sdl.d source/dub/recipe/selection.d source/dub/semver.d source/dub/version_.d

Ah! I was building dub using the build.d script - after removing -w, it builds and links fine.

ximion avatar Feb 01 '23 21:02 ximion

ah I got the invocation from dub build --compiler=gdc -v

WebFreak001 avatar Feb 01 '23 21:02 WebFreak001

Weird that linking fails on Alpine, but Alpine also is a quite different environment compared to traditional GNU/Linux... At Debian we prefer using the build.d script so we don't have a recursive dependency on the older version of dub and bootstrapping is easier (also, dub is a pain to use in packaging, but it's getting better! Which is why 1.30 would be neat to have in Debian 12)

ximion avatar Feb 01 '23 21:02 ximion

@WebFreak001

on alpine with GDC 12.2.1 the build seems to "work", but gets a linker error at the end

Well, I have to correct myself saying that this works on Debian... Dub itself links fine, but dub compiling another program then fails:

make[1]: Entering directory '/srv/build/dub-1.30.0'
gdmd -run /srv/build/dub-1.30.0/build.d \
        -g -O -wi -release
Wrote version_.d` file with version: 1.30.0-1
Building dub using gdmd (dflags: ["-g", "-O", "-wi", "-release", "-frelease"]), this may take a while...
DUB has been built as: /srv/build/dub-1.30.0/bin/dub
You may want to run `sudo ln -s /srv/build/dub-1.30.0/bin/dub /usr/local/bin` now
# create manual pages
cd /srv/build/dub-1.30.0/bin/ && ./dub /srv/build/dub-1.30.0/scripts/man/gen_man.d
Serializing composite type Flags!(BuildRequirement) which has no serializable fields
Serializing composite type Flags!(BuildOption) which has no serializable fields
/usr/bin/ld: /tmp/ccmwKCWi.o: in function `_D3std6format8internal5write__T8getWidthTAyaZQoFNaNfQlZl':
gen_man.d:(.text+0x6d76): undefined reference to `_D3std9algorithm9searching__T3allSQBg6format8internal5write__T8getWidthTAyaZQoFQhZ9__lambda2Z__TQCpTQBcZQCxMFNaNfQBpZb'
/usr/bin/ld: /tmp/ccmwKCWi.o: in function `_D3std6format8internal5write__T8getWidthTAaZQnFNaNfQkZl':
gen_man.d:(.text+0x72ed): undefined reference to `_D3std9algorithm9searching__T3allSQBg6format8internal5write__T8getWidthTAaZQnFQgZ9__lambda2Z__TQCoTQBbZQCwMFNaNfQBoZb'
/usr/bin/ld: /tmp/ccmwKCWi.o: in function `_D3std6format8internal5write__T8getWidthTAwZQnFNaNbNiNfQoZl':
gen_man.d:(.text+0x74e0): undefined reference to `_D3std9algorithm9searching__T3allSQBg6format8internal5write__T8getWidthTAwZQnFQgZ9__lambda2Z__TQCoTQBbZQCwMFNaNbNiNfQBsZb'
/usr/bin/ld: /tmp/.dub/build/dub-~master/library-$DFLAGS-linux.posix-x86_64-gdc_v12.2.0-14391039E1E7EBE8123AD291C9AC30F7763605C96DA5F891D0EE281DA46E40CD/libdub.a: in function `_D3std6format8internal5write__T15formatValueImplTSQBw5array__T8AppenderTAyaZQoTeTaZQCaFNaNfKQBrxeMKxSQDvQDu4spec__T10FormatSpecTaZQpZv':
Attributes.d:(.text+0x9536c): undefined reference to `_D3std6format8internal5write__T15formatValueImplTSQBw5array__T8AppenderTAyaZQoTeTaZQCaFKQBnxeMKxSQDrQDq4spec__T10FormatSpecTaZQpZ__T9__lambda6TeZQnFNaNbNiNeKeZAxa'
collect2: error: ld returned 1 exit status
Error gdc failed with exit code 1.

Flags used:

LDFLAGS='-Wl,-z,relro'
DFLAGS='-frelease'

CFLAGS='-g -O2 -ffile-prefix-map=/srv/build/dub-1.30.0=. -fstack-protector-strong -Wformat -Werror=format-security'

ximion avatar Feb 01 '23 23:02 ximion

Trying to use dub 1.31 to build the manual pages yields even more linker errors:

cd /srv/build/dub-1.31.0/bin/ && ./dub /srv/build/dub-1.31.0/scripts/man/gen_man.d

Serializing composite type Flags!(BuildRequirement) which has no serializable fields
Serializing composite type Flags!(BuildOption) which has no serializable fields
/usr/bin/ld: /tmp/ccncQhRw.o: in function `_D3std6format8internal5write__T8getWidthTAyaZQoFNaNfQlZl':
gen_man.d:(.text+0x6d76): undefined reference to `_D3std9algorithm9searching__T3allSQBg6format8internal5write__T8getWidthTAyaZQoFQhZ9__lambda2Z__TQCpTQBcZQCxMFNaNfQBpZb'
/usr/bin/ld: /tmp/ccncQhRw.o: in function `_D3std6format8internal5write__T8getWidthTAaZQnFNaNfQkZl':
gen_man.d:(.text+0x72ed): undefined reference to `_D3std9algorithm9searching__T3allSQBg6format8internal5write__T8getWidthTAaZQnFQgZ9__lambda2Z__TQCoTQBbZQCwMFNaNfQBoZb'
/usr/bin/ld: /tmp/ccncQhRw.o: in function `_D3std6format8internal5write__T8getWidthTAwZQnFNaNbNiNfQoZl':
gen_man.d:(.text+0x74e0): undefined reference to `_D3std9algorithm9searching__T3allSQBg6format8internal5write__T8getWidthTAwZQnFQgZ9__lambda2Z__TQCoTQBbZQCwMFNaNbNiNfQBsZb'
/usr/bin/ld: /tmp/.dub/build/dub-~master/library-$DFLAGS-linux.posix-x86_64-gdc_v12.2.0-EF73A06517126EA137612C896E3528F5C82DA77AA2D4C1F06844C8F055492695/libdub.a: in function `_D3std6format8internal5write__T15formatValueImplTSQBw5array__T8AppenderTAyaZQoTeTaZQCaFNaNfKQBrxeMKxSQDvQDu4spec__T10FormatSpecTaZQpZv':
commandline.d:(.text+0x83d66): undefined reference to `_D3std6format8internal5write__T15formatValueImplTSQBw5array__T8AppenderTAyaZQoTeTaZQCaFKQBnxeMKxSQDrQDq4spec__T10FormatSpecTaZQpZ__T9__lambda6TeZQnFNaNbNiNeKeZAxa'
/usr/bin/ld: /tmp/.dub/build/dub-~master/library-$DFLAGS-linux.posix-x86_64-gdc_v12.2.0-EF73A06517126EA137612C896E3528F5C82DA77AA2D4C1F06844C8F055492695/libdub.a: in function `_D3std9algorithm10comparison__T8mismatchSQBn4path__T14asRelativePathVEQCqQBd13CaseSensitivei1TAyaTQeZQBxFQlQnZ9__lambda6TSQEqQDd__T12pathSplitterTQCaZQtFQChZ12PathSplitterTQBzZQFpMFNaNbNiNfQCqQCtZSQHn8typecons__T5TupleTQDuTQDyZQp':
commandline.d:(.text+0x2a6289): undefined reference to `_D3std4path__T14asRelativePathVEQBeQBd13CaseSensitivei1TAyaTQeZQBxFQlQnZ__T9__lambda6TQBeTQBiZQtFNaNbNiNfQBxQCaZb'
/usr/bin/ld: /tmp/.dub/build/dub-~master/library-$DFLAGS-linux.posix-x86_64-gdc_v12.2.0-EF73A06517126EA137612C896E3528F5C82DA77AA2D4C1F06844C8F055492695/libdub.a: in function `_D3std5range__T12ChooseResultTSQBd3utf__T10byCodeUnitTAyaZQrFQhZ14ByCodeUnitImplTSQDcQDb__T5chainTSQDt9algorithm9iteration__T6joinerTSQFcQFb__T4TakeTSQFsQFr__T6RepeatTQFhZQmZQBfTQFsZQCfFQCbQGdZ6ResultTQGpTSQHwQGt__T5byUTFTaVEQIp8typecons__T4FlagVQHka19_7573655265706c6163656d656e744463686172ZQCai1Z__TQDiTSQLsQHzQHs__TQHlTSQMj4path__T12pathSplitterTQLjZQtFQLqZ12PathSplitterTQNhZQJuFQCjQNsZQHpZQGxFNcQDrZQIdZQMfFQMcQOvQIfZQIvZQPv__T11actOnChosenSQRcQRb__TQQyTQQnTQOsZQRk5emptyMFNdZ9__lambda1ZQCiFNaNbNiNfKSQTkQTj__TQTgTQSvTQRaZQTsZb':
commandline.d:(.text+0x2ae6cc): undefined reference to `_D3std5range__T12ChooseResultTSQBd3utf__T10byCodeUnitTAyaZQrFQhZ14ByCodeUnitImplTSQDcQDb__T5chainTSQDt9algorithm9iteration__T6joinerTSQFcQFb__T4TakeTSQFsQFr__T6RepeatTQFhZQmZQBfTQFsZQCfFQCbQGdZ6ResultTQGpTSQHwQGt__T5byUTFTaVEQIp8typecons__T4FlagVQHka19_7573655265706c6163656d656e744463686172ZQCai1Z__TQDiTSQLsQHzQHs__TQHlTSQMj4path__T12pathSplitterTQLjZQtFQLqZ12PathSplitterTQNhZQJuFQCjQNsZQHpZQGxFNcQDrZQIdZQMfFQMcQOvQIfZQIvZQPv5emptyMFNdZ__T9__lambda1TQQiZQpFNaNbNiNfQQxZb'
/usr/bin/ld: commandline.d:(.text+0x2ae715): undefined reference to `_D3std5range__T12ChooseResultTSQBd3utf__T10byCodeUnitTAyaZQrFQhZ14ByCodeUnitImplTSQDcQDb__T5chainTSQDt9algorithm9iteration__T6joinerTSQFcQFb__T4TakeTSQFsQFr__T6RepeatTQFhZQmZQBfTQFsZQCfFQCbQGdZ6ResultTQGpTSQHwQGt__T5byUTFTaVEQIp8typecons__T4FlagVQHka19_7573655265706c6163656d656e744463686172ZQCai1Z__TQDiTSQLsQHzQHs__TQHlTSQMj4path__T12pathSplitterTQLjZQtFQLqZ12PathSplitterTQNhZQJuFQCjQNsZQHpZQGxFNcQDrZQIdZQMfFQMcQOvQIfZQIvZQPv5emptyMFNdZ__T9__lambda1TQOjZQpFNaNbNiNfQOyZb'
/usr/bin/ld: /tmp/.dub/build/dub-~master/library-$DFLAGS-linux.posix-x86_64-gdc_v12.2.0-EF73A06517126EA137612C896E3528F5C82DA77AA2D4C1F06844C8F055492695/libdub.a: in function `_D3std5range__T12ChooseResultTSQBd3utf__T10byCodeUnitTAyaZQrFQhZ14ByCodeUnitImplTSQDcQDb__T5chainTSQDt9algorithm9iteration__T6joinerTSQFcQFb__T4TakeTSQFsQFr__T6RepeatTQFhZQmZQBfTQFsZQCfFQCbQGdZ6ResultTQGpTSQHwQGt__T5byUTFTaVEQIp8typecons__T4FlagVQHka19_7573655265706c6163656d656e744463686172ZQCai1Z__TQDiTSQLsQHzQHs__TQHlTSQMj4path__T12pathSplitterTQLjZQtFQLqZ12PathSplitterTQNhZQJuFQCjQNsZQHpZQGxFNcQDrZQIdZQMfFQMcQOvQIfZQIvZQPv__T11actOnChosenSQRcQRb__TQQyTQQnTQOsZQRk8popFrontMFZ9__lambda1ZQCjFNaNfKSQThQTg__TQTdTQSsTQQxZQTpZv':
commandline.d:(.text+0x2ae808): undefined reference to `_D3std5range__T12ChooseResultTSQBd3utf__T10byCodeUnitTAyaZQrFQhZ14ByCodeUnitImplTSQDcQDb__T5chainTSQDt9algorithm9iteration__T6joinerTSQFcQFb__T4TakeTSQFsQFr__T6RepeatTQFhZQmZQBfTQFsZQCfFQCbQGdZ6ResultTQGpTSQHwQGt__T5byUTFTaVEQIp8typecons__T4FlagVQHka19_7573655265706c6163656d656e744463686172ZQCai1Z__TQDiTSQLsQHzQHs__TQHlTSQMj4path__T12pathSplitterTQLjZQtFQLqZ12PathSplitterTQNhZQJuFQCjQNsZQHpZQGxFNcQDrZQIdZQMfFQMcQOvQIfZQIvZQPv8popFrontMFZ__T9__lambda1TQQjZQpFNaNbNiNfKQQzZv'
/usr/bin/ld: commandline.d:(.text+0x2ae823): undefined reference to `_D3std5range__T12ChooseResultTSQBd3utf__T10byCodeUnitTAyaZQrFQhZ14ByCodeUnitImplTSQDcQDb__T5chainTSQDt9algorithm9iteration__T6joinerTSQFcQFb__T4TakeTSQFsQFr__T6RepeatTQFhZQmZQBfTQFsZQCfFQCbQGdZ6ResultTQGpTSQHwQGt__T5byUTFTaVEQIp8typecons__T4FlagVQHka19_7573655265706c6163656d656e744463686172ZQCai1Z__TQDiTSQLsQHzQHs__TQHlTSQMj4path__T12pathSplitterTQLjZQtFQLqZ12PathSplitterTQNhZQJuFQCjQNsZQHpZQGxFNcQDrZQIdZQMfFQMcQOvQIfZQIvZQPv8popFrontMFZ__T9__lambda1TQOkZQpFNaNfKQOwZv'
/usr/bin/ld: /tmp/.dub/build/dub-~master/library-$DFLAGS-linux.posix-x86_64-gdc_v12.2.0-EF73A06517126EA137612C896E3528F5C82DA77AA2D4C1F06844C8F055492695/libdub.a: in function `_D3std5range__T12ChooseResultTSQBd3utf__T10byCodeUnitTAyaZQrFQhZ14ByCodeUnitImplTSQDcQDb__T5chainTSQDt9algorithm9iteration__T6joinerTSQFcQFb__T4TakeTSQFsQFr__T6RepeatTQFhZQmZQBfTQFsZQCfFQCbQGdZ6ResultTQGpTSQHwQGt__T5byUTFTaVEQIp8typecons__T4FlagVQHka19_7573655265706c6163656d656e744463686172ZQCai1Z__TQDiTSQLsQHzQHs__TQHlTSQMj4path__T12pathSplitterTQLjZQtFQLqZ12PathSplitterTQNhZQJuFQCjQNsZQHpZQGxFNcQDrZQIdZQMfFQMcQOvQIfZQIvZQPv__T11actOnChosenSQRcQRb__TQQyTQQnTQOsZQRk9moveFrontMFZ9__lambda1ZQCkFNaNfKSQTiQTh__TQTeTQStTQQyZQTqZya':
commandline.d:(.text+0x2aea9d): undefined reference to `_D3std5range__T12ChooseResultTSQBd3utf__T10byCodeUnitTAyaZQrFQhZ14ByCodeUnitImplTSQDcQDb__T5chainTSQDt9algorithm9iteration__T6joinerTSQFcQFb__T4TakeTSQFsQFr__T6RepeatTQFhZQmZQBfTQFsZQCfFQCbQGdZ6ResultTQGpTSQHwQGt__T5byUTFTaVEQIp8typecons__T4FlagVQHka19_7573655265706c6163656d656e744463686172ZQCai1Z__TQDiTSQLsQHzQHs__TQHlTSQMj4path__T12pathSplitterTQLjZQtFQLqZ12PathSplitterTQNhZQJuFQCjQNsZQHpZQGxFNcQDrZQIdZQMfFQMcQOvQIfZQIvZQPv9moveFrontMFZ__T9__lambda1TQQkZQpFNaNbNiNfKQRaZya'
/usr/bin/ld: commandline.d:(.text+0x2aeab8): undefined reference to `_D3std5range__T12ChooseResultTSQBd3utf__T10byCodeUnitTAyaZQrFQhZ14ByCodeUnitImplTSQDcQDb__T5chainTSQDt9algorithm9iteration__T6joinerTSQFcQFb__T4TakeTSQFsQFr__T6RepeatTQFhZQmZQBfTQFsZQCfFQCbQGdZ6ResultTQGpTSQHwQGt__T5byUTFTaVEQIp8typecons__T4FlagVQHka19_7573655265706c6163656d656e744463686172ZQCai1Z__TQDiTSQLsQHzQHs__TQHlTSQMj4path__T12pathSplitterTQLjZQtFQLqZ12PathSplitterTQNhZQJuFQCjQNsZQHpZQGxFNcQDrZQIdZQMfFQMcQOvQIfZQIvZQPv9moveFrontMFZ__T9__lambda1TQOlZQpFNaNfKQOxZxa'
/usr/bin/ld: /tmp/.dub/build/dub-~master/library-$DFLAGS-linux.posix-x86_64-gdc_v12.2.0-EF73A06517126EA137612C896E3528F5C82DA77AA2D4C1F06844C8F055492695/libdub.a: in function `_D3std5range__T12ChooseResultTSQBd3utf__T10byCodeUnitTAyaZQrFQhZ14ByCodeUnitImplTSQDcQDb__T5chainTSQDt9algorithm9iteration__T6joinerTSQFcQFb__T4TakeTSQFsQFr__T6RepeatTQFhZQmZQBfTQFsZQCfFQCbQGdZ6ResultTQGpTSQHwQGt__T5byUTFTaVEQIp8typecons__T4FlagVQHka19_7573655265706c6163656d656e744463686172ZQCai1Z__TQDiTSQLsQHzQHs__TQHlTSQMj4path__T12pathSplitterTQLjZQtFQLqZ12PathSplitterTQNhZQJuFQCjQNsZQHpZQGxFNcQDrZQIdZQMfFQMcQOvQIfZQIvZQPv__T11actOnChosenSQRcQRb__TQQyTQQnTQOsZQRk7popBackMFZ9__lambda1ZQCiFNaNfKSQTgQTf__TQTcTQSrTQQwZQToZv':
commandline.d:(.text+0x2aeb92): undefined reference to `_D3std5range__T12ChooseResultTSQBd3utf__T10byCodeUnitTAyaZQrFQhZ14ByCodeUnitImplTSQDcQDb__T5chainTSQDt9algorithm9iteration__T6joinerTSQFcQFb__T4TakeTSQFsQFr__T6RepeatTQFhZQmZQBfTQFsZQCfFQCbQGdZ6ResultTQGpTSQHwQGt__T5byUTFTaVEQIp8typecons__T4FlagVQHka19_7573655265706c6163656d656e744463686172ZQCai1Z__TQDiTSQLsQHzQHs__TQHlTSQMj4path__T12pathSplitterTQLjZQtFQLqZ12PathSplitterTQNhZQJuFQCjQNsZQHpZQGxFNcQDrZQIdZQMfFQMcQOvQIfZQIvZQPv7popBackMFZ__T9__lambda1TQQiZQpFNaNbNiNfKQQyZv'
/usr/bin/ld: commandline.d:(.text+0x2aebad): undefined reference to `_D3std5range__T12ChooseResultTSQBd3utf__T10byCodeUnitTAyaZQrFQhZ14ByCodeUnitImplTSQDcQDb__T5chainTSQDt9algorithm9iteration__T6joinerTSQFcQFb__T4TakeTSQFsQFr__T6RepeatTQFhZQmZQBfTQFsZQCfFQCbQGdZ6ResultTQGpTSQHwQGt__T5byUTFTaVEQIp8typecons__T4FlagVQHka19_7573655265706c6163656d656e744463686172ZQCai1Z__TQDiTSQLsQHzQHs__TQHlTSQMj4path__T12pathSplitterTQLjZQtFQLqZ12PathSplitterTQNhZQJuFQCjQNsZQHpZQGxFNcQDrZQIdZQMfFQMcQOvQIfZQIvZQPv7popBackMFZ__T9__lambda1TQOjZQpFNaNfKQOvZv'
/usr/bin/ld: /tmp/.dub/build/dub-~master/library-$DFLAGS-linux.posix-x86_64-gdc_v12.2.0-EF73A06517126EA137612C896E3528F5C82DA77AA2D4C1F06844C8F055492695/libdub.a: in function `_D3std5range__T12ChooseResultTSQBd3utf__T10byCodeUnitTAyaZQrFQhZ14ByCodeUnitImplTSQDcQDb__T5chainTSQDt9algorithm9iteration__T6joinerTSQFcQFb__T4TakeTSQFsQFr__T6RepeatTQFhZQmZQBfTQFsZQCfFQCbQGdZ6ResultTQGpTSQHwQGt__T5byUTFTaVEQIp8typecons__T4FlagVQHka19_7573655265706c6163656d656e744463686172ZQCai1Z__TQDiTSQLsQHzQHs__TQHlTSQMj4path__T12pathSplitterTQLjZQtFQLqZ12PathSplitterTQNhZQJuFQCjQNsZQHpZQGxFNcQDrZQIdZQMfFQMcQOvQIfZQIvZQPv__T11actOnChosenSQRcQRb__TQQyTQQnTQOsZQRk8moveBackMFZ9__lambda1ZQCjFNaNfKSQThQTg__TQTdTQSsTQQxZQTpZya':
commandline.d:(.text+0x2aec0b): undefined reference to `_D3std5range__T12ChooseResultTSQBd3utf__T10byCodeUnitTAyaZQrFQhZ14ByCodeUnitImplTSQDcQDb__T5chainTSQDt9algorithm9iteration__T6joinerTSQFcQFb__T4TakeTSQFsQFr__T6RepeatTQFhZQmZQBfTQFsZQCfFQCbQGdZ6ResultTQGpTSQHwQGt__T5byUTFTaVEQIp8typecons__T4FlagVQHka19_7573655265706c6163656d656e744463686172ZQCai1Z__TQDiTSQLsQHzQHs__TQHlTSQMj4path__T12pathSplitterTQLjZQtFQLqZ12PathSplitterTQNhZQJuFQCjQNsZQHpZQGxFNcQDrZQIdZQMfFQMcQOvQIfZQIvZQPv8moveBackMFZ__T9__lambda1TQQjZQpFNaNbNiNfKQQzZya'
/usr/bin/ld: commandline.d:(.text+0x2aec26): undefined reference to `_D3std5range__T12ChooseResultTSQBd3utf__T10byCodeUnitTAyaZQrFQhZ14ByCodeUnitImplTSQDcQDb__T5chainTSQDt9algorithm9iteration__T6joinerTSQFcQFb__T4TakeTSQFsQFr__T6RepeatTQFhZQmZQBfTQFsZQCfFQCbQGdZ6ResultTQGpTSQHwQGt__T5byUTFTaVEQIp8typecons__T4FlagVQHka19_7573655265706c6163656d656e744463686172ZQCai1Z__TQDiTSQLsQHzQHs__TQHlTSQMj4path__T12pathSplitterTQLjZQtFQLqZ12PathSplitterTQNhZQJuFQCjQNsZQHpZQGxFNcQDrZQIdZQMfFQMcQOvQIfZQIvZQPv8moveBackMFZ__T9__lambda1TQOkZQpFNaNfKQOwZxa'
collect2: error: ld returned 1 exit status
Error gdc failed with exit code 1.

ximion avatar Feb 06 '23 18:02 ximion

That's not good at all - I'll see if missing references can be boiled down to something palatable, but no guarantees on time.

Will try reducing that dub -Werror in the meantime.

ibuclaw avatar Feb 06 '23 18:02 ibuclaw

It's a bit sad that we'll miss the Debian freeze deadline - I can ask for an exception, but I doubt I'll get it for a new upstream release (so Debian will be stuck at dub 1.28 ...).

In any case, once this works again I'll submit a PR for the dub CI, so we can catch these issues sooner next time :-)

ximion avatar Feb 06 '23 18:02 ximion

you can usually workaround these issues with -fall-instantiations, but it's not ideal.

WebFreak001 avatar Feb 06 '23 21:02 WebFreak001

@ximion By the way, this PR was backported for 12.3, can't say for sure whether it would help.

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108055

ibuclaw avatar Feb 06 '23 22:02 ibuclaw

you can usually workaround these issues with -fall-instantiations, but it's not ideal.

Not in this case, at least not completely :(

cd /srv/build/dub-1.30.0/bin/ && DFLAGS="-frelease -fall-instantiations" ./dub /srv/build/dub-1.30.0/scripts/man/gen_man.d
Serializing composite type Flags!(BuildRequirement) which has no serializable fields
Serializing composite type Flags!(BuildOption) which has no serializable fields
/usr/bin/ld: /tmp/.dub/build/dub-~master/library-$DFLAGS-linux.posix-x86_64-gdc_v12.2.0-5B018ADD281F2DD65E9997254B3E2EA54AFB08E179AEC5CCEA33EEE2363D77BC/libdub.a: in function `_D3std6format8internal5write__T15formatValueImplTSQBw5array__T8AppenderTAyaZQoTeTaZQCaFNaNfKQBrxeMKxSQDvQDu4spec__T10FormatSpecTaZQpZv':
Attributes.d:(.text+0x95ffe): undefined reference to `_D3std6format8internal5write__T15formatValueImplTSQBw5array__T8AppenderTAyaZQoTeTaZQCaFKQBnxeMKxSQDrQDq4spec__T10FormatSpecTaZQpZ__T9__lambda6TeZQnFNaNbNiNeKeZAxa'
collect2: error: ld returned 1 exit status
Error gdc failed with exit code 1.

ximion avatar Feb 06 '23 22:02 ximion

@WebFreak001 looks like it might be related to that -Wdeprecated -Werrors behaviour you noticed.

Not close to an actual reduction, but this is as far as the mechanical one has taken it.

Package getPackage(PackageOverride ovr)
{
    ovr.match!(
        (any) {
            ovr.version_;
    });
    return null;
}

struct PackageOverride {
    deprecated  inout(Dependency) version_ () inout {
        return Dependency();
    }
}

ibuclaw avatar Feb 06 '23 22:02 ibuclaw

that remaining linker error definitely looks like the bug link Iain just posted (it was the initial linker error that broke the alpine build at the start iirc)

So this remaining linker error you have has actually been known for a few months since I restarted the alpine GDC PR and was fixed by Iain, but still takes some time to sync up with the GCC release cycle.

WebFreak001 avatar Feb 06 '23 22:02 WebFreak001

but still takes some time to sync up with the GCC release cycle.

Doesn't prevent Debian/Ubuntu from backporting early.

ibuclaw avatar Feb 06 '23 23:02 ibuclaw

@WebFreak001 looks like it might be related to that -Wdeprecated -Werrors behaviour you noticed.

Yep, building dub with dmd -w -de @build-files.txt gives us the same error message about no handlers.

ibuclaw avatar Feb 06 '23 23:02 ibuclaw

Reduction for the original build failure - not actually a compiler bug, rather a small discrepancy between what warnings-as-errors means between dmd and gdc. There is no distinction between deprecation and warning in gdc diagnostics, so -w turns on deprecations-as-errors too (dmd -de).

template match(alias handler)
{
    auto match()
    {   
        static assert(is(typeof((Override args) => handler(args))),
                      "I do not like green eggs and ham.");
    }
}

void getPackage(Override ovr)
{   
    match!((any) => ovr.version_);
}

struct Override
{
    deprecated int version_ () { return 0; }   
}

Likely dub should be fixed to not use a deprecated interface in the code that makes use of SumTypes.

ibuclaw avatar Feb 06 '23 23:02 ibuclaw

you can usually workaround these issues with -fall-instantiations, but it's not ideal.

Not in this case, at least not completely :(

Confirmed. With PR108055 applied, this whittles down to:

/usr/bin/../lib/gcc/x86_64-pc-linux-gnu/12.2.1/../../../../x86_64-pc-linux-gnu/bin/ld: /tmp/ccAQVmw5.o: in function `_D3std6format8internal5write__T8getWidthTAyaZQoFNaNfQlZl':
/usr/lib/gcc/x86_64-pc-linux-gnu/12.2.1/include/d/std/format/internal/write.d:3819: undefined reference to `_D3std9algorithm9searching__T3allSQBg6format8internal5write__T8getWidthTAyaZQoFQhZ9__lambda2Z__TQCpTQBcZQCxMFNaNfQBpZb'
/usr/bin/../lib/gcc/x86_64-pc-linux-gnu/12.2.1/../../../../x86_64-pc-linux-gnu/bin/ld: /tmp/ccAQVmw5.o: in function `_D3std6format8internal5write__T8getWidthTAaZQnFNaNfQkZl':
/usr/lib/gcc/x86_64-pc-linux-gnu/12.2.1/include/d/std/format/internal/write.d:3819: undefined reference to `_D3std9algorithm9searching__T3allSQBg6format8internal5write__T8getWidthTAaZQnFQgZ9__lambda2Z__TQCoTQBbZQCwMFNaNfQBoZb'
/usr/bin/../lib/gcc/x86_64-pc-linux-gnu/12.2.1/../../../../x86_64-pc-linux-gnu/bin/ld: /tmp/ccAQVmw5.o: in function `_D3std6format8internal5write__T8getWidthTAwZQnFNaNbNiNfQoZl':
/usr/lib/gcc/x86_64-pc-linux-gnu/12.2.1/include/d/std/format/internal/write.d:3819: undefined reference to `_D3std9algorithm9searching__T3allSQBg6format8internal5write__T8getWidthTAwZQnFQgZ9__lambda2Z__TQCoTQBbZQCwMFNaNbNiNfQBsZb'

With PR108055 and DFLAGS=-fall-instantiations this compiles successfully however.

Likely being bitten by the template emission changes in the front-end. Will have to adjust for 12.x to get the least surprising behaviour, maybe rethink strategy before 13.x.

ibuclaw avatar Feb 07 '23 01:02 ibuclaw

Likely dub should be fixed to not use a deprecated interface in the code that makes use of SumTypes.

Looks like a simple fix, can you raise a PR or provide a link ?

Geod24 avatar Feb 07 '23 14:02 Geod24

@Geod24 it comes from this function.

https://github.com/dlang/dub/blob/5f756ca805189be6761c866123818023c93ce5cb/source/dub/packagemanager.d#L222-L244

ibuclaw avatar Feb 09 '23 09:02 ibuclaw

Looks like a DMD bug as it doesn't trigger a deprecation when it should.

Geod24 avatar Feb 09 '23 10:02 Geod24

I build dub 1.30.0 failed with the similar errors using ldc 1.30.0 on Fedora 37.

$ ldmd2 -run build.d
Using pre-existing version file. To force a rebuild, provide an explicit version (first argument) or remove: /home/ruby/rpmbuild/SOURCES/dub-1.30.0/source/dub/version_.d
Building dub using ldmd2 (dflags: ["-g", "-O", "-w"]), this may take a while...
Command `["ldmd2", "-of/home/ruby/rpmbuild/SOURCES/dub-1.30.0/bin/dub", "-I/home/ruby/rpmbuild/SOURCES/dub-1.30.0/source", "-version=DubUseCurl", "-version=DubApplication", "-g", "-O", "-w", "@build-files.txt"]` failed, output was:
Serializing composite type Flags!(BuildRequirement) which has no serializable fields
Serializing composite type Flags!(BuildOption) which has no serializable fields
Error: Error executing /usr/bin/ldc2: Killed

Error: /tmp/build-fc6919 failed with status: 1
$ ldmd2 --version
LDC - the LLVM D compiler (1.30.0):
  based on DMD v2.100.1 and LLVM 14.0.5
  built with LDC - the LLVM D compiler (1.30.0)
  Default target: x86_64-redhat-linux-gnu

topazus avatar Feb 15 '23 15:02 topazus

@topazus

Error: Error executing /usr/bin/ldc2: Killed

how much memory does your build machine have? It looks like it was rather OOM killed instead of this being an LDC problem.

WebFreak001 avatar Feb 15 '23 17:02 WebFreak001