libretro / RetroArch

Cross-platform, sophisticated frontend for the libretro API. Licensed GPLv3.
http://www.libretro.com
GNU General Public License v3.0
10.24k stars 1.83k forks source link

retroarch build fails on FreeBSD #10056

Closed darkoverlordofdata closed 3 years ago

darkoverlordofdata commented 4 years ago

Description

first off, I installed retroarch from the freebsd package manager. When run, it fails with XDG_RUNTIME_DIR. While researching this error, I came an existing issue in the repo: across https://github.com/libretro/RetroArch/issues/5655, which points out that the version in bsd package manager, v1.3.6, is pretty old, so I decided to follow the advice on #5655, and build from source.

Expected behavior

I expected it to build...

Actual behavior

I fails to build: [darko@NomadBSD:~/GitHub/RetroArch] gmake CC frontend/drivers/platform_unix.c frontend/drivers/platform_unix.c: In function 'frontend_unix_get_mem_free': frontend/drivers/platform_unix.c:2137:36: error: '_SC_AVPHYS_PAGES' undeclared (first use in this function) 2137 | unsigned long long pn = sysconf(_SC_AVPHYS_PAGES); | ^~~~ frontend/drivers/platform_unix.c:2137:36: note: each undeclared identifier is reported only once for each function it appears in gmake: *** [Makefile:206: obj-unix/release/frontend/drivers/platform_unix.o] Error 1

Steps to reproduce the bug

1 git clone https://github.com/libretro/RetroArch/ 2 cd RetroArch 3 ./configure

  1. gmake

Bisect Results

It happens after entering gmake

Version/Commit

Latest commit 60e087b 2 days ago

Environment information

keithbowes commented 4 years ago

Odd. This constant is in the OpenBSD documentation, so it's obviously not a GNU thing, but it does indeed seem to be missing from the FreeBSD sysconf implementation.

I don't have FreeBSD, but considering these facts, I'd suggest changing line 2111 from #if ANDROID to #if defined(ANDROID) || (!defined(__linux__) && !defined(__OpenBSD__)). If that works, I could easily send a pull request.

darkoverlordofdata commented 4 years ago

Works, but... then I run into the next error:

CC input/input_keymaps.c
input/input_keymaps.c:50:10: fatal error: linux/input.h: No such file or directory
   50 | #include <linux/input.h>
      |          ^~~~~~~~~~~~~~~
compilation terminated.

line 49 in that file: #if defined(linux) || defined(HAVE_WAYLAND) isn't correct - bsd uses wayland. Looks like this is a can of worms :)

darkoverlordofdata commented 4 years ago

Apparently no interest in actually working on bsd.

inactive123 commented 4 years ago

We would be glad to merge a PR if you have any. If you can't do that, I don't see what you expect us to do here.

inactive123 commented 4 years ago

Pushed a commit -

https://github.com/libretro/RetroArch/commit/09da302b8dba97094427575943d818e5970632e0

If anything else remains to be done, I'd really request you guys to make a PR, as I don't have a working FreeBSD setup here, so even this commit is just me coding blind.

gouchi commented 4 years ago

I made a quick test with NomaBSD and here is the compile log using latest RetroArch commit (0f06e44)

nomad@NomadBSD ~/T/RetroArch> gmake
CC frontend/drivers/platform_unix.c
frontend/drivers/platform_unix.c:722:33: warning: implicit declaration of function 'djb2_calculate' is invalid in C99 [-Wimplicit-function-declaration]
            uint32_t val_hash = djb2_calculate(val);
                                ^
frontend/drivers/platform_unix.c:875:27: warning: implicit declaration of function 'djb2_calculate' is invalid in C99 [-Wimplicit-function-declaration]
      uint32_t val_hash = djb2_calculate(val);
                          ^
2 warnings generated.
CC version_git.c
CC frontend/frontend_driver.c
CC retroarch.c
CC msg_hash.c
msg_hash.c:250:11: warning: implicit declaration of function 'djb2_calculate' is invalid in C99 [-Wimplicit-function-declaration]
   return djb2_calculate(s);
          ^
