You are not logged in.

#1 Yesterday 04:49:43

LinuxLover471
Member
Registered: 2025-02-23
Posts: 125

SDL_dummy_main.c.o causes failed compilation in dhewm3 and mgba-qt-git

Hello! I hope that you are doing well.

I was trying to compile mgba-qt-git and I got hit with an error mid compilation.

[276/452] Linking C executable sdl/mgba
FAILED: sdl/mgba 
: && /usr/lib/ccache/bin/cc -march=native -O3 -pipe -fno-plt -fexceptions         -Wp,-D_FORTIFY_SOURCE=3 -Wformat -Werror=format-security         -fstack-clash-protection -fcf-protection         -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer -flto=auto -Wall -Wextra -Wno-missing-field-initializers -Werror=implicit-function-declaration -Werror=implicit-int -fwrapv -Werror=incompatible-pointer-types -pthread -O3 -DNDEBUG -flto -Wl,-O1 -Wl,--sort-common -Wl,--as-needed -Wl,-z,relro -Wl,-z,now          -Wl,-z,pack-relative-relocs -fuse-ld=mold -flto=auto sdl/CMakeFiles/mgba-sdl.dir/sdl-audio.c.o sdl/CMakeFiles/mgba-sdl.dir/sdl-events.c.o sdl/CMakeFiles/mgba-sdl.dir/gl-common.c.o sdl/CMakeFiles/mgba-sdl.dir/main.c.o sdl/CMakeFiles/mgba-sdl.dir/gl-sdl.c.o sdl/CMakeFiles/mgba-sdl.dir/gles2-sdl.c.o sdl/CMakeFiles/mgba-sdl.dir/sw-sdl2.c.o -o sdl/mgba  libmgba.so.0.11.0  /usr/lib/libSDL2.so  /usr/lib/libSDL2main.a  /usr/lib/libSDL2.so  /usr/lib/libGL.so  /usr/lib/libEGL.so  /usr/lib/libepoxy.so  -ledit  -lavcodec  -lavfilter  -lavformat  -lavutil  -lswscale  -lswresample  /usr/lib/libzip.so.5.5  /usr/lib/libfreetype.so  /usr/lib/libjson-c.so.5.4.0  /usr/lib/libz.so  /usr/lib/libpng.so  /usr/lib/libsqlite3.so  -lelf  /usr/lib/liblua5.4.so  /usr/lib/libz.so  /usr/lib/libpng.so  /usr/lib/libsqlite3.so  -lelf  /usr/lib/liblua5.4.so  -lm  /usr/lib/libSDL2main.a  /usr/lib/libEGL.so  /usr/lib/libepoxy.so && :
mold: fatal: SDL_dummy_main.c.o: not claimed by the LTO plugin; please make sure you are using the same compiler of the same version for all object files <<<<< This is the error.
collect2: error: ld returned 1 exit status
[277/452] Automatic MOC for target mgba-qt
ninja: build stopped: subcommand failed.
==> ERROR: A failure occurred in build().
    Aborting...

I have also noticed that this issue doesn't appear if I remove -fuse-ld=mold option from makepkg and remove mold. It then compiles successfully.
This issue also appears in the package dhewm3. Do I have to report it to the developer of mold or is this a known issue that someone can help me fix?

System info

System:
  Kernel: 6.14.10-zen1-1-zen arch: x86_64 bits: 64 compiler: gcc v: 15.1.1
  Desktop: KDE Plasma v: 6.3.5 tk: Qt v: N/A wm: kwin_x11 dm: SDDM
    Distro: Arch Linux
Machine:
  Type: Desktop Mobo: Gigabyte model: G31M-ES2L serial: <superuser required>
    BIOS: Award v: FI date: 08/09/2010
CPU:
  Info: quad core model: Intel Core2 Quad Q9550 bits: 64 type: MCP
    arch: Penryn rev: A cache: L1: 256 KiB L2: 12 MiB
  Speed (MHz): avg: 2834 min/max: 2000/2834 cores: 1: 2834 2: 2834 3: 2834
    4: 2834 bogomips: 22666
  Flags: ht lm nx pae sse sse2 sse3 sse4_1 ssse3
