adventuregamestudio / ags

AGS editor and engine source code
Other
701 stars 160 forks source link

failed compiling AGS on Ubuntu 20.04 #1164

Closed legluondunet closed 3 years ago

legluondunet commented 3 years ago

Hello AGS dev team, I would like to compile AGS on my computer (Ubuntu 20.04 64 bits). I installed all needed dependencies you listed but at the end of compilation I obtained this error message:

CXXFLAGS = -std=c++11 -Werror=delete-non-virtual-dtor -O2 -g -fsigned-char -fno-strict-aliasing -fwrapv -Wunused-result -Wno-unused-value -Werror=write-strings -Werror=format -Werror=format-security -Werror=implicit-function-declaration -DNDEBUG -DALLEGRO_STATICLINK -DALLEGRO_NO_COMPATIBILITY -DALLEGRO_NO_FIX_ALIASES -DALLEGRO_NO_FIX_CLASS -DLINUX_VERSION -DBUILTIN_PLUGINS -DHAVE_FSEEKO -DDISABLE_MPEG_AUDIO -DAGS_CASE_SENSITIVE_FILESYSTEM -DAGS_HAS_CD_AUDIO -DAGS_RUNTIME_PATCH_ALLEGRO -D_FILE_OFFSET_BITS=64 -DRTLD_NEXT -I ../Common/libsrc/freetype-2.1.3/include -I../Engine -I../Common -I../Common/libinclude -I../Common/libsrc/alfont-2.0.9 -I../Plugins -I../Engine/libsrc/glad/include 

MMFLAGS = 

LDFLAGS = -rdynamic -Wl,--as-needed 

LIBS = -Wl,-Bdynamic -lalleg -lX11 -logg -ltheora -logg -lvorbis -lvorbisfile -ldl -lpthread -lc -lm -lstdc++ -Wl,--push-state,-Bstatic -laldmb -ldumb -Wl,--pop-state 

Linking engine...
/usr/bin/x86_64-linux-gnu-ld.bfd.real: /usr/lib/gcc/x86_64-linux-gnu/9/../../../x86_64-linux-gnu/libdumb.a(itrender.o): in function `update_effects':
(.text+0x3a58): undefined reference to `__exp_finite'
/usr/bin/x86_64-linux-gnu-ld.bfd.real: (.text+0x3a87): undefined reference to `__exp_finite'
/usr/bin/x86_64-linux-gnu-ld.bfd.real: /usr/lib/gcc/x86_64-linux-gnu/9/../../../x86_64-linux-gnu/libdumb.a(itrender.o): in function `process_tick':
(.text+0x3cf0): undefined reference to `__exp_finite'
/usr/bin/x86_64-linux-gnu-ld.bfd.real: (.text+0x3d34): undefined reference to `__exp_finite'
/usr/bin/x86_64-linux-gnu-ld.bfd.real: (.text+0x3e02): undefined reference to `__exp_finite'
/usr/bin/x86_64-linux-gnu-ld.bfd.real: /usr/lib/gcc/x86_64-linux-gnu/9/../../../x86_64-linux-gnu/libdumb.a(itrender.o):(.text+0x4664): more undefined references to `__exp_finite' follow
/usr/bin/x86_64-linux-gnu-ld.bfd.real: /usr/lib/gcc/x86_64-linux-gnu/9/../../../x86_64-linux-gnu/libdumb.a(itrender.o): in function `it_filter.isra.0':
(.text+0x4767): undefined reference to `__exp2_finite'
/usr/bin/x86_64-linux-gnu-ld.bfd.real: (.text+0x47a4): undefined reference to `__exp_finite'
/usr/bin/x86_64-linux-gnu-ld.bfd.real: /usr/lib/gcc/x86_64-linux-gnu/9/../../../x86_64-linux-gnu/libdumb.a(clickrem.o): in function `dumb_remove_clicks.part.0':
(.text+0x150): undefined reference to `__exp2_finite'
/usr/bin/x86_64-linux-gnu-ld.bfd.real: /usr/lib/gcc/x86_64-linux-gnu/9/../../../x86_64-linux-gnu/libdumb.a(readxm.o): in function `dumb_read_xm_quick':
(.text+0xa76): undefined reference to `__exp_finite'
/usr/bin/x86_64-linux-gnu-ld.bfd.real: /usr/lib/gcc/x86_64-linux-gnu/9/../../../x86_64-linux-gnu/libdumb.a(readmod.o): in function `dumb_read_mod_quick':
(.text+0x3b7): undefined reference to `__exp_finite'
/usr/bin/x86_64-linux-gnu-ld.bfd.real: (.text+0x7bb): undefined reference to `__log_finite'
collect2: error: ld returned 1 exit status
make: *** [Makefile:40: ags] Error 1
make: Leaving directory '/home/legluondunet/Autres_applications/Jeux/AGS/ags/Engine'