1 warning generated.
CC intl/msg_hash_us.c
CC libretro-common/queues/task_queue.c
CC tasks/task_content.c
CC tasks/task_patch.c
CC tasks/task_save.c
CC tasks/task_file_transfer.c
CC tasks/task_image.c
CC tasks/task_playlist_manager.c
CC tasks/task_manual_content_scan.c
CC libretro-common/encodings/encoding_utf.c
CC libretro-common/encodings/encoding_crc32.c
CC libretro-common/encodings/encoding_base64.c
CC libretro-common/compat/fopen_utf8.c
CC libretro-common/lists/file_list.c
CC libretro-common/lists/dir_list.c
CC libretro-common/file/retro_dirent.c
CC libretro-common/streams/stdin_stream.c
CC libretro-common/streams/file_stream.c
CC libretro-common/streams/file_stream_transforms.c
CC libretro-common/streams/interface_stream.c
CC libretro-common/streams/memory_stream.c
CC libretro-common/vfs/vfs_implementation.c
CC libretro-common/media/media_detect_cd.c
CC libretro-common/lists/string_list.c
CC libretro-common/string/stdstring.c
CC libretro-common/memmap/memalign.c
CC libretro-common/file/nbio/nbio_stdio.c
CC libretro-common/file/nbio/nbio_unixmmap.c
CC libretro-common/file/nbio/nbio_intf.c
CC libretro-common/file/file_path.c
CC libretro-common/file/file_path_io.c
CC file_path_special.c
CC file_path_str.c
CC libretro-common/hash/rhash.c
libretro-common/hash/rhash.c:310:23: error: unknown type name 'SHA1Context'
static void SHA1Reset(SHA1Context *context)
                      ^
libretro-common/hash/rhash.c:329:37: error: unknown type name 'SHA1Context'
static void SHA1ProcessMessageBlock(SHA1Context *context)
                                    ^
libretro-common/hash/rhash.c:421:28: error: unknown type name 'SHA1Context'
static void SHA1PadMessage(SHA1Context *context)
                           ^
libretro-common/hash/rhash.c:458:23: error: unknown type name 'SHA1Context'
static int SHA1Result(SHA1Context *context)
                      ^
libretro-common/hash/rhash.c:472:23: error: unknown type name 'SHA1Context'
static void SHA1Input(SHA1Context *context,
                      ^
libretro-common/hash/rhash.c:511:4: error: use of undeclared identifier 'SHA1Context'
   SHA1Context sha;
   ^
libretro-common/hash/rhash.c:523:15: error: use of undeclared identifier 'sha'
   SHA1Reset(&sha);
              ^
libretro-common/hash/rhash.c:531:18: error: use of undeclared identifier 'sha'
      SHA1Input(&sha, buff, rv);
                 ^
libretro-common/hash/rhash.c:534:21: error: use of undeclared identifier 'sha'
   if (!SHA1Result(&sha))
                    ^
libretro-common/hash/rhash.c:538:10: error: use of undeclared identifier 'sha'
         sha.Message_Digest[0],
         ^
libretro-common/hash/rhash.c:539:10: error: use of undeclared identifier 'sha'
         sha.Message_Digest[1],
         ^
libretro-common/hash/rhash.c:540:10: error: use of undeclared identifier 'sha'
         sha.Message_Digest[2],
         ^
libretro-common/hash/rhash.c:541:10: error: use of undeclared identifier 'sha'
         sha.Message_Digest[3], sha.Message_Digest[4]);
         ^
libretro-common/hash/rhash.c:541:33: error: use of undeclared identifier 'sha'
         sha.Message_Digest[3], sha.Message_Digest[4]);
                                ^
14 errors generated.
gmake: *** [Makefile:206: obj-unix/release/./libretro-common/hash/rhash.o] Error 1
inactive123 commented 4 years ago

I removed the hashing dependencies and I moved the SHA1 struct inside rhash.c. Try it again, I'm interested in learning what the errors are now.

gouchi commented 4 years ago

Here is the output using commit b89663e

First configure output,

