Bug 19116 – dmd compiles binary but segfaults immediately when run on Ubuntu / Debian 32Bit architectures

Status
RESOLVED
Resolution
FIXED
Severity
critical
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
x86
OS
Linux
Creation time
2018-07-25T21:36:49Z
Last change time
2023-01-02T21:07:19Z
Keywords
pull
Assigned to
No Owner
Creator
Alex Braunegg

Comments

Comment #0 by alex.braunegg — 2018-07-25T21:36:49Z
As the current maintainer for the Linux OneDrive client (https://github.com/abraunegg/onedrive) a number of users are unable to run the compiled binary when it is compiled and run on 32 bit architectures. Examples of runtime failures on various operating systems are: OS: 4.9.0-6-686-pae #1 SMP Debian 4.9.88-1+deb9u1 (2018-05-07) i686 GNU/Linux https://github.com/skilion/onedrive/issues/385 OS: Lubunti 386 https://github.com/skilion/onedrive/issues/353 OS: Linux bl 4.9.0-6-686-pae #1 SMP Debian 4.9.82-1+deb9u3 (2018-03-02) i686 GNU/Linux https://github.com/skilion/onedrive/issues/336 OS: Linux Zephyr3 4.15.0-23-generic #25-Ubuntu SMP Wed May 23 17:59:24 UTC 2018 i686 i686 i686 GNU/Linux https://github.com/abraunegg/onedrive/issues/79 The process to build the binary is the same: sudo apt install build-essential sudo apt install libcurl4-openssl-dev sudo apt install libsqlite3-dev curl -fsS https://dlang.org/install.sh | bash -s dmd git clone https://github.com/abraunegg/onedrive.git cd onedrive source ~/dlang/dmd-2.081.1/activate make sudo make install With no errors being reported at compilation time. A full stack trace has been provided here: https://github.com/skilion/onedrive/files/2155548/strace.txt When using the exact same process on x86_64, there are no runtime issues on Ubuntu / Debian platforms. When the DMD reference compiler is swapped out for LDC on Ubuntu / Debian 32bit platforms the resulting binary runs without issue. Any suggestions here would be greatly appreciated.
Comment #1 by alex.braunegg — 2018-07-25T21:49:19Z
Additionally: Arch Linux 2018.07.01 i686
Comment #2 by alex.braunegg — 2018-07-25T21:50:17Z
Additionally: Arch Linux 2018.07.01 i686 - This works without issue using same compilation method Fedora LXDE i386 28-1.1 - - This works without issue using same compilation method
Comment #3 by greensunny12 — 2018-07-25T21:56:07Z
Did you already try LDC for 32-bit? (the llvm is a lot more maintained)
Comment #4 by alex.braunegg — 2018-07-25T22:01:35Z
Yes - this has been tried - LDC compiled binary runs without issue on Ubuntu / Debian 32bit platforms. The question here however is: Why does the DMD compiled binary not work for Ubuntu / Debian 32bit platforms, but works without issue on Fedora / Arch 32bit platforms using the exact same process / method to install DMD & compile the code.
Comment #5 by andrew.pennebaker — 2018-11-29T18:23:30Z
Same behavior for me, freakin' Hello World segfaults in 32-bit Debian. import std.stdio; void main() { writeln("Hello World!"); } The i386 package should be dropped from the d-apt repo until this gets fixed.
Comment #6 by sahmi.soulaimane — 2019-03-30T06:19:07Z
isn't this the PIE bug? try this: --- $ cat >hello.d <<EOF import std.stdio; void main(){ writeln("hello!");} EOF $ dmd hello.d -c $ gcc hello.o -no-pie -o hello $ ./hello ---
Comment #7 by sahmi.soulaimane — 2019-05-21T08:18:26Z
*** Issue 19868 has been marked as a duplicate of this issue. ***
Comment #8 by greeenify — 2019-05-27T08:00:53Z
*** Issue 15469 has been marked as a duplicate of this issue. ***
Comment #9 by sahmi.soulaimane — 2019-06-05T23:54:41Z
Comment #10 by dfj1esp02 — 2019-08-05T08:35:11Z
*** Issue 20102 has been marked as a duplicate of this issue. ***
Comment #11 by dfj1esp02 — 2019-08-05T08:39:18Z
*** Issue 17833 has been marked as a duplicate of this issue. ***
Comment #12 by dfj1esp02 — 2019-08-05T08:47:16Z
*** Issue 18350 has been marked as a duplicate of this issue. ***
Comment #13 by silvercircle — 2019-11-01T18:37:16Z
The issue is still valid on a fresh install of 32bit Debian 10.1 (Buster i686) with most recent DMD (DMD 2.088.1 as of now) downloaded from dlang.org. However, it only happens when linking with the default linker (which is still the bfd variant on Debian i686). I've set ld.gold as default linker and this seems to fix the problem with the crashes. No issue so far with a couple of projects of different size. Works: [alex@nexus:/home/alex]$>ld --version > GNU gold (GNU Binutils for Debian 2.31.1) 1.16 Does not work (all executables crash with SIGSEGV on start). Affects both debug and release builds > GNU ld (GNU Binutils for Debian) 2.31.1 > Copyright (C) 2018 Free Software Foundation, Inc. ld.gold is installed on Debian but not set as default. It can be used by either passing -fuse-ld=gold to the linker or by using update-alternatives to set ld.gold as system-wide default. sudo update-alternatives --install "/usr/bin/ld" "ld" "/usr/bin/ld.gold" 20 sudo update-alternatives --install "/usr/bin/ld" "ld" "/usr/bin/ld.bfd" 10
Comment #14 by dlang-bot — 2019-11-19T15:51:22Z
@SSoulaimane updated dlang/dmd pull request #9981 "Fix issue 19116 - Segfaults on recent Linux 32 bits distros" fixing this issue: - Fix issue 19116 - Segfaults on recent Linux 32Bits distros Check the linker (cc) on linux if it assumes PIE by default to turn it off when linking non-PIC code. We check the linker build flags since this option only applies to GCC 6 and newer. https://github.com/dlang/dmd/pull/9981
Comment #15 by i6o34a+7y7j1p606trkc — 2019-11-19T18:35:09Z
*** Issue 9488 has been marked as a duplicate of this issue. ***
Comment #16 by dlang-bugzilla — 2019-11-20T14:30:25Z
Undoing vandalism(?) by Parmigiano
Comment #17 by b2.temp — 2020-10-19T10:15:45Z
*** Issue 21326 has been marked as a duplicate of this issue. ***
Comment #18 by dlang-bot — 2021-03-15T08:04:16Z
@Geod24 updated dlang/druntime pull request #3396 "Github CI: Drop Ubuntu 16.04 and clang < 8" mentioning this issue: - Github CI: Drop Ubuntu 16.04 and clang < 8, disable 32 bits We're having issues due to yet another change by Github to their image, and Ubuntu 16.04 is EOL soon, so just drop it along with clang 6 and 7 which are not available on Ubuntu 18.04, the new supported LTS. Switching to Ubuntu 18.04 unfortunately triggers issue 19116, which forces us to disable 32 bits for the time being. https://github.com/dlang/druntime/pull/3396
Comment #19 by dlang-bot — 2021-03-15T14:26:28Z
dlang/druntime pull request #3396 "Github CI: Drop Ubuntu 16.04 and clang < 8" was merged into stable: - a950f2183b53618b616c78cf71bf99d56dc310ef by Geod24: Github CI: Drop Ubuntu 16.04 and clang < 8, disable 32 bits We're having issues due to yet another change by Github to their image, and Ubuntu 16.04 is EOL soon, so just drop it along with clang 6 and 7 which are not available on Ubuntu 18.04, the new supported LTS. Switching to Ubuntu 18.04 unfortunately triggers issue 19116, which forces us to disable 32 bits for the time being. https://github.com/dlang/druntime/pull/3396
Comment #20 by dlang-bot — 2021-03-15T14:37:37Z
@rymrg updated dlang/druntime pull request #3392 "Fix Issue 21701 - casWeak is not implemented" mentioning this issue: - Github CI: Drop Ubuntu 16.04 and clang < 8 (#3396) * Github CI: Use dmd-latest Not providing an argument defaults to dmd-latest, which is what we want. * Github CI: Remove no-longer needed workaround * Github CI: Use correct comment syntax on Windows * Github CI: Use Windows paths on Windows * Github CI: Drop Ubuntu 16.04 and clang < 8, disable 32 bits We're having issues due to yet another change by Github to their image, and Ubuntu 16.04 is EOL soon, so just drop it along with clang 6 and 7 which are not available on Ubuntu 18.04, the new supported LTS. Switching to Ubuntu 18.04 unfortunately triggers issue 19116, which forces us to disable 32 bits for the time being. * Attempt number 328349538459345 https://github.com/dlang/druntime/pull/3392
Comment #21 by dlang-bot — 2021-03-15T15:38:08Z
@Geod24 created dlang/druntime pull request #3398 "Merge stable" mentioning this issue: - Github CI: Drop Ubuntu 16.04 and clang < 8 (#3396) * Github CI: Use dmd-latest Not providing an argument defaults to dmd-latest, which is what we want. * Github CI: Remove no-longer needed workaround * Github CI: Use correct comment syntax on Windows * Github CI: Use Windows paths on Windows * Github CI: Drop Ubuntu 16.04 and clang < 8, disable 32 bits We're having issues due to yet another change by Github to their image, and Ubuntu 16.04 is EOL soon, so just drop it along with clang 6 and 7 which are not available on Ubuntu 18.04, the new supported LTS. Switching to Ubuntu 18.04 unfortunately triggers issue 19116, which forces us to disable 32 bits for the time being. * Attempt number 328349538459345 https://github.com/dlang/druntime/pull/3398
Comment #22 by dlang-bot — 2021-03-15T22:21:43Z
dlang/druntime pull request #3398 "Merge stable" was merged into master: - 0c9d37ca950b7400397a7ecc67daaa16f8cb7427 by Mathias LANG: Github CI: Drop Ubuntu 16.04 and clang < 8 (#3396) * Github CI: Use dmd-latest Not providing an argument defaults to dmd-latest, which is what we want. * Github CI: Remove no-longer needed workaround * Github CI: Use correct comment syntax on Windows * Github CI: Use Windows paths on Windows * Github CI: Drop Ubuntu 16.04 and clang < 8, disable 32 bits We're having issues due to yet another change by Github to their image, and Ubuntu 16.04 is EOL soon, so just drop it along with clang 6 and 7 which are not available on Ubuntu 18.04, the new supported LTS. Switching to Ubuntu 18.04 unfortunately triggers issue 19116, which forces us to disable 32 bits for the time being. * Attempt number 328349538459345 https://github.com/dlang/druntime/pull/3398
Comment #23 by ibuclaw — 2023-01-02T21:07:19Z
This was fixed, minimum working DMD version for recent x86 OS's is dmd-2.097.1