Bug 19801 – Linking error: ld: symbol(s) not found for architecture x86_64
Status
RESOLVED
Resolution
WORKSFORME
Severity
blocker
Priority
P1
Component
tools
Product
D
Version
D2
Platform
x86_64
OS
Mac OS X
Creation time
2019-04-10T11:17:59Z
Last change time
2020-06-04T16:30:55Z
Assigned to
No Owner
Creator
Jon Kleiser
Comments
Comment #0 by jon.kleiser — 2019-04-10T11:17:59Z
I try to install the D REPL. After having done "dub fetch drepl" successfully, I do "dub run drepl". That job ends like this:
drepl 0.2.1: building configuration "console"...
Running pre-build commands...
Linking...
Undefined symbols for architecture x86_64:
"__D6object__T10RTInfoImplVAmA2i48i60Z4datayG2m", referenced from:
__D42TypeInfo_S3std7variant__T8VariantNVmi32ZQp6__initZ in libstdx-allocator.a(concurrency_103_72a.o)
"__D6object__T10RTInfoImplVAmA2i80i961Z4datayG2m", referenced from:
__D59TypeInfo_S3std11concurrency__T4ListTSQBbQBa7MessageZQw4Node6__initZ in libstdx-allocator.a(atomic_ef_466.o)
"_rt_loadLibrary", referenced from:
__D4core7runtime7Runtime__T11loadLibraryZQoFxAaZPv in drepl.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Error: linker exited with status 1
/Library/D/dmd/bin/dmd failed with exit code 1.
I have tried with both DMD64 D Compiler v2.085.0 and v2.085.1.
I'm running macOS 10.14.4 (the latest).
Comment #1 by greeenify — 2019-04-10T14:16:45Z
That's probably an issue with drepl. Please report there. Thanks!
Comment #2 by jon.kleiser — 2019-04-10T14:22:21Z
It may be so. The reason I thought it was more general, is I get a somewhat similar error when trying to build the websocket demo code found here: https://wiki.dlang.org/User:Csmith1991/Vibe.d_Documentation/websocket
This is what I get:
websocket_chat ~master: building configuration "application"...
Linking...
Undefined symbols for architecture x86_64:
"_main", referenced from:
implicit entry/start for main executable
(maybe you meant: __d_main_args, __D4core6thread6Thread7sm_mainCQBcQBaQw , __D4core6thread16_mainThreadStoreG312v )
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Error: linker exited with status 1
/Library/D/dmd/bin/dmd failed with exit code 1.
Comment #3 by greeenify — 2019-04-10T14:36:34Z
Hmm, did this error occur when trying to build the websocket example from the Vibe.d source tree. What version of Vibe.d do you build?
Comment #4 by jon.kleiser — 2019-04-10T14:39:29Z
(In reply to Seb from comment #3)
> Hmm, did this error occur when trying to build the websocket example from
> the Vibe.d source tree. What version of Vibe.d do you build?
I tried both 0.8.5 and 0.8.6-alpha.1.
Comment #5 by jon.kleiser — 2019-04-10T14:53:46Z
(In reply to Jon Kleiser from comment #4)
> (In reply to Seb from comment #3)
> > Hmm, did this error occur when trying to build the websocket example from
> > the Vibe.d source tree. What version of Vibe.d do you build?
>
> I tried both 0.8.5 and 0.8.6-alpha.1.
I may have misunderstood your question re. the Vibe.d source tree. I also did try the tiny hello.d (Hello Vibe.d) at code.dlang.org/packages/vibe-d. It ran, and was listening and responding on 8080, in spite of the yellow text in the log saying "Failed to listen on 0.0.0.0:8080".
Comment #6 by greeenify — 2019-04-10T15:24:18Z
Did you clone the vibe.d repository and go into the examples/websocket directory to run the websocket example or where did you get it from?
Comment #7 by jon.kleiser — 2019-04-10T16:26:59Z
(In reply to Seb from comment #6)
> Did you clone the vibe.d repository and go into the examples/websocket
> directory to run the websocket example or where did you get it from?
I have now cloned the vibe.d repo. The vibe.d/examples/websocket did build and run w/o problems.
I also tried to dub build the vibe.d/examples/http_server, but that ended like this:
http-server-example ~master: building configuration "application"...
Linking...
Undefined symbols for architecture x86_64:
"__D6object__T10RTInfoImplVAmA2i104i1322ZQBbyG2m", referenced from:
__D85TypeInfo_S4vibe4core4path__T11GenericPathTSQBhQBfQBd17WindowsPathFormatZQBs9PathRange6__initZ in http-server-example.o
"__D6object__T10RTInfoImplVAmA2i224i33ZQzyG2m", referenced from:
__D229TypeInfo_S9eventcore7drivers12threadedfile__T23ThreadedFileEventDriverHTCQClQCe5posix6even
-------------- lots more -----------------
ntDriverHTCQClQCe5posix6events__T22PosixEventDriverEventsHTCQEiQEbQBx6kqueue15KqueueEventLoopHTCQFsQFlQDh7sockets__T23PosixEventDriverSocketsHTQDgZQBfZQEoZQGq__T7taskFunVAyaa4_72656164ThZQBaFNbNiNfCQJqQJjQJe__TQItHTQHxZQJcSQKp6driver6FileFDmAhZvTQBxTQBcTmTQpZQMh6__initZ in http-server-example.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Error: linker exited with status 1
/Library/D/dmd/bin/dmd failed with exit code 1.
Comment #8 by greeenify — 2019-04-10T21:31:09Z
Hmm could it be that this is due to your installation as it looks like your linking with a different standard library than your source include paths have.
How did you install D and could you check that DMD is using them correct standard library?
You can see the imports and linker commands when compiling with -v (e.g. hello world).
Comment #9 by jon.kleiser — 2019-04-11T05:27:20Z
(In reply to Seb from comment #8)
> Hmm could it be that this is due to your installation as it looks like your
> linking with a different standard library than your source include paths
> have.
> How did you install D and could you check that DMD is using them correct
> standard library?
> You can see the imports and linker commands when compiling with -v (e.g.
> hello world).
I installed using the installer, first dmd.2.085.0.dmg, then dmd.2.085.1.dmg. The same on three different Macs.
Comment #10 by jon.kleiser — 2019-04-11T07:25:01Z
(In reply to Jon Kleiser from comment #9)
> (In reply to Seb from comment #8)
> > Hmm could it be that this is due to your installation as it looks like your
> > linking with a different standard library than your source include paths
> > have.
> > How did you install D and could you check that DMD is using them correct
> > standard library?
> > You can see the imports and linker commands when compiling with -v (e.g.
> > hello world).
>
> I installed using the installer, first dmd.2.085.0.dmg, then
> dmd.2.085.1.dmg. The same on three different Macs.
Here's the output from compiling "hello":
$ dmd -v source/app.d
predefs DigitalMars Posix OSX CppRuntime_Clang darwin LittleEndian D_Version2 all D_SIMD D_InlineAsm_X86_64 X86_64 D_LP64 D_PIC assert D_ModuleInfo D_Exceptions D_TypeInfo D_HardFloat D_ObjectiveC
binary dmd
version v2.085.1
config /usr/local/bin/dmd.conf
DFLAGS -I/Library/D/dmd/src/phobos -I/Library/D/dmd/src/druntime/import -L-L/Library/D/dmd/lib
parse app
importall app
import object (/Library/D/dmd/src/druntime/import/object.d)
import core.attribute (/Library/D/dmd/src/druntime/import/core/attribute.d)
import core.internal.hash (/Library/D/dmd/src/druntime/import/core/internal/hash.d)
import core.internal.traits (/Library/D/dmd/src/druntime/import/core/internal/traits.d)
import core.internal.convert (/Library/D/dmd/src/druntime/import/core/internal/convert.d)
import std.stdio (/Library/D/dmd/src/phobos/std/stdio.d)
import core.stdc.stddef (/Library/D/dmd/src/druntime/import/core/stdc/stddef.d)
import core.stdc.stdio (/Library/D/dmd/src/druntime/import/core/stdc/stdio.d)
import core.stdc.stdint (/Library/D/dmd/src/druntime/import/core/stdc/stdint.d)
import core.stdc.config (/Library/D/dmd/src/druntime/import/core/stdc/config.d)
import core.stdc.signal (/Library/D/dmd/src/druntime/import/core/stdc/signal.d)
import core.stdc.wchar_ (/Library/D/dmd/src/druntime/import/core/stdc/wchar_.d)
import core.stdc.stdarg (/Library/D/dmd/src/druntime/import/core/stdc/stdarg.d)
import core.stdc.stdlib (/Library/D/dmd/src/druntime/import/core/stdc/stdlib.d)
import core.stdc.time (/Library/D/dmd/src/druntime/import/core/stdc/time.d)
import core.sys.posix.sys.types (/Library/D/dmd/src/druntime/import/core/sys/posix/sys/types.d)
import core.sys.posix.config (/Library/D/dmd/src/druntime/import/core/sys/posix/config.d)
import std.algorithm.mutation (/Library/D/dmd/src/phobos/std/algorithm/mutation.d)
import std.traits (/Library/D/dmd/src/phobos/std/traits.d)
import std.meta (/Library/D/dmd/src/phobos/std/meta.d)
import std.functional (/Library/D/dmd/src/phobos/std/functional.d)
import std.range.primitives (/Library/D/dmd/src/phobos/std/range/primitives.d)
import std.typecons (/Library/D/dmd/src/phobos/std/typecons.d)
import std.format (/Library/D/dmd/src/phobos/std/format.d)
import core.vararg (/Library/D/dmd/src/druntime/import/core/vararg.d)
import std.exception (/Library/D/dmd/src/phobos/std/exception.d)
import std.internal.attributes (/Library/D/dmd/src/phobos/std/internal/attributes.d)
semantic app
import core.atomic (/Library/D/dmd/src/druntime/import/core/atomic.d)
import core.stdc.errno (/Library/D/dmd/src/druntime/import/core/stdc/errno.d)
entry main source/app.d
semantic2 app
semantic3 app
import std.utf (/Library/D/dmd/src/phobos/std/utf.d)
import core.internal.string (/Library/D/dmd/src/druntime/import/core/internal/string.d)
import std.algorithm.comparison (/Library/D/dmd/src/phobos/std/algorithm/comparison.d)
import core.stdc.string (/Library/D/dmd/src/druntime/import/core/stdc/string.d)
code app
function D main
function std.stdio.writeln!string.writeln
function std.stdio.File.LockingTextWriter.put!string.put
function std.stdio.File.LockingTextWriter.put!string.put.__dgliteral2
function std.stdio.trustedFwrite!char.trustedFwrite
function std.exception.enforce!(ErrnoException).enforce!int.enforce
function std.exception.bailOut!(ErrnoException).bailOut
function object.idup!(const(char)).idup
function object._trustedDup!(const(char), immutable(char))._trustedDup
function object._dup!(const(char), immutable(char))._dup
function object._doPostblit!(immutable(char))._doPostblit
function object._getPostblit!(immutable(char))._getPostblit
function std.stdio.File.LockingTextWriter.put!(immutable(char)).put
function std.stdio.File.LockingTextWriter.put!(immutable(char)).put.trustedFPUTC
function std.stdio.File.LockingTextWriter.put!(immutable(char)).put.trustedFPUTWC
function std.stdio.File.LockingTextWriter.put!char.put
function std.stdio.File.LockingTextWriter.put!char.put.trustedFPUTC
function std.stdio.File.LockingTextWriter.put!char.put.trustedFPUTWC
cc app.o -o app -m64 -Xlinker -no_compact_unwind -L/Library/D/dmd/lib -lphobos2 -lpthread -lm
The contents of my /usr/local/bin/dmd.conf is this:
[Environment]
DFLAGS=-I/Library/D/dmd/src/phobos -I/Library/D/dmd/src/druntime/import -L-L/Library/D/dmd/lib
Comment #11 by jon.kleiser — 2019-04-11T13:13:48Z
I now uninstalled dmd and dub by running the uninstall.command. Then I installed dmd (v2.085.0) and dub, by "brew install dmd" and "brew install dub". I can now "dub build" vibe.d examples (http_server, http_static_server, websocket) without problems. I conclude that there are problems with your dmd.2.085.0.dmg and dmd.2.085.1.dmg installers.
I still have some linking problems with drepl, but I will (soon) report that at https://github.com/dlang-community/drepl/issues/77.
Comment #12 by pro.mathias.lang — 2020-06-04T16:30:55Z
I can't reproduce the failure locally on a Mac OSX 10.15.4.
I installed the latest `dmg` and things work. Since we don't fix up old build, closing as `WORKSFORME`.
If you do have any other issue with the provided `dmg`, please feel free to open an issue on Github (https://github.com/dlang/tools/issues).