nomad@NomadBSD ~/T/RetroArch> ./configure 
Checking operating system ... BSD 
Checking for suitable working C compiler ... /usr/bin/cc works
Checking for suitable working C++ compiler ... /usr/bin/c++ works
Checking for pkg-config ... /usr/local/bin/pkgconf
Checking for availability of switch -std=gnu99 in /usr/bin/cc ... yes
Checking for availability of switch -std=c++11 in /usr/bin/c++ ... yes
Checking for availability of switch -Wno-unused-result in /usr/bin/cc ... yes
Checking for availability of switch -Wno-unused-variable in /usr/bin/cc ... yes
Checking function sd_get_machine_names in -lsystemd ... no
Checking presence of package bcm_host ... no
Checking function bcm_host_init in -lbcm_host ... no
Checking presence of header file EGL/eglext.h ... yes
Checking presence of package egl ... 18.3.2
Checking function ass_library_init in -lass ... yes
Checking function pthread_create in -lpthread ... yes
Checking function pthread_key_create in -lpthread ... yes
Checking function dlopen in -lc ... yes
Checking function socket in -lc ... yes
Checking function getaddrinfo in -lc ... yes
Checking existence of -lminiupnpc ... yes
Checking function fcntl in -lc ... yes
Checking function getopt_long in -lc ... yes
Checking presence of package alsa ... 1.1.2
Checking presence of package caca ... no
Checking presence of package libsixel >= 1.6.0 ... no
Checking presence of predefined macro AUDIO_SETINFO in sys/audioio.h ... no
Checking presence of header file sys/soundcard.h ... yes
Checking presence of header file soundcard.h ... no
Checking existence of -lossaudio ... no
Checking function alcOpenDevice in -lopenal ... no
Checking presence of package rsound >= 1.1 ... no
Checking presence of package libroar >= 1.0.12 ... no
Checking presence of package jack >= 0.120.1 ... no
Checking presence of package libpulse ... 13.0
Checking presence of package sdl >= 1.2.10 ... 1.2.15
Checking presence of package sdl2 >= 2.0.0 ... no
Checking presence of package Qt5Core >= 5.2 ... 5.13.0
Checking presence of package Qt5Gui >= 5.2 ... 5.13.0
Checking presence of package Qt5Widgets >= 5.2 ... 5.13.0
Checking presence of package Qt5Concurrent >= 5.2 ... 5.13.0
Checking presence of package Qt5Network >= 5.2 ... 5.13.0
Checking presence of package openssl >= 1.0.0 ... no
Checking presence of package flac ... 1.3.3
Checking presence of header file mbedtls/entropy.h ... no
Checking existence of -lmbedx509 ... no
Checking existence of -lmbedcrypto ... no
Checking presence of package libusb-1.0 >= 1.0.13 ... 1.0.13
Checking existence of -ldinput8 ... no
Checking existence of -ld3d9 ... no
Checking existence of -ldsound ... no
Checking existence of -ld3dx8 ... no
Checking existence of -ld3dx9 ... no
Checking presence of header file GL/gl.h ... yes
Checking existence of -lGL ... yes
Checking function cgCreateContext in -lCg -lCgGL ... no
Checking presence of package zlib ... 1.2.10
Checking presence of package libavcodec >= 57 ... 58.54.100
Checking presence of package libavformat >= 57 ... 58.29.100
Checking presence of package libavdevice >= 57 ... 58.8.100
Checking presence of package libswresample >= 2 ... 3.5.100
Checking presence of package libavutil >= 55 ... 56.31.100
Checking presence of package libswscale >= 4 ... 5.5.100
Checking presence of header file libavutil/channel_layout.h ... yes
Checking function dlopen in -lc ... yes
Checking presence of package gbm >= 9.0 ... 18.3.2
Checking presence of package libdrm ... 2.4.99
Checking presence of package vg ... no
Checking presence of package libudev ... 199
Checking presence of package libv4l2 ... 1.6.3
Checking presence of package freetype2 ... 23.1.17
Checking presence of package x11 ... 1.6.8
Checking presence of package xcb ... 1.13.1
Checking presence of package xext ... 1.3.4
Checking presence of package xxf86vm ... 1.1.4
Checking presence of package xv ... 1.0.11
Checking presence of package xinerama ... 1.1.4
Checking existence of -lXrandr ... yes
Checking presence of package xkbcommon >= 0.3.2 ... 0.8.4
Checking presence of package wayland-egl >= 10.1.0 ... 18.1.0
Checking presence of package wayland-cursor >= 1.12 ... 1.16.0
Checking presence of package wayland-protocols >= 1.15 ... 1.17
Checking presence of package wayland-scanner >= 1.12 ... 1.16.0
Checking presence of header file linux/parport.h ... no
Checking function strlcpy in -lc ... yes
Checking function strcasestr in -lc ... yes
Checking function mmap in -lc ... yes
Checking function vkCreateInstance in -lvulkan ... yes
Checking presence of header file glslang/SPIRV/GlslangToSpv.h ... no
Checking existence of -lOSDependent ... no
Checking existence of -lOGLCompiler ... no
Checking existence of -lHLSL ... no
Checking existence of -lSPIRV ... no
Checking existence of -lSPIRV-Tools-opt ... no
Checking existence of -lSPIRV-Tools ... no
Checking for moc ... /usr/local/bin/moc works
Creating make config: config.mk
Creating config header: config.h

gmake output

nomad@NomadBSD ~/T/RetroArch> gmake
CC frontend/drivers/platform_unix.c
CC version_git.c
CC frontend/frontend_driver.c
CC retroarch.c
CC msg_hash.c
msg_hash.c:250:11: warning: implicit declaration of function 'djb2_calculate' is
      invalid in C99 [-Wimplicit-function-declaration]
   return djb2_calculate(s);
          ^
