digitalmars.D.learn - 2.096.0 linker errors
- Curtis (36/36) Mar 22 2021 Using 2.096.0, I'm getting a number of "undefined reference"
- mw (6/13) Mar 22 2021 Do 'dub clean --all-packages', (even 'rm -fr ∼/.Dub )
Using 2.096.0, I'm getting a number of "undefined reference" linker errors that I haven't been able to figure out how to resolve. The first linker error is undefined reference to std.typecons.Typedef: ``` src/phobos/std/typecons.d:7569: error: undefined reference to '_D3std8typecons__T7TypedefTmVmN1VAyaa20_466c617441646472657373436f6d706f6e656e74ZQCl6__initZ' ``` The module that I am compiling/linking imports std.typecons : Typedef at the top of the file. I have compiled the file, run `strings` on the output file, and grep'd the output for the missing symbol reported by the linker and it is in the list of symbols. The second linker error is undefined reference to core.internal.SwitchError: ``` src/phobos/std/range/package.d:9752: error: undefined reference to '_D4core8internal7switch___T14__switch_errorZQrFNaNbNiNfAyamZv' ``` This shows up anywhere I have a `final switch` in the code. Like the Typedef error, this symbol also shows up in the list of symbols. The third linker error I'm getting is undefined reference to a function that is defined in the module and then referenced later inside a class that is also defined in that module after the function. Again, I'm not sure why the linker would think it is undefined since it is defined in the same module. I did try moving the function definition inside the class and the linker errors associated with that function go away. The code compiles and links with 2.091.1 but I'm not sure what has changed since then that might cause this problem. I am working on creating a reduced test case using Dustmite but haven't been successful yet as it keeps reducing to an empty set. Any tips on what to do/check? Thanks!
Mar 22 2021
On Monday, 22 March 2021 at 23:35:09 UTC, Curtis wrote:Using 2.096.0, I'm getting a number of "undefined reference"...The code compiles and links with 2.091.1 but I'm not sure what has changed since then that might cause this problem. I am working on creating a reduced test case using Dustmite but haven't been successful yet as it keeps reducing to an empty set. Any tips on what to do/check?Do 'dub clean --all-packages', (even 'rm -fr ∼/.Dub ) then rebuild from scratch. I think it try to mix the object file generated by the old compiler with the new one.
Mar 22 2021
On Tuesday, 23 March 2021 at 00:39:32 UTC, mw wrote:On Monday, 22 March 2021 at 23:35:09 UTC, Curtis wrote:Thanks for the idea. I failed to mention that in my original post, but I did already try removing the .dub file in the project but I still get the linker errors.Using 2.096.0, I'm getting a number of "undefined reference"...The code compiles and links with 2.091.1 but I'm not sure what has changed since then that might cause this problem. I am working on creating a reduced test case using Dustmite but haven't been successful yet as it keeps reducing to an empty set. Any tips on what to do/check?Do 'dub clean --all-packages', (even 'rm -fr ∼/.Dub ) then rebuild from scratch. I think it try to mix the object file generated by the old compiler with the new one.
Mar 23 2021
On Tuesday, 23 March 2021 at 15:27:32 UTC, Curtis wrote:On Tuesday, 23 March 2021 at 00:39:32 UTC, mw wrote:Just want to make sure: what I mean is $HOME/.dub/ the whole *dir* tree, it contains all the 3rd party packages; not a single file.On Monday, 22 March 2021 at 23:35:09 UTC, Curtis wrote:Thanks for the idea. I failed to mention that in my original post, but I did already try removing the .dub file in the project but I still get the linker errors.Using 2.096.0, I'm getting a number of "undefined reference"...The code compiles and links with 2.091.1 but I'm not sure what has changed since then that might cause this problem. I am working on creating a reduced test case using Dustmite but haven't been successful yet as it keeps reducing to an empty set. Any tips on what to do/check?Do 'dub clean --all-packages', (even 'rm -fr ∼/.Dub ) then rebuild from scratch. I think it try to mix the object file generated by the old compiler with the new one.
Mar 23 2021
On Tuesday, 23 March 2021 at 16:04:49 UTC, mw wrote:Just want to make sure: what I mean is $HOME/.dub/ the whole *dir* tree, it contains all the 3rd party packages; not a single file.I don't have a $HOME/.dub/ directory, but I did delete the whole .dub/ directory in the project I am trying to compile.
Mar 23 2021
If it's not a clean up issue, try -- DMD 2.095 or -- LDC 1.25.1 to see if you can build, if yes, then it could be a bug of 2.096
Mar 23 2021
On Tuesday, 23 March 2021 at 17:19:10 UTC, mw wrote:If it's not a clean up issue, try -- DMD 2.095 or -- LDC 1.25.1 to see if you can build, if yes, then it could be a bug of 2.096I tried compiling with both DMD 2.095.1 and LDC 1.25.1 and still got the linker errors. Then I tried compiling with and older version of dub (version 1.20.1 which shipped with DMD 2.091.1) but compiling with DMD 2.096.0 (`/opt/dmd.2.091.1/linux/bin64/dub build --compiler=/opt/dmd.2.096.0/linux/bin64/dmd`) and it compiled and linked just fine. So, this appears to be a dub problem. After some additional testing, I found that this compiles with dub version 1.23.0 (shipped with DMD 2.094.1) but not with dub version 1.24.1 (shipped with DMD 2.095.1). I ran `/opt/dmd.2.094.1/linux/bin64/dub build --compiler=/opt/dmd.2.096.0/linux/bin64/dmd -v` and `/opt/dmd.2.096.0/linux/bin64/dub build --compiler=/opt/dmd.2.096.0/linux/bin64/dmd -v` and diffed the compilation and linking commands. The linking commands are the same, but the compilation commands are different. The compilation command generated by the new version of dub is missing a number of files (from a library that I am importing) that the old version of dub includes. All of the places where I was getting linker errors are in these missing files. I am working on creating a minimum test case using dustmite and will file an issue in the dub GitHub project. I will post a link to the issue here when I have created an the issue. Thanks for your help!
Mar 23 2021