Graphics:
  Device-1: NVIDIA GK107 [GeForce GT 740] driver: nvidia v: 470.256.02
    arch: Kepler-2 pcie: speed: 2.5 GT/s lanes: 16 ports: active: none
    off: HDMI-A-1 empty: DVI-I-1,VGA-1 bus-ID: 01:00.0 chip-ID: 10de:0fc8
  Display: x11 server: X.org v: 1.21.1.16 with: Xwayland v: 24.1.6
    compositor: kwin_x11 driver: X: loaded: nvidia unloaded: modesetting
    alternate: fbdev,nouveau,nv,vesa gpu: nvidia,nvidia-nvswitch
    display-ID: :0 note: <missing: xdpyinfo/xrandr>
  Monitor-1: HDMI-A-1 model: LG (GoldStar) FHD res: 1920x1080 dpi: 102
    diag: 546mm (21.5")
  API: OpenGL Message: Unable to show GL data. glxinfo is missing.
  Info: Tools: de: kscreen-console,kscreen-doctor
    gpu: nvidia-settings,nvidia-smi x11: xprop
Audio:
  Device-1: Intel NM10/ICH7 Family High Definition Audio
    vendor: Gigabyte GA-D525TUD driver: snd_hda_intel v: kernel bus-ID: 00:1b.0
    chip-ID: 8086:27d8
  Device-2: NVIDIA GK107 HDMI Audio driver: snd_hda_intel v: kernel pcie:
    speed: 2.5 GT/s lanes: 16 bus-ID: 01:00.1 chip-ID: 10de:0e1b
  API: ALSA v: k6.14.10-zen1-1-zen status: kernel-api
  Server-1: JACK v: 1.9.22 status: off
  Server-2: PipeWire v: 1.4.5 status: active with: 1: pipewire-pulse
    status: active 2: wireplumber status: active 3: pipewire-alsa type: plugin
Network:
  Message: No PCI device data found.
  Device-1: Ralink 802.11 n WLAN driver: rt2800usb type: USB rev: 2.0
    speed: 480 Mb/s lanes: 1 bus-ID: 2-6:3 chip-ID: 148f:5370
  IF: wlp0s29f7u6 state: up mac: <filter>
Drives:
  Local Storage: total: 1.38 TiB used: 55.5 GiB (3.9%)
  ID-1: /dev/sda vendor: A-Data model: SU800 size: 476.94 GiB
    speed: <unknown> serial: <filter>
  ID-2: /dev/sdb vendor: Toshiba model: DT01ACA100 size: 931.51 GiB
    speed: <unknown> serial: <filter>
Partition:
  ID-1: / size: 68.35 GiB used: 16.37 GiB (23.9%) fs: ext4 dev: /dev/sda1
  ID-2: /home size: 77.23 GiB used: 38.23 GiB (49.5%) fs: ext4
    dev: /dev/sda6
Swap:
  ID-1: swap-1 type: partition size: 7.91 GiB used: 924.5 MiB (11.4%)
    priority: -2 dev: /dev/sda3
Sensors:
  System Temperatures: cpu: 67.0 C mobo: N/A gpu: nvidia temp: 57 C
  Fan Speeds (rpm): cpu: 2419 fan-2: 0 gpu: nvidia fan: 42%
  Power: 12v: N/A 5v: 2.93 3.3v: N/A vbat: 3.22
Info:
  Memory: total: 4 GiB available: 3.82 GiB used: 1.31 GiB (34.4%)
  Processes: 189 Power: uptime: 1h 42m wakeups: 1 Init: systemd v: 257
    default: graphical
  Packages: pm: pacman pkgs: 866 Compilers: clang: 19.1.7 gcc: 15.1.1
    Shell: Bash v: 5.2.37 running-in: konsole inxi: 3.3.38

Thanks in advance!

Offline

#2 Yesterday 07:18:36

seth
Member
Registered: 2012-09-03
Posts: 64,305

Re: SDL_dummy_main.c.o causes failed compilation in dhewm3 and mgba-qt-git

I have also noticed that this issue doesn't appear if I remove -fuse-ld=mold option from makepkg and remove mold. It then compiles successfully.

https://github.com/rui314/mold/issues?q … version%22

Sanity check: did you first (start to) build w/o mold and then "makepkg -e" re-use the previous build? Or does this happen w/ a clean build?

Offline

#3 Yesterday 08:38:29

LinuxLover471
Member
Registered: 2025-02-23
Posts: 125

Re: SDL_dummy_main.c.o causes failed compilation in dhewm3 and mgba-qt-git

I firstly builded with mold, and when it failed, I nuked the /tmp/makepkg/ directory with sudo rm -rf and rebuilded after removing mold through pacman and makepkg.conf.

I will check into the github pages, and one of them listed a flag and using the flag didn't work.

P.S The github pages didn't solve the issue.

Thank you!

Last edited by LinuxLover471 (Yesterday 12:05:58)

Offline

#4 Yesterday 12:27:09

seth
Member
Registered: 2012-09-03
Posts: 64,305

Re: SDL_dummy_main.c.o causes failed compilation in dhewm3 and mgba-qt-git

https://github.com/rui314/mold/issues/1 … 2016481797 ?
That suggests to rebuild (in that case protobuf) the linked system lib (in your case likely sdl2) w/ -ffat-lto-objects

It's probably easier to build mgba w/o LTO (if you badly want to use mold)

Offline

#5 Yesterday 16:05:29

LinuxLover471
Member
Registered: 2025-02-23
Posts: 125

Re: SDL_dummy_main.c.o causes failed compilation in dhewm3 and mgba-qt-git

That suggests to rebuild (in that case protobuf) the linked system lib (in your case likely sdl2) w/ -ffat-lto-objects

Yeah, I tried doing that, I did read the pages infact. And it didn't compile. I had added the flags just after the LTOFLAGS section after the -flto=auto.

It's probably easier to build mgba w/o LTO (if you badly want to use mold)

Yeah, you are right, I can compile either normally or without LTO at all. But that won't fix the issue, so I guess I should go the github page and create an issue?

Offline

#6 Yesterday 18:14:56

loqs
Member
Registered: 2014-03-06
Posts: 18,458

Re: SDL_dummy_main.c.o causes failed compilation in dhewm3 and mgba-qt-git

Rebuilding sdl2-compat with CFLAGS+=' -ffat-lto-objects' then building mgba-git with that with succeeds.  Could the default linker be silently falling back to libSDL2.so when it can not find the required symbols in libSDL2main.a? To me this looks like an issue in sdl2-compat shipping a static library without using '-ffat-lto-objects'.

Offline

#7 Today 05:57:09

LinuxLover471
Member
Registered: 2025-02-23
Posts: 125

Re: SDL_dummy_main.c.o causes failed compilation in dhewm3 and mgba-qt-git

So, this issue happening because mold is too strict? And the pacman packaged sdl2-compat ships with static libraries? I will report back after trying to compile jst like @loqs suggested.

Offline

#8 Today 12:45:17

Lone_Wolf
Administrator
From: Netherlands, Europe
Registered: 2005-10-04
Posts: 13,755

Re: SDL_dummy_main.c.o causes failed compilation in dhewm3 and mgba-qt-git

loqs wrote:

To me this looks like an issue in sdl2-compat shipping a static library without using '-ffat-lto-objects'.

man makepkg.conf wrote:

staticlibs
Leave static library (.a) files in packages. Specify !staticlibs to remove them, if they have a shared counterpart.

It's probably not intentional to ship those librairies.
In atleast one of my aur packages I have to remove some static libs manually.


Disliking systemd intensely, but not satisfied with alternatives so focusing on taming systemd.

clean chroot building not flexible enough ?
Try clean chroot manager by graysky

Offline

#9 Today 13:39:47

loqs
Member
Registered: 2014-03-06
Posts: 18,458

Re: SDL_dummy_main.c.o causes failed compilation in dhewm3 and mgba-qt-git

Removing the static libs that do not have shared counterparts does work as well.

Lone_Wolf wrote:

It's probably not intentional to ship those librairies.

They were shipped in sdl2 and that was intentional based on https://gitlab.archlinux.org/archlinux/ … GBUILD#L24 and  https://gitlab.archlinux.org/archlinux/ … GBUILD#L36.

Either way it looks to be a packaging issue in sdl2-compat.

Last edited by loqs (Today 13:40:17)

Offline

#10 Today 13:56:41

LinuxLover471
Member
Registered: 2025-02-23
Posts: 125

Re: SDL_dummy_main.c.o causes failed compilation in dhewm3 and mgba-qt-git

I just compiled sdl2-compat-git, with the -ffat-lto-objects flag. And then an update of mold kicked in, I thought that it might fix the issue, so I removed the flag and tried to compile both dhewm3 and mgba-qt-git, and it worked flawlessly. The compilation worked properly. I checked the changelog at the mold github, but I don't see any significant bug patches other than performance based ones.

Offline

#11 Today 14:25:49

loqs
Member
Registered: 2014-03-06
Posts: 18,458

Re: SDL_dummy_main.c.o causes failed compilation in dhewm3 and mgba-qt-git

mold 2.40.1 (96c798d7be595d833f3f7d33ca32fd43f2731b89; compatible with GNU ld)

With the above I can still reproduce the issue using sdl2-compat 2.32.56-1 from extra. Were you using a locally built sdl2-compat that used mold?

Offline

Board footer

Powered by FluxBB