1 warning generated.
CC intl/msg_hash_us.c
CC libretro-common/queues/task_queue.c
CC tasks/task_content.c
CC tasks/task_patch.c
CC tasks/task_save.c
CC tasks/task_file_transfer.c
CC tasks/task_image.c
CC tasks/task_playlist_manager.c
CC tasks/task_manual_content_scan.c
CC libretro-common/encodings/encoding_utf.c
CC libretro-common/encodings/encoding_crc32.c
CC libretro-common/encodings/encoding_base64.c
CC libretro-common/compat/fopen_utf8.c
CC libretro-common/lists/file_list.c
CC libretro-common/lists/dir_list.c
CC libretro-common/file/retro_dirent.c
CC libretro-common/streams/stdin_stream.c
CC libretro-common/streams/file_stream.c
CC libretro-common/streams/file_stream_transforms.c
CC libretro-common/streams/interface_stream.c
CC libretro-common/streams/memory_stream.c
CC libretro-common/vfs/vfs_implementation.c
CC libretro-common/media/media_detect_cd.c
CC libretro-common/lists/string_list.c
CC libretro-common/string/stdstring.c
CC libretro-common/memmap/memalign.c
CC libretro-common/file/nbio/nbio_stdio.c
CC libretro-common/file/nbio/nbio_unixmmap.c
CC libretro-common/file/nbio/nbio_intf.c
CC libretro-common/file/file_path.c
CC libretro-common/file/file_path_io.c
CC file_path_special.c
CC file_path_str.c
CC libretro-common/hash/rhash.c
CC input/common/input_hid_common.c
CC input/input_mapper.c
CC led/led_driver.c
CC gfx/video_coord_array.c
CC gfx/video_display_server.c
CC gfx/video_crt_switch.c
CC gfx/gfx_display.c
CC gfx/gfx_animation.c
CC gfx/gfx_thumbnail_path.c
CC gfx/gfx_thumbnail.c
CC configuration.c
CC libretro-common/dynamic/dylib.c
CC cores/dynamic_dummy.c
CC libretro-common/queues/message_queue.c
CC managers/state_manager.c
CC gfx/drivers_font_renderer/bitmapfont.c
CC tasks/task_autodetect.c
CC input/input_autodetect_builtin.c
CC input/input_keymaps.c
input/input_keymaps.c:1080:6: error: use of undeclared identifier
      'KEY_BACKSPACE'; did you mean 'SDLK_BACKSPACE'?
   { KEY_BACKSPACE, RETROK_BACKSPACE },
     ^~~~~~~~~~~~~
     SDLK_BACKSPACE
/usr/local/include/SDL/SDL_keysym.h:38:2: note: 'SDLK_BACKSPACE' declared here
        SDLK_BACKSPACE          = 8,
        ^
input/input_keymaps.c:1081:6: error: use of undeclared identifier 'KEY_TAB'
   { KEY_TAB, RETROK_TAB },
     ^
input/input_keymaps.c:1082:6: error: use of undeclared identifier 'KEY_CLEAR'
   { KEY_CLEAR, RETROK_CLEAR },
     ^
input/input_keymaps.c:1083:6: error: use of undeclared identifier 'KEY_ENTER'
   { KEY_ENTER, RETROK_RETURN },
     ^
input/input_keymaps.c:1084:6: error: use of undeclared identifier 'KEY_PAUSE'
   { KEY_PAUSE, RETROK_PAUSE },
     ^
input/input_keymaps.c:1085:6: error: use of undeclared identifier 'KEY_ESC'
   { KEY_ESC, RETROK_ESCAPE },
     ^
input/input_keymaps.c:1086:6: error: use of undeclared identifier 'KEY_SPACE'
   { KEY_SPACE, RETROK_SPACE },
     ^
input/input_keymaps.c:1091:6: error: use of undeclared identifier 'KEY_DOLLAR';
      did you mean 'SDLK_DOLLAR'?
   { KEY_DOLLAR, RETROK_DOLLAR },
     ^~~~~~~~~~
     SDLK_DOLLAR
/usr/local/include/SDL/SDL_keysym.h:48:2: note: 'SDLK_DOLLAR' declared here
        SDLK_DOLLAR             = 36,
        ^
input/input_keymaps.c:1094:6: error: use of undeclared identifier
      'KEY_APOSTROPHE'
   { KEY_APOSTROPHE, RETROK_QUOTE },
     ^
input/input_keymaps.c:1095:6: error: use of undeclared identifier
      'KEY_KPLEFTPAREN'
   { KEY_KPLEFTPAREN, RETROK_LEFTPAREN },
     ^
