drhelius / Gearsystem

Sega Master System / Game Gear / SG-1000 emulator for macOS, Windows, Linux, BSD and RetroArch.
https://x.com/drhelius
GNU General Public License v3.0
247 stars 45 forks source link

Issues compiling for linux (Alpine) #84

Closed LAC-Tech closed 6 months ago

LAC-Tech commented 6 months ago

Error is:

$ make
g++ -I../ -I../../ -Wall -Wextra -Wformat -std=c++11 -DEMULATOR_BUILD=\""gearsystem-3.4.1-60-ga2e8af2"\" -DNDEBUG -O3 -flto=auto `sdl2-config --cflags` -c -o main.o ../desktop-shared/main.cpp
g++ -I../ -I../../ -Wall -Wextra -Wformat -std=c++11 -DEMULATOR_BUILD=\""gearsystem-3.4.1-60-ga2e8af2"\" -DNDEBUG -O3 -flto=auto `sdl2-config --cflags` -c -o emu.o ../desktop-shared/emu.cpp
g++ -I../ -I../../ -Wall -Wextra -Wformat -std=c++11 -DEMULATOR_BUILD=\""gearsystem-3.4.1-60-ga2e8af2"\" -DNDEBUG -O3 -flto=auto `sdl2-config --cflags` -c -o gui.o ../desktop-shared/gui.cpp
g++ -I../ -I../../ -Wall -Wextra -Wformat -std=c++11 -DEMULATOR_BUILD=\""gearsystem-3.4.1-60-ga2e8af2"\" -DNDEBUG -O3 -flto=auto `sdl2-config --cflags` -c -o gui_debug.o ../desktop-shared/gui_debug.cpp
g++ -I../ -I../../ -Wall -Wextra -Wformat -std=c++11 -DEMULATOR_BUILD=\""gearsystem-3.4.1-60-ga2e8af2"\" -DNDEBUG -O3 -flto=auto `sdl2-config --cflags` -c -o gui_events.o ../desktop-shared/gui_events.cpp
g++ -I../ -I../../ -Wall -Wextra -Wformat -std=c++11 -DEMULATOR_BUILD=\""gearsystem-3.4.1-60-ga2e8af2"\" -DNDEBUG -O3 -flto=auto `sdl2-config --cflags` -c -o application.o ../desktop-shared/application.cpp
g++ -I../ -I../../ -Wall -Wextra -Wformat -std=c++11 -DEMULATOR_BUILD=\""gearsystem-3.4.1-60-ga2e8af2"\" -DNDEBUG -O3 -flto=auto `sdl2-config --cflags` -c -o config.o ../desktop-shared/config.cpp
g++ -I../ -I../../ -Wall -Wextra -Wformat -std=c++11 -DEMULATOR_BUILD=\""gearsystem-3.4.1-60-ga2e8af2"\" -DNDEBUG -O3 -flto=auto `sdl2-config --cflags` -c -o renderer.o ../desktop-shared/renderer.cpp
g++ -I../ -I../../ -Wall -Wextra -Wformat -std=c++11 -DEMULATOR_BUILD=\""gearsystem-3.4.1-60-ga2e8af2"\" -DNDEBUG -O3 -flto=auto `sdl2-config --cflags` -c -o imgui_impl_sdl.o ../desktop-shared/imgui/imgui_impl_sdl.cpp
g++ -I../ -I../../ -Wall -Wextra -Wformat -std=c++11 -DEMULATOR_BUILD=\""gearsystem-3.4.1-60-ga2e8af2"\" -DNDEBUG -O3 -flto=auto `sdl2-config --cflags` -c -o imgui_impl_opengl2.o ../desktop-shared/imgui/imgui_impl_opengl2.cpp
g++ -I../ -I../../ -Wall -Wextra -Wformat -std=c++11 -DEMULATOR_BUILD=\""gearsystem-3.4.1-60-ga2e8af2"\" -DNDEBUG -O3 -flto=auto `sdl2-config --cflags` -c -o imgui.o ../desktop-shared/imgui/imgui.cpp
g++ -I../ -I../../ -Wall -Wextra -Wformat -std=c++11 -DEMULATOR_BUILD=\""gearsystem-3.4.1-60-ga2e8af2"\" -DNDEBUG -O3 -flto=auto `sdl2-config --cflags` -c -o imgui_demo.o ../desktop-shared/imgui/imgui_demo.cpp
g++ -I../ -I../../ -Wall -Wextra -Wformat -std=c++11 -DEMULATOR_BUILD=\""gearsystem-3.4.1-60-ga2e8af2"\" -DNDEBUG -O3 -flto=auto `sdl2-config --cflags` -c -o imgui_draw.o ../desktop-shared/imgui/imgui_draw.cpp
g++ -I../ -I../../ -Wall -Wextra -Wformat -std=c++11 -DEMULATOR_BUILD=\""gearsystem-3.4.1-60-ga2e8af2"\" -DNDEBUG -O3 -flto=auto `sdl2-config --cflags` -c -o imgui_widgets.o ../desktop-shared/imgui/imgui_widgets.cpp
g++ -I../ -I../../ -Wall -Wextra -Wformat -std=c++11 -DEMULATOR_BUILD=\""gearsystem-3.4.1-60-ga2e8af2"\" -DNDEBUG -O3 -flto=auto `sdl2-config --cflags` -c -o ImGuiFileBrowser.o ../desktop-shared/FileBrowser/ImGuiFileBrowser.cpp
g++ -I../ -I../../ -Wall -Wextra -Wformat -std=c++11 -DEMULATOR_BUILD=\""gearsystem-3.4.1-60-ga2e8af2"\" -DNDEBUG -O3 -flto=auto `sdl2-config --cflags` -c -o Audio.o ../../src/Audio.cpp
g++ -I../ -I../../ -Wall -Wextra -Wformat -std=c++11 -DEMULATOR_BUILD=\""gearsystem-3.4.1-60-ga2e8af2"\" -DNDEBUG -O3 -flto=auto `sdl2-config --cflags` -c -o Cartridge.o ../../src/Cartridge.cpp
g++ -I../ -I../../ -Wall -Wextra -Wformat -std=c++11 -DEMULATOR_BUILD=\""gearsystem-3.4.1-60-ga2e8af2"\" -DNDEBUG -O3 -flto=auto `sdl2-config --cflags` -c -o CodemastersMemoryRule.o ../../src/CodemastersMemoryRule.cpp
g++ -I../ -I../../ -Wall -Wextra -Wformat -std=c++11 -DEMULATOR_BUILD=\""gearsystem-3.4.1-60-ga2e8af2"\" -DNDEBUG -O3 -flto=auto `sdl2-config --cflags` -c -o GameGearIOPorts.o ../../src/GameGearIOPorts.cpp
g++ -I../ -I../../ -Wall -Wextra -Wformat -std=c++11 -DEMULATOR_BUILD=\""gearsystem-3.4.1-60-ga2e8af2"\" -DNDEBUG -O3 -flto=auto `sdl2-config --cflags` -c -o GearsystemCore.o ../../src/GearsystemCore.cpp
g++ -I../ -I../../ -Wall -Wextra -Wformat -std=c++11 -DEMULATOR_BUILD=\""gearsystem-3.4.1-60-ga2e8af2"\" -DNDEBUG -O3 -flto=auto `sdl2-config --cflags` -c -o Input.o ../../src/Input.cpp
g++ -I../ -I../../ -Wall -Wextra -Wformat -std=c++11 -DEMULATOR_BUILD=\""gearsystem-3.4.1-60-ga2e8af2"\" -DNDEBUG -O3 -flto=auto `sdl2-config --cflags` -c -o KoreanMemoryRule.o ../../src/KoreanMemoryRule.cpp
g++ -I../ -I../../ -Wall -Wextra -Wformat -std=c++11 -DEMULATOR_BUILD=\""gearsystem-3.4.1-60-ga2e8af2"\" -DNDEBUG -O3 -flto=auto `sdl2-config --cflags` -c -o Memory.o ../../src/Memory.cpp
g++ -I../ -I../../ -Wall -Wextra -Wformat -std=c++11 -DEMULATOR_BUILD=\""gearsystem-3.4.1-60-ga2e8af2"\" -DNDEBUG -O3 -flto=auto `sdl2-config --cflags` -c -o MemoryRule.o ../../src/MemoryRule.cpp
g++ -I../ -I../../ -Wall -Wextra -Wformat -std=c++11 -DEMULATOR_BUILD=\""gearsystem-3.4.1-60-ga2e8af2"\" -DNDEBUG -O3 -flto=auto `sdl2-config --cflags` -c -o MSXMemoryRule.o ../../src/MSXMemoryRule.cpp
g++ -I../ -I../../ -Wall -Wextra -Wformat -std=c++11 -DEMULATOR_BUILD=\""gearsystem-3.4.1-60-ga2e8af2"\" -DNDEBUG -O3 -flto=auto `sdl2-config --cflags` -c -o opcodes.o ../../src/opcodes.cpp
g++ -I../ -I../../ -Wall -Wextra -Wformat -std=c++11 -DEMULATOR_BUILD=\""gearsystem-3.4.1-60-ga2e8af2"\" -DNDEBUG -O3 -flto=auto `sdl2-config --cflags` -c -o opcodes_cb.o ../../src/opcodes_cb.cpp
g++ -I../ -I../../ -Wall -Wextra -Wformat -std=c++11 -DEMULATOR_BUILD=\""gearsystem-3.4.1-60-ga2e8af2"\" -DNDEBUG -O3 -flto=auto `sdl2-config --cflags` -c -o opcodes_ed.o ../../src/opcodes_ed.cpp
g++ -I../ -I../../ -Wall -Wextra -Wformat -std=c++11 -DEMULATOR_BUILD=\""gearsystem-3.4.1-60-ga2e8af2"\" -DNDEBUG -O3 -flto=auto `sdl2-config --cflags` -c -o Processor.o ../../src/Processor.cpp
g++ -I../ -I../../ -Wall -Wextra -Wformat -std=c++11 -DEMULATOR_BUILD=\""gearsystem-3.4.1-60-ga2e8af2"\" -DNDEBUG -O3 -flto=auto `sdl2-config --cflags` -c -o RomOnlyMemoryRule.o ../../src/RomOnlyMemoryRule.cpp
g++ -I../ -I../../ -Wall -Wextra -Wformat -std=c++11 -DEMULATOR_BUILD=\""gearsystem-3.4.1-60-ga2e8af2"\" -DNDEBUG -O3 -flto=auto `sdl2-config --cflags` -c -o SegaMemoryRule.o ../../src/SegaMemoryRule.cpp
g++ -I../ -I../../ -Wall -Wextra -Wformat -std=c++11 -DEMULATOR_BUILD=\""gearsystem-3.4.1-60-ga2e8af2"\" -DNDEBUG -O3 -flto=auto `sdl2-config --cflags` -c -o SG1000MemoryRule.o ../../src/SG1000MemoryRule.cpp
g++ -I../ -I../../ -Wall -Wextra -Wformat -std=c++11 -DEMULATOR_BUILD=\""gearsystem-3.4.1-60-ga2e8af2"\" -DNDEBUG -O3 -flto=auto `sdl2-config --cflags` -c -o SmsIOPorts.o ../../src/SmsIOPorts.cpp
g++ -I../ -I../../ -Wall -Wextra -Wformat -std=c++11 -DEMULATOR_BUILD=\""gearsystem-3.4.1-60-ga2e8af2"\" -DNDEBUG -O3 -flto=auto `sdl2-config --cflags` -c -o Video.o ../../src/Video.cpp
g++ -I../ -I../../ -Wall -Wextra -Wformat -std=c++11 -DEMULATOR_BUILD=\""gearsystem-3.4.1-60-ga2e8af2"\" -DNDEBUG -O3 -flto=auto `sdl2-config --cflags` -c -o BootromMemoryRule.o ../../src/BootromMemoryRule.cpp
g++ -I../ -I../../ -Wall -Wextra -Wformat -std=c++11 -DEMULATOR_BUILD=\""gearsystem-3.4.1-60-ga2e8af2"\" -DNDEBUG -O3 -flto=auto `sdl2-config --cflags` -c -o JanggunMemoryRule.o ../../src/JanggunMemoryRule.cpp
g++ -I../ -I../../ -Wall -Wextra -Wformat -std=c++11 -DEMULATOR_BUILD=\""gearsystem-3.4.1-60-ga2e8af2"\" -DNDEBUG -O3 -flto=auto `sdl2-config --cflags` -c -o Blip_Buffer.o ../../src/audio/Blip_Buffer.cpp
g++ -I../ -I../../ -Wall -Wextra -Wformat -std=c++11 -DEMULATOR_BUILD=\""gearsystem-3.4.1-60-ga2e8af2"\" -DNDEBUG -O3 -flto=auto `sdl2-config --cflags` -c -o Effects_Buffer.o ../../src/audio/Effects_Buffer.cpp
g++ -I../ -I../../ -Wall -Wextra -Wformat -std=c++11 -DEMULATOR_BUILD=\""gearsystem-3.4.1-60-ga2e8af2"\" -DNDEBUG -O3 -flto=auto `sdl2-config --cflags` -c -o Sms_Apu.o ../../src/audio/Sms_Apu.cpp
g++ -I../ -I../../ -Wall -Wextra -Wformat -std=c++11 -DEMULATOR_BUILD=\""gearsystem-3.4.1-60-ga2e8af2"\" -DNDEBUG -O3 -flto=auto `sdl2-config --cflags` -c -o Multi_Buffer.o ../../src/audio/Multi_Buffer.cpp
g++ -I../ -I../../ -Wall -Wextra -Wformat -std=c++11 -DEMULATOR_BUILD=\""gearsystem-3.4.1-60-ga2e8af2"\" -DNDEBUG -O3 -flto=auto `sdl2-config --cflags` -c -o Sound_Queue.o ../audio-shared/Sound_Queue.cpp
g++ -o gearsystem main.o emu.o gui.o gui_debug.o gui_events.o application.o config.o renderer.o imgui_impl_sdl.o imgui_impl_opengl2.o imgui.o imgui_demo.o imgui_draw.o imgui_widgets.o ImGuiFileBrowser.o Audio.o Cartridge.o CodemastersMemoryRule.o GameGearIOPorts.o GearsystemCore.o Input.o KoreanMemoryRule.o Memory.o MemoryRule.o MSXMemoryRule.o opcodes.o opcodes_cb.o opcodes_ed.o Processor.o RomOnlyMemoryRule.o SegaMemoryRule.o SG1000MemoryRule.o SmsIOPorts.o Video.o BootromMemoryRule.o JanggunMemoryRule.o Blip_Buffer.o Effects_Buffer.o Sms_Apu.o Multi_Buffer.o Sound_Queue.o  -lGL -lGLEW -ldl `sdl2-config --libs`
/usr/include/fortify/stdio.h: In function '__to_xstring.constprop':
/usr/include/fortify/stdio.h:73:28: error: inlining failed in call to 'always_inline' 'vsnprintf': function body can be overwritten at link time
   73 | _FORTIFY_FN(vsnprintf) int vsnprintf(char * _FORTIFY_POS0 __s, size_t __n,
      |                            ^
/usr/include/c++/13.2.1/ext/string_conversions.h:113:32: note: called from here
  113 |       const int __len = __convf(__s, __n, __fmt, __args);
      |                                ^
make[1]: *** [/tmp/ccMcJJdl.mk:41: /tmp/ccapcMON.ltrans13.ltrans.o] Error 1
make[1]: *** Waiting for unfinished jobs....
lto-wrapper: fatal error: make returned 2 exit status
compilation terminated.
/usr/lib/gcc/x86_64-alpine-linux-musl/13.2.1/../../../../x86_64-alpine-linux-musl/bin/ld: error: lto-wrapper failed
collect2: error: ld returned 1 exit status
make: *** [../desktop-shared/Makefile.common:108: gearsystem] Error 1

Versions:

$ g++ --version
g++ (Alpine 13.2.1_git20231014) 13.2.1 20231014
Copyright (C) 2023 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

$ make --version
GNU Make 4.4.1
Built for x86_64-alpine-linux-musl
Copyright (C) 1988-2023 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <https://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

Possibly due to me using musl? My C++ is not good.

drhelius commented 6 months ago

Yes this is probably because you are using Alpine/musl.

I would try removing the '-flto=auto' flag.

drhelius commented 6 months ago

Closing AFAIK is not an error I can fix.