Bug 22470 – Linker error: std.math.remainder.fmod

Status
RESOLVED
Resolution
FIXED
Severity
regression
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
x86_64
OS
FreeBSD
Creation time
2021-11-02T14:31:22Z
Last change time
2021-11-02T17:08:50Z
Assigned to
No Owner
Creator
Nico Sonack

Comments

Comment #0 by nsonack — 2021-11-02T14:31:22Z
Might be a duplicate but it seems as if it works very much fine on Linux but not anymore on FreeBSD (as tested during a short discussion on IRC) : nico@hades:/tmp $ nico@hades:/tmp $ cat -n foo.d 1 import std.stdio; 2 import std.math.remainder; 3 4 int 5 main() 6 { 7 float foo = fmod(3.14159, 69.42); 8 return 0; 9 } nico@hades:/tmp $ nico@hades:/tmp $ diff -u foo.d bar.d --- foo.d 2021-11-02 15:00:48.501788000 +0100 +++ bar.d 2021-11-02 15:03:37.342617000 +0100 @@ -1,5 +1,5 @@ import std.stdio; -import std.math.remainder; +import std.math; int main() nico@hades:/tmp $ nico@hades:/tmp $ nico@hades:/tmp $ which dmd /usr/home/nico/.local/dmd2/freebsd/bin64//dmd nico@hades:/tmp $ nico@hades:/tmp $ dmd --version DMD64 D Compiler v2.098.0 Copyright (C) 1999-2021 by The D Language Foundation, All Rights Reserved written by Walter Bright nico@hades:/tmp $ nico@hades:/tmp $ dmd -of=foo foo.d nico@hades:/tmp $ dmd -of=bar bar.d ld: error: undefined symbol: _D3std4math4fmodFNbNiNeeeZe >>> referenced by bar.d >>> bar.o:(_Dmain) cc: error: linker command failed with exit code 1 (use -v to see invocation) Error: linker exited with status 1 nico@hades:/tmp $ nico@hades:/tmp $ I removed a second system-wide installation of all dlang-related ports (ldc2) but I still get the same linker error. In case you need any other information or want me to test something, please feel free to tell me!
Comment #1 by bcallah — 2021-11-02T14:52:24Z
Hello -- As a very quick sanity check, since I just touched fmod handling on FreeBSD: are you running the release binaries of 2.098.0 or are you running a bleeding edge -stable? In short, does your compiler include this change: https://github.com/dlang/dmd/commit/54fa6ee3480fba215e31252da59d3318749fc612 FWIW, I cannot reproduce this on OpenBSD, both with and without the above commit. Either way, I can look into FreeBSD support for fmod a little later today.
Comment #2 by nsonack — 2021-11-02T14:57:30Z
I am running the tarball straight from https://dlang.org/download.html which reports as : DMD64 D Compiler v2.098.0 That should be the release binaries.
Comment #3 by bcallah — 2021-11-02T15:13:20Z
Thanks. You might try that commit, though I'm not confident it'll fix your problem. If not, I'll look into a better fix tonight.
Comment #4 by nsonack — 2021-11-02T15:36:27Z
Just built the current head of the stable branch : nico@hades:/tmp $ nico@hades:/tmp $ dmd --version DMD64 D Compiler v2.098.0-40-g54fa6ee34 Copyright (C) 1999-2021 by The D Language Foundation, All Rights Reserved written by Walter Bright nico@hades:/tmp $ nico@hades:/tmp $ dmd -of=bar bar.d nico@hades:/tmp $ ./bar 3.14159 nico@hades:/tmp $ As it seems, that solves the issue.
Comment #5 by bcallah — 2021-11-02T17:08:50Z