input/input_keymaps.c:1096:6: error: use of undeclared identifier
      'KEY_KPRIGHTPAREN'
   { KEY_KPRIGHTPAREN, RETROK_RIGHTPAREN },
     ^
input/input_keymaps.c:1097:6: error: use of undeclared identifier
      'KEY_KPASTERISK'
   { KEY_KPASTERISK, RETROK_ASTERISK },
     ^
input/input_keymaps.c:1098:6: error: use of undeclared identifier 'KEY_KPPLUS'
   { KEY_KPPLUS, RETROK_PLUS },
     ^
input/input_keymaps.c:1099:6: error: use of undeclared identifier 'KEY_COMMA'
   { KEY_COMMA, RETROK_COMMA },
     ^
input/input_keymaps.c:1100:6: error: use of undeclared identifier 'KEY_MINUS'
   { KEY_MINUS, RETROK_MINUS },
     ^
input/input_keymaps.c:1101:6: error: use of undeclared identifier 'KEY_DOT'
   { KEY_DOT, RETROK_PERIOD },
     ^
input/input_keymaps.c:1102:6: error: use of undeclared identifier 'KEY_SLASH'
   { KEY_SLASH, RETROK_SLASH },
     ^
input/input_keymaps.c:1103:6: error: use of undeclared identifier 'KEY_0'
   { KEY_0, RETROK_0 },
     ^
input/input_keymaps.c:1104:6: error: use of undeclared identifier 'KEY_1'
   { KEY_1, RETROK_1 },
     ^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
20 errors generated.
gmake: *** [Makefile:206: obj-unix/release/input/input_keymaps.o] Error 1

And with disabling SDL and SDL2

nomad@NomadBSD ~/T/RetroArch> gmake
CC frontend/drivers/platform_unix.c
CC version_git.c
CC frontend/frontend_driver.c
CC retroarch.c
CC msg_hash.c
msg_hash.c:250:11: warning: implicit declaration of function 'djb2_calculate' is invalid in C99 [-Wimplicit-function-declaration]
   return djb2_calculate(s);
          ^
1 warning generated.
CC intl/msg_hash_us.c
CC libretro-common/queues/task_queue.c
CC tasks/task_content.c
CC tasks/task_patch.c
CC tasks/task_save.c
CC tasks/task_file_transfer.c
CC tasks/task_image.c
CC tasks/task_playlist_manager.c
CC tasks/task_manual_content_scan.c
CC libretro-common/encodings/encoding_utf.c
CC libretro-common/encodings/encoding_crc32.c
CC libretro-common/encodings/encoding_base64.c
CC libretro-common/compat/fopen_utf8.c
CC libretro-common/lists/file_list.c
CC libretro-common/lists/dir_list.c
CC libretro-common/file/retro_dirent.c
CC libretro-common/streams/stdin_stream.c
CC libretro-common/streams/file_stream.c
CC libretro-common/streams/file_stream_transforms.c
CC libretro-common/streams/interface_stream.c
CC libretro-common/streams/memory_stream.c
CC libretro-common/vfs/vfs_implementation.c
CC libretro-common/media/media_detect_cd.c
CC libretro-common/lists/string_list.c
CC libretro-common/string/stdstring.c
CC libretro-common/memmap/memalign.c
CC libretro-common/file/nbio/nbio_stdio.c
CC libretro-common/file/nbio/nbio_unixmmap.c
CC libretro-common/file/nbio/nbio_intf.c
CC libretro-common/file/file_path.c
CC libretro-common/file/file_path_io.c
CC file_path_special.c
CC file_path_str.c
CC libretro-common/hash/rhash.c
CC input/common/input_hid_common.c
CC input/input_mapper.c
CC led/led_driver.c
CC gfx/video_coord_array.c
CC gfx/video_display_server.c
CC gfx/video_crt_switch.c
CC gfx/gfx_display.c
CC gfx/gfx_animation.c
CC gfx/gfx_thumbnail_path.c
CC gfx/gfx_thumbnail.c
CC configuration.c
CC libretro-common/dynamic/dylib.c
CC cores/dynamic_dummy.c
CC libretro-common/queues/message_queue.c
CC managers/state_manager.c
CC gfx/drivers_font_renderer/bitmapfont.c
CC tasks/task_autodetect.c
CC input/input_autodetect_builtin.c
CC input/input_keymaps.c
input/input_keymaps.c:1080:6: error: use of undeclared identifier 'KEY_BACKSPACE'; did you mean 'RETROK_BACKSPACE'?
   { KEY_BACKSPACE, RETROK_BACKSPACE },
     ^~~~~~~~~~~~~
     RETROK_BACKSPACE
./libretro-common/include/libretro.h:316:4: note: 'RETROK_BACKSPACE' declared here
   RETROK_BACKSPACE      = 8,
   ^
