realnc / dosbox-core

A DOSBox core for use in RetroArch and other libretro frontends.
GNU General Public License v2.0
42 stars 16 forks source link

Building problems in GNU/Linux #31

Closed vanfanel closed 2 years ago

vanfanel commented 2 years ago

Hi,

I'm trying to build this core on my GNU/Linux systems, where SDL1.x (being old, dead software years ago), is not present.

So, trying to build dosbox-core I get this:


g++ -std=gnu++17 -Wno-register -DFMT_HEADER_ONLY -D__LIBRETRO__ -MMD -fPIC  -I../src -I../libretro -I../libretro/virtual_keyboard -I../libretro/deps/common/include -I../include -I../libretro/deps/SDL_audiolib/3rdparty/dr_libs -I../libretro/deps/SDL_audiolib/3rdparty/speex_resampler -I../libretro/deps/SDL_audiolib/include -I../libretro/deps/SDL_audiolib/src -I../libretro/sdl_sound_wrapper -Ideps/fmt/include `pkg-config  --cflags-only-I mt32emu  libmpg123 opusfile vorbisfile` -DGIT_VERSION=\""f5e1796"\" -DSVN_VERSION=\""r4470"\" -DHAVE_ALSA -DC_HAVE_MPROTECT="1" -O3 -DNDEBUG `pkg-config --cflags sdl` -DC_IPX -DC_SDL_SOUND `pkg-config --cflags libmpg123 opusfile vorbisfile` -DAULIB_STATIC_DEFINE -DOUTSIDE_SPEEX -DRANDOM_PREFIX=SDL_audiolib -DSPX_RESAMPLE_EXPORT= -DC_DYNAMIC_X86="1" -DC_TARGETCPU="X86_64" -DWITH_PINHACK=1   -c -o ../libretro/disk_control.o ../libretro/disk_control.cpp
Package sdl was not found in the pkg-config search path.
Perhaps you should add the directory containing `sdl.pc'
to the PKG_CONFIG_PATH environment variable
No package 'sdl' found
In file included from ../libretro/disk_control.cpp:5:
../src/dos/cdrom.h:34:10: fatal error: SDL.h: No such file or directory
   34 | #include "SDL.h"
      |          ^~~~~~~
compilation terminated.
make: *** [<builtin>: ../libretro/disk_control.o] Error 1

The whole point of using a LibRetro core is not having to depend on SDL, even less depending on SDL1.x in 2021. So, what am I doing wrong here?

Thanks!

realnc commented 2 years ago

You can use the bundled copies of the dependencies with:

make platform=unix WITH_DYNAREC=x86_64 BUNDLED_AUDIO_CODECS=1 BUNDLED_GLIB=1 BUNDLED_LIBSNDFILE=1 BUNDLED_SDL=1 STATIC_LIBCXX=1 deps

And then:

make platform=unix WITH_DYNAREC=x86_64 BUNDLED_AUDIO_CODECS=1 BUNDLED_GLIB=1 BUNDLED_LIBSNDFILE=1 BUNDLED_SDL=1 STATIC_LIBCXX=1 -j`nproc`

The first command builds the dependency libraries, the second command builds the core itself.

Make sure to do:

make platform=unix WITH_DYNAREC=x86_64 BUNDLED_AUDIO_CODECS=1 BUNDLED_GLIB=1 BUNDLED_LIBSNDFILE=1 BUNDLED_SDL=1 STATIC_LIBCXX=1 clean

First to ensure a consistent build since you have already tried to build and have stray object files that can mess things up.

vanfanel commented 2 years ago

@realnc Can't I simply use system-installed libs instead of building boundled libs? I don't really like to build fluidsynth, glib, etc... as they are already on my system. Also, they are optimized for my CPU, so I use specialized builds of those libs.

Also, why should dosbox-pure build a boundled SDL1? Isn't there a way to avoid that?

realnc commented 2 years ago

@realnc Can't I simply use system-installed libs instead of building boundled libs? I don't really like to build fluidsynth, glib, etc... as they are already on my system. Also, they are optimized for my CPU, so I use specialized builds of those libs.

Pick and choose then. Since you don't have SDL1 installed, use BUNDLED_SDL=1. Use =0 for the libs you want to use the system provided versions of.

You can also build without SDL at all, by building with WITH_FAKE_SDL=1. However, you will get reduced functionality.

As for Fluidsynth, the bundled version is forced and there's no way to use the system version right now, because no linux distros out there provide libinstpatch, which is required for full support of all soundfont formats.

Also note that there's a bug that I haven't been able to track down when using non-bundled libraries. When mounting a cue file that has split audio tracks, the audio tracks won't play. So using bundled libs is recommended for now.

Also, why should dosbox-pure build a boundled SDL1? Isn't there a way to avoid that?

This is dosbox-core btw, not dosbox-pure.

vanfanel commented 2 years ago

@realnc Sorry, I was looking at the various dosbox cores, yes, I know this is dosbox-core :)

What you you mean by reduced functionality without SDL1?

It's also possible to do builds without fluidsynth, right?

realnc commented 2 years ago

What you you mean by reduced functionality without SDL1?

There's no networking support and no physical CD-ROM support. If you don't care about those things, then you can just always specify WITH_FAKE_SDL=1.

It's also possible to do builds without fluidsynth, right?

Yes. WITH_FLUIDSYNTH=0 will disable fluidsynth.

vanfanel commented 2 years ago

@realnc Yep, just the kind of stuff I don't care at all!! Thanks a lot! Will try to build it ASAP! :)

vanfanel commented 2 years ago

@realnc Sorry, another question: Is it possible to build without libsndfile? RetroArch takes care of audio conversion...

realnc commented 2 years ago

@realnc Yep, just the kind of stuff I don't care at all!! Thanks a lot! Will try to build it ASAP! :)

Oh, you also lose CD audio in split cue files (like a .cue file that uses flac, mp3, ogg, opus, etc files for the audio tracks.)

Sorry, another question: Is it possible to build without libsndfile? RetroArch takes care of audio conversion...

libsndfile is a dependency of fluidsynth and libinstpatch.

vanfanel commented 2 years ago

@realnc So, by disabling fluidsynth, libsndfile is automatically disabled?

realnc commented 2 years ago

@realnc So, by disabling fluidsynth, libsndfile is automatically disabled?

Yeah. The only thing you can't disable is munt (the MT-32 emulator library.)

vanfanel commented 2 years ago

@realnc Got a build exactly how I want it thanks to your help! Only one minor issue: There's something wrong with the arrow keys in games. For example, trying to change directions in SuperFrog sometime fails, and the left/right arrow seems unresponsible for a while. Am I missing a setting related to this or maybe it's a bug?

EDIT: Seems that, for playing with keyboard, setting the DEVICE TYPE in SETTINGS->INPUT->PORT N MAPPINGS to KEYBOARD+MOUSE is needed. That way, no more stuck keys can be seen. Purrfect!

realnc commented 2 years ago

EDIT: Seems that, for playing with keyboard, setting the DEVICE TYPE in SETTINGS->INPUT->PORT N MAPPINGS to KEYBOARD+MOUSE is needed. That way, no more stuck keys can be seen. Purrfect!

Note that for keyboard-only games, you can map keyboard keys to your gamepad.

vanfanel commented 2 years ago

Well, I succeeded building, only extensive testing remains. So closing this issue, as it's not an issue anymore :)