www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - freebsd dub linker error

reply Alain De Vos <devosalain ymail.com> writes:
I disabled 32bit code maybe this created the following error 
while building dub :

[00:02:18] 
===========================================================================
[00:02:18] =======================<phase: configure      
============================
[00:02:18] ===> Configuring for dub-1.14.0 [00:02:23] =========================================================================== [00:02:23] =======================<phase: build
============================
[00:02:23] ===> Building for dub-1.14.0 [00:02:41] build.sh: cannot open 2.069.0: No such file or directory [00:02:41] Using existing version file. [00:02:41] Running ldmd2... [00:02:58] Serializing composite type BuildRequirements which has no serializable fields [00:02:58] Serializing composite type BuildOptions which has no serializable fields [00:02:59] source/dub/dub.d(1602): Deprecation: function `std.typecons.Nullable!(PackageRecipe).Nullable.get_` is deprecated - Implicit conversion with `alias Nullable.get this` will be removed after 2.096. Please use `.get` explicitly. [00:02:59] source/dub/packagesuppliers/maven.d(81): Deprecation: module `std.xml` is deprecated - Will be removed from Phobos in 2.101.0. If you still need it, go to https://github.com/DigitalMars/undeaD [00:02:59] source/dub/project.d(288): Deprecation: variable `c` is shadowing variable `dub.project.Project.validate.c`. Rename the `foreach` variable. [00:03:00] source/dub/generators/build.d(338): Deprecation: module `std.digest.digest` is deprecated - import std.digest instead of std.digest.digest. std.digest.digest will be removed in 2.101 [00:04:19] ld: error: undefined hidden symbol: __start___minfo [00:04:19] >>> referenced by sdl.d [00:04:19] >>> bin/dub.o:(ldc.register_dso) [00:04:19] [00:04:19] ld: error: undefined hidden symbol: __stop___minfo [00:04:19] >>> referenced by sdl.d [00:04:19] >>> bin/dub.o:(ldc.register_dso) [00:04:19] cc: error: linker command failed with exit code 1 (use -v to see invocation) [00:04:19] Error: /usr/bin/cc failed with status: 1 [00:04:19] *** Error code 1 [00:04:19] [00:04:19] Stop. [00:04:19] make: stopped in /usr/ports/devel/dub [00:04:20] =>> Cleaning up wrkdir [00:04:20] ===> Cleaning for dub-1.14.0 [00:04:23] build of devel/dub | dub-1.14.0 ended at Fri Mar 18 03:59:34 CET 2022 [00:04:23] build time: 00:04:23 [00:04:23] !!! build failure encountered !!!
Mar 17 2022
parent reply rikki cattermole <rikki cattermole.co.nz> writes:
Are you trying to build dub on Android?

Android support for ldc is currently broken to due to removal of a 
linker that is currently required for TLS support.

https://github.com/ldc-developers/ldc/issues/3918
Mar 17 2022
parent reply rikki cattermole <rikki cattermole.co.nz> writes:
On 18/03/2022 5:56 PM, rikki cattermole wrote:
 Are you trying to build dub on Android?
 
 Android support for ldc is currently broken to due to removal of a 
 linker that is currently required for TLS support.
 
 https://github.com/ldc-developers/ldc/issues/3918
My bad I didn't see FreeBSD. Similar issue, quite possibly related given the old version 2.069.0 being referenced. https://github.com/ldc-developers/ldc/pull/3106
Mar 17 2022
parent reply Alain De Vos <devosalain ymail.com> writes:
The problem re-appeared and i have totally no idea what caused it.
ldc2 test.d
ld: error: undefined hidden symbol: __start___minfo
 referenced by test.d
               test.o:(ldc.register_dso)
ld: error: undefined hidden symbol: __stop___minfo
 referenced by test.d
               test.o:(ldc.register_dso)
cc: error: linker command failed with exit code 1 (use -v to see invocation) Error: /usr/bin/cc failed with status: 1 The only thing i did was disabling 32-bit code in kernel and userland.
May 16 2022
parent reply Alain De Vos <devosalain ymail.com> writes:
The following worked , and i don't know what is going on:
```
ldc2 --gcc=gcc11
```
May 16 2022
parent reply Alain De Vos <devosalain ymail.com> writes:
Bugs in the clang/llvm toolchain but not in the gcc toolchain ?
May 16 2022
parent reply Alain De Vos <devosalain ymail.com> writes:
Performed additional tests.
Compiling helloworld.d
```
export CC=gcc11 ; ldc2 helloworld.d
```
works fine.

Compiling helloworld.d
```
export CC=clang ; ldc2 helloworld.d
```
returns:
```
d: error: undefined hidden symbol: __start___minfo
 referenced by test.d
               test.o:(ldc.register_dso)
ld: error: undefined hidden symbol: __stop___minfo
 referenced by test.d
               test.o:(ldc.register_dso)
clang: error: linker command failed with exit code 1 (use -v to see invocation) Error: /usr/bin/clang failed with status: 1 ``` So I have a workaround by fixing it to gcc
Jun 01 2022
parent reply Alain De Vos <devosalain ymail.com> writes:
The detailed error is :
```
/usr/bin/clang test.o -o test -L/usr/local/lib -lphobos2-ldc 
-ldruntime-ldc -Wl,--gc-sections -lexecinfo -lpthread -lm -m64
ld: error: undefined hidden symbol: __start___minfo
 referenced by test.d
               test.o:(ldc.register_dso)
```
Jun 01 2022
parent reply Kagamin <spam here.lot> writes:
Try to run clang with -v option and compare with gcc.
Jun 01 2022
parent Alain De Vos <devosalain ymail.com> writes:
On Wednesday, 1 June 2022 at 15:23:14 UTC, Kagamin wrote:
 Try to run clang with -v option and compare with gcc.
I've tracked down the problem to the solution where i specify as linker to use gcc12 instead of a clang/llvm. The following works. ``` export CC=clang14 ldc2 --link-defaultlib-shared --gcc=gcc12 ... ``` But i have no explanation.
Sep 01 2022