input/input_keymaps.c:1081:6: error: use of undeclared identifier 'KEY_TAB'
   { KEY_TAB, RETROK_TAB },
     ^
input/input_keymaps.c:1082:6: error: use of undeclared identifier 'KEY_CLEAR'
   { KEY_CLEAR, RETROK_CLEAR },
     ^
input/input_keymaps.c:1083:6: error: use of undeclared identifier 'KEY_ENTER'
   { KEY_ENTER, RETROK_RETURN },
     ^
input/input_keymaps.c:1084:6: error: use of undeclared identifier 'KEY_PAUSE'
   { KEY_PAUSE, RETROK_PAUSE },
     ^
input/input_keymaps.c:1085:6: error: use of undeclared identifier 'KEY_ESC'
   { KEY_ESC, RETROK_ESCAPE },
     ^
input/input_keymaps.c:1086:6: error: use of undeclared identifier 'KEY_SPACE'
   { KEY_SPACE, RETROK_SPACE },
     ^
input/input_keymaps.c:1091:6: error: use of undeclared identifier 'KEY_DOLLAR'
   { KEY_DOLLAR, RETROK_DOLLAR },
     ^
input/input_keymaps.c:1094:6: error: use of undeclared identifier 'KEY_APOSTROPHE'
   { KEY_APOSTROPHE, RETROK_QUOTE },
     ^
input/input_keymaps.c:1095:6: error: use of undeclared identifier 'KEY_KPLEFTPAREN'; did you mean 'RETROK_LEFTPAREN'?
   { KEY_KPLEFTPAREN, RETROK_LEFTPAREN },
     ^~~~~~~~~~~~~~~
     RETROK_LEFTPAREN
./libretro-common/include/libretro.h:329:4: note: 'RETROK_LEFTPAREN' declared here
   RETROK_LEFTPAREN      = 40,
   ^
input/input_keymaps.c:1096:6: error: use of undeclared identifier 'KEY_KPRIGHTPAREN'; did you mean 'RETROK_RIGHTPAREN'?
   { KEY_KPRIGHTPAREN, RETROK_RIGHTPAREN },
     ^~~~~~~~~~~~~~~~
     RETROK_RIGHTPAREN
./libretro-common/include/libretro.h:330:4: note: 'RETROK_RIGHTPAREN' declared here
   RETROK_RIGHTPAREN     = 41,
   ^
input/input_keymaps.c:1097:6: error: use of undeclared identifier 'KEY_KPASTERISK'; did you mean 'RETROK_ASTERISK'?
   { KEY_KPASTERISK, RETROK_ASTERISK },
     ^~~~~~~~~~~~~~
     RETROK_ASTERISK
./libretro-common/include/libretro.h:331:4: note: 'RETROK_ASTERISK' declared here
   RETROK_ASTERISK       = 42,
   ^
input/input_keymaps.c:1098:6: error: use of undeclared identifier 'KEY_KPPLUS'
   { KEY_KPPLUS, RETROK_PLUS },
     ^
input/input_keymaps.c:1099:6: error: use of undeclared identifier 'KEY_COMMA'
   { KEY_COMMA, RETROK_COMMA },
     ^
input/input_keymaps.c:1100:6: error: use of undeclared identifier 'KEY_MINUS'
   { KEY_MINUS, RETROK_MINUS },
     ^
input/input_keymaps.c:1101:6: error: use of undeclared identifier 'KEY_DOT'
   { KEY_DOT, RETROK_PERIOD },
     ^
input/input_keymaps.c:1102:6: error: use of undeclared identifier 'KEY_SLASH'
   { KEY_SLASH, RETROK_SLASH },
     ^
input/input_keymaps.c:1103:6: error: use of undeclared identifier 'KEY_0'
   { KEY_0, RETROK_0 },
     ^
input/input_keymaps.c:1104:6: error: use of undeclared identifier 'KEY_1'
   { KEY_1, RETROK_1 },
     ^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
20 errors generated.
gmake: *** [Makefile:206: obj-unix/release/input/input_keymaps.o] Error 1
valpackett commented 4 years ago

This is because the fix in 09da302b8dba970944 was wrong. Do this:

diff --git i/input/input_keymaps.c w/input/input_keymaps.c
index 1c34778b70..5ea59fdcc5 100644
--- i/input/input_keymaps.c
+++ w/input/input_keymaps.c
@@ -45,7 +45,7 @@
 #include "SDL.h"
 #endif

-#if defined(__linux__) || defined(__linux__) && defined(HAVE_WAYLAND)
+#if defined(__linux__) || defined(HAVE_WAYLAND)
 #include <linux/input.h>
 #include <linux/kd.h>
 #endif