Thank you for your help.

ivan-mogilko commented 3 years ago

Please tell which branch from this repository are you compiling, and what compiler are you using? From the first glance looks like some difference in C library.

legluondunet commented 3 years ago

I just followed this tutorial:

https://github.com/adventuregamestudio/ags/blob/master/debian/README.md

sudo apt-get install git debhelper build-essential pkg-config libaldmb1-dev libfreetype6-dev libtheora-dev libvorbis-dev libogg-dev
git clone git://github.com/adventuregamestudio/ags.git
cd ags
make --directory=Engine

My gcc version:

$ gcc --version
gcc (Ubuntu 9.3.0-17ubuntu1~20.04) 9.3.0

Do you need others infos?

rofl0r commented 3 years ago

the -lc -lstdc++ stuff in LIBS looks bogus. the compiler should add those itself as needed, eventually hardcoding them like that causes symbols from libc referenced by libstdc++/libm not being found. it would be interesting to see the complete compiler command for the link, i believe it is displayed with make V=1 when inside the Engine directory.

legluondunet commented 3 years ago

as requested by @rofl0r , you will find full compilation log with make=v1 command here: https://paste.ubuntu.com/p/NBXHzbhH9y

rofl0r commented 3 years ago

try to run manually:

g++ -o ags libsrc/almp3/almp3.o libsrc/almp3-2.0.5/decoder/common.o libsrc/almp3-2.0.5/decoder/dct64_i386.o libsrc/almp3-2.0.5/decoder/decode_i386.o libsrc/almp3-2.0.5/decoder/interface.o libsrc/almp3-2.0.5/decoder/layer2.o libsrc/almp3-2.0.5/decoder/layer3.o libsrc/almp3-2.0.5/decoder/tabinit.o libsrc/alogg/alogg.o libsrc/apeg-1.2.1/adisplay.o libsrc/apeg-1.2.1/getbits.o libsrc/apeg-1.2.1/getblk.o libsrc/apeg-1.2.1/gethdr.o libsrc/apeg-1.2.1/getpic.o libsrc/apeg-1.2.1/idct.o libsrc/apeg-1.2.1/motion.o libsrc/apeg-1.2.1/mpeg1dec.o libsrc/apeg-1.2.1/ogg.o libsrc/apeg-1.2.1/recon.o libsrc/apeg-1.2.1/audio/apegcommon.o libsrc/apeg-1.2.1/audio/aaudio.o libsrc/apeg-1.2.1/audio/dct64.o libsrc/apeg-1.2.1/audio/decode_1to1.o libsrc/apeg-1.2.1/audio/decode_2to1.o libsrc/apeg-1.2.1/audio/decode_4to1.o libsrc/apeg-1.2.1/audio/layer1.o libsrc/apeg-1.2.1/audio/layer2.o libsrc/apeg-1.2.1/audio/layer3.o libsrc/apeg-1.2.1/audio/mpg123.o libsrc/apeg-1.2.1/audio/readers.o libsrc/apeg-1.2.1/audio/tabinit.o libsrc/apeg-1.2.1/audio/vbrhead.o ../Common/libsrc/aastr-0.1.1/aarot.o ../Common/libsrc/aastr-0.1.1/aastr.o ../Common/libsrc/aastr-0.1.1/aautil.o libsrc/hq2x/hq2x3x.o libsrc/allegro-4.2.2-agspatch/midi.o libsrc/libcda-0.5/linux.o libsrc/glad/src/glad.o libsrc/glad/src/glad_glx.o ../Plugins/AGSflashlight/agsflashlight.o ../Plugins/agsblend/AGSBlend.o ../Plugins/ags_snowrain/ags_snowrain.o ../Plugins/ags_parallax/ags_parallax.o ../Plugins/agspalrender/ags_palrender.o ../Plugins/agspalrender/raycast.o ac/guicontrol.o ac/global_object.o ac/route_finder_impl.o ac/button.o ac/roomstatus.o ac/global_button.o ac/global_slider.o ac/global_listbox.o ac/global_parser.o ac/region.o ac/global_dialog.o ac/global_file.o ac/scriptcontainers.o ac/draw_software.o ac/global_viewframe.o ac/walkbehind.o ac/global_datetime.o ac/richgamemedia.o ac/global_debug.o ac/global_audio.o ac/overlay.o ac/global_walkbehind.o ac/global_label.o ac/global_drawingsurface.o ac/route_finder_impl_legacy.o ac/slider.o ac/invwindow.o ac/mouse.o ac/gui.o ac/label.o ac/keycode.o ac/string.o ac/global_string.o ac/display.o ac/global_api.o ac/characterinfo_engine.o ac/cdaudio.o ac/interfacebutton.o ac/global_textbox.o ac/event.o ac/character.o ac/file.o ac/dynamicsprite.o ac/guiinv.o ac/global_hotspot.o ac/global_screen.o ac/system.o ac/characterextras.o ac/game.o ac/global_game.o ac/global_inventoryitem.o ac/viewport_script.o ac/global_mouse.o ac/walkablearea.o ac/route_finder.o ac/global_timer.o ac/global_invwindow.o ac/audiochannel.o ac/dialogoptionsrendering.o ac/roomobject.o ac/dialog.o ac/audioclip.o ac/global_video.o ac/global_palette.o ac/movelist.o ac/interfaceelement.o ac/sprite.o ac/global_record.o ac/gamestate.o ac/timer.o ac/speech.o ac/global_region.o ac/global_viewport.o ac/properties.o ac/listbox.o ac/sys_events.o ac/textbox.o ac/global_walkablearea.o ac/global_gui.o ac/drawingsurface.o ac/datetime.o ac/global_character.o ac/translation.o ac/global_translation.o ac/global_display.o ac/room.o ac/screenoverlay.o ac/gamesetup.o ac/global_room.o ac/viewframe.o ac/draw.o ac/hotspot.o ac/screen.o ac/global_dynamicsprite.o ac/global_overlay.o ac/inventoryitem.o ac/tree_map.o ac/math.o ac/parser.o ac/object.o ac/spritecache_engine.o ac/dynobj/scriptdynamicsprite.o ac/dynobj/scriptdrawingsurface.o ac/dynobj/scriptdict.o ac/dynobj/cc_guiobject.o ac/dynobj/cc_hotspot.o ac/dynobj/cc_agsdynamicobject.o ac/dynobj/managedobjectpool.o ac/dynobj/cc_audioclip.o ac/dynobj/scriptdatetime.o ac/dynobj/cc_character.o ac/dynobj/scriptfile.o ac/dynobj/scriptcamera.o ac/dynobj/scriptviewframe.o ac/dynobj/scriptviewport.o ac/dynobj/cc_dynamicobject.o ac/dynobj/cc_dialog.o ac/dynobj/scriptdialogoptionsrendering.o ac/dynobj/scriptuserobject.o ac/dynobj/scriptoverlay.o ac/dynobj/cc_gui.o ac/dynobj/cc_serializer.o ac/dynobj/cc_inventory.o ac/dynobj/cc_object.o ac/dynobj/cc_region.o ac/dynobj/scriptset.o ac/dynobj/scriptstring.o ac/dynobj/cc_dynamicarray.o ac/dynobj/cc_audiochannel.o ac/statobj/agsstaticobject.o ac/statobj/staticarray.o debug/consoleoutputtarget.o debug/messagebuffer.o debug/filebasedagsdebugger.o debug/debug.o debug/logfile.o device/mousew32.o font/fonts_engine.o game/game_init.o game/savegame_components.o game/savegame_v321.o game/viewport.o game/savegame.o gfx/gfxfilter_aad3d.o gfx/gfxdriverfactory.o gfx/ali3dsw.o gfx/gfxfilter_aaogl.o gfx/gfxfilter_ogl.o gfx/ali3dogl.o gfx/blender.o gfx/gfx_util.o gfx/gfxfilter_allegro.o gfx/gfxfilter_scaling.o gfx/gfxfilter_hqx.o gfx/color_engine.o gfx/gfxdriverbase.o gfx/gfxfilter_d3d.o gui/mylistbox.o gui/guidialog.o gui/animatingguibutton.o gui/newcontrol.o gui/mylabel.o gui/cscidialog.o gui/mypushbutton.o gui/gui_engine.o gui/mytextbox.o main/engine.o main/main_allegro.o main/graphics_mode.o main/quit.o main/game_file.o main/game_start.o main/config.o main/game_run.o main/engine_setup.o main/main.o main/update.o media/audio/sound.o media/audio/soundcache.o media/audio/clip_mymp3.o media/audio/clip_mystaticogg.o media/audio/clip_mydumbmod.o media/audio/queuedaudioitem.o media/audio/ambientsound.o media/audio/clip_mystaticmp3.o media/audio/clip_mymidi.o media/audio/audio.o media/audio/clip_myogg.o media/audio/clip_myjgmod.o media/audio/clip_mywave.o media/audio/soundclip.o media/video/video.o platform/base/agsplatformdriver.o plugin/agsplugin.o plugin/global_plugin.o plugin/pluginobjectreader.o script/script_runtime.o script/cc_error_engine.o script/script_engine.o script/script_api.o script/executingscript.o script/script.o script/runtimescriptvalue.o script/exports.o script/cc_instance.o script/systemimports.o test/test_gfx.o test/test_math.o test/test_memory.o test/test_inifile.o test/test_all.o test/test_file.o test/test_version.o test/test_sprintf.o test/test_string.o platform/linux/acpllnx.o platform/util/pe.o platform/util/libc.o common.a -std=c++11 -Werror=delete-non-virtual-dtor  -O2 -g -fsigned-char -fno-strict-aliasing -fwrapv -Wunused-result -Wno-unused-value -Werror=write-strings -Werror=format -Werror=format-security -Werror=implicit-function-declaration -DNDEBUG -DALLEGRO_STATICLINK -DALLEGRO_NO_COMPATIBILITY -DALLEGRO_NO_FIX_ALIASES -DALLEGRO_NO_FIX_CLASS -DLINUX_VERSION -DBUILTIN_PLUGINS -DHAVE_FSEEKO -DDISABLE_MPEG_AUDIO -DAGS_CASE_SENSITIVE_FILESYSTEM -DAGS_HAS_CD_AUDIO -DAGS_RUNTIME_PATCH_ALLEGRO -D_FILE_OFFSET_BITS=64 -DRTLD_NEXT -I ../Common/libsrc/freetype-2.1.3/include  -I../Engine -I../Common -I../Common/libinclude -I../Common/libsrc/alfont-2.0.9 -I../Plugins -I../Engine/libsrc/glad/include -rdynamic -Wl,--as-needed  -Wl,-Bdynamic  -lalleg -lX11 -logg -ltheora -logg -lvorbis -lvorbisfile -ldl -lpthread -lm -Wl,--push-state,-Bstatic -laldmb -ldumb -Wl,--pop-state