gouchi commented 4 years ago

@myfreeweb thank you for the update.

Using your patch and installing those packages evdev-proto (linux/input.h) and svgalib (linux/kd.h) I got further with this issue

CC frontend/drivers/platform_unix.c
CC version_git.c
CC frontend/frontend_driver.c
CC retroarch.c
CC msg_hash.c
msg_hash.c:250:11: warning: implicit declaration of function 'djb2_calculate' is invalid in C99 [-Wimplicit-function-declaration]
   return djb2_calculate(s);
          ^
1 warning generated.
CC intl/msg_hash_us.c
CC libretro-common/queues/task_queue.c
CC tasks/task_content.c
CC tasks/task_patch.c
CC tasks/task_save.c
CC tasks/task_file_transfer.c
CC tasks/task_image.c
CC tasks/task_playlist_manager.c
CC tasks/task_manual_content_scan.c
CC libretro-common/encodings/encoding_utf.c
CC libretro-common/encodings/encoding_crc32.c
CC libretro-common/encodings/encoding_base64.c
CC libretro-common/compat/fopen_utf8.c
CC libretro-common/lists/file_list.c
CC libretro-common/lists/dir_list.c
CC libretro-common/file/retro_dirent.c
CC libretro-common/streams/stdin_stream.c
CC libretro-common/streams/file_stream.c
CC libretro-common/streams/file_stream_transforms.c
CC libretro-common/streams/interface_stream.c
CC libretro-common/streams/memory_stream.c
CC libretro-common/vfs/vfs_implementation.c
CC libretro-common/media/media_detect_cd.c
CC libretro-common/lists/string_list.c
CC libretro-common/string/stdstring.c
CC libretro-common/memmap/memalign.c
CC libretro-common/file/nbio/nbio_stdio.c
CC libretro-common/file/nbio/nbio_unixmmap.c
CC libretro-common/file/nbio/nbio_intf.c
CC libretro-common/file/file_path.c
CC libretro-common/file/file_path_io.c
CC file_path_special.c
CC file_path_str.c
CC libretro-common/hash/rhash.c
CC input/common/input_hid_common.c
CC input/input_mapper.c
CC led/led_driver.c
CC gfx/video_coord_array.c
CC gfx/video_crt_switch.c
CC gfx/gfx_display.c
CC gfx/gfx_animation.c
CC gfx/gfx_thumbnail_path.c
CC gfx/gfx_thumbnail.c
CC configuration.c
CC libretro-common/dynamic/dylib.c
CC cores/dynamic_dummy.c
CC libretro-common/queues/message_queue.c
CC managers/state_manager.c
CC gfx/drivers_font_renderer/bitmapfont.c
CC tasks/task_autodetect.c
CC input/input_autodetect_builtin.c
CC input/input_keymaps.c
CC libretro-common/queues/fifo_queue.c
CC libretro-common/compat/compat_fnmatch.c
CC libretro-common/compat/compat_posix_string.c
CC managers/cheat_manager.c
CC core_info.c
CC libretro-common/file/config_file.c
CC libretro-common/file/config_file_userdata.c
CC runtime_file.c
CC disk_index_file.c
CC tasks/task_screenshot.c
CC tasks/task_powerstate.c
CC libretro-common/gfx/scaler/scaler.c
CC libretro-common/gfx/scaler/pixconv.c
CC libretro-common/gfx/scaler/scaler_int.c
CC libretro-common/gfx/scaler/scaler_filter.c
CC gfx/font_driver.c
CC gfx/video_filter.c
CC libretro-common/audio/resampler/audio_resampler.c
CC libretro-common/audio/dsp_filter.c
CC libretro-common/audio/resampler/drivers/sinc_resampler.c
CC libretro-common/audio/resampler/drivers/nearest_resampler.c
CC libretro-common/utils/md5.c
libretro-common/utils/md5.c:90:29: error: unknown type name 'MD5_CTX'
static const void *MD5_body(MD5_CTX *ctx, const void *data, unsigned long size)
                            ^
libretro-common/utils/md5.c:93:2: error: use of undeclared identifier 'MD5_u32plus'
        MD5_u32plus a, b, c, d;
        ^
libretro-common/utils/md5.c:94:2: error: use of undeclared identifier 'MD5_u32plus'
        MD5_u32plus saved_a, saved_b, saved_c, saved_d;
        ^
libretro-common/utils/md5.c:98:2: error: use of undeclared identifier 'a'
        a = ctx->a;
        ^
libretro-common/utils/md5.c:99:2: error: use of undeclared identifier 'b'
        b = ctx->b;
        ^
libretro-common/utils/md5.c:100:2: error: use of undeclared identifier 'c'
        c = ctx->c;
        ^
libretro-common/utils/md5.c:101:2: error: use of undeclared identifier 'd'
        d = ctx->d;
        ^
libretro-common/utils/md5.c:104:3: error: use of undeclared identifier 'saved_a'
                saved_a = a;
                ^
libretro-common/utils/md5.c:104:13: error: use of undeclared identifier 'a'
                saved_a = a;
                          ^
libretro-common/utils/md5.c:105:3: error: use of undeclared identifier 'saved_b'
                saved_b = b;
                ^
libretro-common/utils/md5.c:105:13: error: use of undeclared identifier 'b'
                saved_b = b;
                          ^
libretro-common/utils/md5.c:106:3: error: use of undeclared identifier 'saved_c'
                saved_c = c;
                ^
libretro-common/utils/md5.c:106:13: error: use of undeclared identifier 'c'
                saved_c = c;
                          ^
libretro-common/utils/md5.c:107:3: error: use of undeclared identifier 'saved_d'
                saved_d = d;
                ^
libretro-common/utils/md5.c:107:13: error: use of undeclared identifier 'd'
                saved_d = d;
                          ^
libretro-common/utils/md5.c:110:19: error: use of undeclared identifier 'a'
                MD5_STEP(MD5_F, a, b, c, d, MD5_SET(0), 0xd76aa478, 7)
                                ^
libretro-common/utils/md5.c:110:28: error: use of undeclared identifier 'd'
                MD5_STEP(MD5_F, a, b, c, d, MD5_SET(0), 0xd76aa478, 7)
                                         ^
libretro-common/utils/md5.c:110:22: error: use of undeclared identifier 'b'
                MD5_STEP(MD5_F, a, b, c, d, MD5_SET(0), 0xd76aa478, 7)
                                   ^
libretro-common/utils/md5.c:110:25: error: use of undeclared identifier 'c'
                MD5_STEP(MD5_F, a, b, c, d, MD5_SET(0), 0xd76aa478, 7)
                                      ^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
20 errors generated.
gmake: *** [Makefile:206: obj-unix/release/./libretro-common/utils/md5.o] Error 1
valpackett commented 4 years ago

@gouchi weird, haven't seen anything like that. maybe you don't have the openssl package?

gouchi commented 4 years ago

I have the same issue with openssl package installed.

ghost commented 4 years ago

There's a hack, see tha the ssl implementation is from here, right? http://openwall.info/wiki/people/solar/software/public-domain-source-code/md5 So I've made those patches when I was making a port, not sure if it's wrong (breaking something in the future, messing up something else elsewhere, etc) but it'll compile. Cheevos will also need to get the same hack.

md5_patches.zip

valpackett commented 4 years ago

Oh I see — the included MD5 thing uses a local header called rhash.h. While the rhash package, a dependency of CMake, installs /usr/local/include/rhash.h. And the include order in RetroArch's build system is wrong and lets system headers override local ones.

I did not see the problem because I did mv /usr/local/include/rhash.h{,.bak} a long long time ago, and building the port in a clean environment (poudriere) did not reveal it because there's no CMake dependency.

UPD: see #10382

gouchi commented 3 years ago

I confirm RA is working on Nomad BSD (based on FreeBSD) using commit f693d83.

This patch is needed

diff --git i/input/input_keymaps.c w/input/input_keymaps.c
index 1c34778b70..5ea59fdcc5 100644
--- i/input/input_keymaps.c
+++ w/input/input_keymaps.c
@@ -45,7 +45,7 @@
 #include "SDL.h"
 #endif

-#if defined(__linux__) || defined(__linux__) && defined(HAVE_WAYLAND)
+#if defined(__linux__) || defined(HAVE_WAYLAND)
 #include <linux/input.h>
 #include <linux/kd.h>
 #endif

And you need to install those packages evdev-proto (linux/input.h), svgalib (linux/kd.h) and v4l_compat.

Then I compiled with ./configure --disable-discord --disable-qt && gmake

jared6502 commented 3 years ago

I was able to compile a working version on FreeBSD 12.2 after making the same change listed by gouchi. I also had to use --disable-discord but it seems that as long as the necessary packages are all installed, that is the only thing that absolutely needed to be disabled for it to build for me. I also had to build it with clang due to a GCC issue on at least this version of FreeBSD that causes an immediate crash.

gouchi commented 3 years ago

@jared6502 thank you for the feedback.

@myfreeweb can you push your patch ?

@darkoverlordofdata please close this issue as it is working now on BSD.

darkoverlordofdata commented 3 years ago

Thank you all!