it is the link command of your build log, with -lc and -lstc++ removed.

edit: if the command is too long to paste into the shell, put it into a file and run sh filename

legluondunet commented 3 years ago

done, did not resolve compilation issue, you can consult the full log here: https://paste.ubuntu.com/p/xyD9sZgxT4/

rofl0r commented 3 years ago

i found the bug issue, on ubuntu 20.04 libm uses IFUNC resolvers for the referenced functions in libm, therefore -Wl,--push-state,-Bstatic -laldmb -ldumb -Wl,--pop-state needs to be replaced with just -laldmb -ldumb so the dynamically linked library is used (and preferably put before -lpthread, -lm and other libc/libstdc++ items). also as expected -lc and -lstdc++ can be removed safely. in fact -lstdc++ would even cause a build error when the system compiler is clang, as its libstdc++ is called libc++.

rofl0r commented 3 years ago

for the record, this is readelf output on ubuntu 20.04 libm:

readelf -a  /usr/lib/x86_64-linux-gnu/libm.so.6 | grep __log_finite
   103: 000000000002e4e0    77 IFUNC   GLOBAL DEFAULT   17 __log_finite@GLIBC_2.15
ericoporto commented 3 years ago

@legluondunet the CMake project should work fine on Ubuntu 20.04, CLion naturally supports it, VSCode and other IDEs have plugins for it that needs to be installed. It can be installed with sudo apt install cmake, current CMake on Ubuntu 20.04 repository is 3.16.3, which is enough to build AGS. An example way to manually building AGS with CMake on Ubuntu is, after cloning AGS:

cd ags
mkdir build-debug
cd build-debug
cmake .. -DCMAKE_BUILD_TYPE=Debug
cmake --build . --parallel

AGS currently has some problems with multimonitor setups, gaming mouse and other issues on Ubuntu that are fixed in the SDL2 port.

legluondunet commented 3 years ago

@ericoporto the master branch has not SDL2 implementation and fixes?

ivan-mogilko commented 3 years ago

@legluondunet SDL2 port is currently in ags3--sdl2 branch, but hopefully we'll soon merge it with master.