Bug 246795 - [NEW PORT] games/libretro-xrick: libretro implementation of "Rick Dangerous"
Summary: [NEW PORT] games/libretro-xrick: libretro implementation of "Rick Dangerous"
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Many People
Assignee: Max Brazhnikov
URL: https://github.com/libretro/xrick-lib...
Depends on:
Reported: 2020-05-28 03:12 UTC by Daniel Menelkir
Modified: 2020-12-18 12:20 UTC (History)
1 user (show)

See Also:

libretro-xrick-v1.diff (2.58 KB, patch)
2020-05-28 03:12 UTC, Daniel Menelkir
no flags Details | Diff
libretro-xrick-v2.diff (2.56 KB, patch)
2020-12-18 09:49 UTC, Daniel Menelkir
no flags Details | Diff
libretro-xrick-v3.diff (3.61 KB, patch)
2020-12-18 12:03 UTC, Daniel Menelkir
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Daniel Menelkir 2020-05-28 03:12:06 UTC
Created attachment 214947 [details]

Libretro implementation of "Rick Dangerous"
Comment 1 Daniel Menelkir 2020-10-17 08:57:33 UTC
I'm pinging this port because it's one of my libretro cores pending to evaluation and it's being 6 months already.
Comment 2 Max Brazhnikov freebsd_committer 2020-12-17 20:22:43 UTC
Hi Daniel

This one fails with:

===>  Building for libretro-xrick-0.20200527
gmake[1]: Entering directory '/wrkdirs/usr/ports/games/libretro-xrick/work/xrick-libretro-5099ffa'
gcc -O2 -pipe  -fstack-protector-strong -Wl,-rpath=/usr/local/lib/gcc9 -isystem /usr/local/include -fno-strict-aliasing  -O2 -DNDEBUG -DWANT_ZLIB -fsigned-char -Wno-strict-prototypes -ffast-math -fomit-frame-pointer -fno-builtin -I./include -I./include/compat -I./src -I./libretro -I./libretro/sdl_wrapp -I./libretro/include -D__LIBRETRO__ -DINLINE="inline" -fPIC -DALIGN_DWORD -c -osrc/unzip.o src/unzip.c
gcc -O2 -pipe  -fstack-protector-strong -Wl,-rpath=/usr/local/lib/gcc9 -isystem /usr/local/include -fno-strict-aliasing  -O2 -DNDEBUG -DWANT_ZLIB -fsigned-char -Wno-strict-prototypes -ffast-math -fomit-frame-pointer -fno-builtin -I./include -I./include/compat -I./src -I./libretro -I./libretro/sdl_wrapp -I./libretro/include -D__LIBRETRO__ -DINLINE="inline" -fPIC -DALIGN_DWORD -c -osrc/data.o src/data.c
gcc -O2 -pipe  -fstack-protector-strong -Wl,-rpath=/usr/local/lib/gcc9 -isystem /usr/local/include -fno-strict-aliasing  -O2 -DNDEBUG -DWANT_ZLIB -fsigned-char -Wno-strict-prototypes -ffast-math -fomit-frame-pointer -fno-builtin -I./include -I./include/compat -I./src -I./libretro -I./libretro/sdl_wrapp -I./libretro/include -D__LIBRETRO__ -DINLINE="inline" -fPIC -DALIGN_DWORD -c -osrc/scr_xrick.o src/scr_xrick.c
gcc -O2 -pipe  -fstack-protector-strong -Wl,-rpath=/usr/local/lib/gcc9 -isystem /usr/local/include -fno-strict-aliasing  -O2 -DNDEBUG -DWANT_ZLIB -fsigned-char -Wno-strict-prototypes -ffast-math -fomit-frame-pointer -fno-builtin -I./include -I./include/compat -I./src -I./libretro -I./libretro/sdl_wrapp -I./libretro/include -D__LIBRETRO__ -DINLINE="inline" -fPIC -DALIGN_DWORD -c -osrc/scr_pause.o src/scr_pause.c
/bin/sh: gcc: not found
gmake[1]: *** [Makefile.libretro:426: src/unzip.o] Error 127
gmake[1]: *** Waiting for unfinished jobs....
/bin/sh: gcc: not found
gmake[1]: *** [Makefile.libretro:426: src/data.o] Error 127
/bin/sh: gcc: not found
gmake[1]: *** [Makefile.libretro:426: src/scr_xrick.o] Error 127
/bin/sh: gcc: not found
gmake[1]: *** [Makefile.libretro:426: src/scr_pause.o] Error 127
gmake[1]: Leaving directory '/wrkdirs/usr/ports/games/libretro-xrick/work/xrick-libretro-5099ffa'
===> Compilation failed unexpectedly.
Comment 3 Daniel Menelkir 2020-12-18 09:32:04 UTC
(In reply to Max Brazhnikov from comment #2)
Strange, he's missing gcc for some reason, works fine here. Look at mine:

gcc -o xrick_libretro.so -fPIC -shared -Wl,--version-script=./libretro/core/link.T -Wl,--no-undefined ./src/unzip.o ./src/data.o ./src/scr_xrick.o ./src/scr_pause.o ./src/scr_imain.o ./src/scr_imap.o ./src/scr_gameover.o ./src/scr_getname.o ./src/dat_picsPC.o ./src/dat_picsST.o ./src/dat_screens.o ./src/dat_tilesPC.o ./src/dat_tilesST.o ./src/dat_maps.o ./src/dat_ents.o ./src/dat_spritesST.o ./src/dat_spritesPC.o ./src/ents.o ./src/e_bullet.o ./src/e_bomb.o ./src/e_rick.o ./src/e_sbonus.o ./src/e_them.o ./src/e_bonus.o ./src/e_box.o ./src/rects.o ./src/util.o ./src/game.o ./src/xrick.o ./src/draw.o ./src/maps.o ./src/sysvid.o ./src/syskbd.o ./src/control.o ./src/system.o ./src/scroller.o ./src/sysevt.o ./src/sysarg.o ./src/sysjoy.o ./src/dat_snd.o ./libretro/core/soundplay.o ./libretro/sdl_wrapp/sdl_primitives.o ./libretro/sdl_wrapp/bmp.o ./libretro/core/libretro-core.o ./libretro/core/core-mapper.o ./deps/libz/adler32.o ./deps/libz/crc32.o ./deps/libz/inflate.o ./deps/libz/inftrees.o ./deps/libz/inffast.o ./deps/libz/zutil.o  -L/usr/home/menelkir/Development/ports/games/libretro-xrick/work -fstack-protector-strong -Wl,-rpath=/usr/local/lib/gcc9 -L/usr/local/lib/gcc9  -lm
gmake[1]: Leaving directory '/usr/home/menelkir/Development/ports/games/libretro-xrick/work/xrick-libretro-5099ffa'
===>  Staging for libretro-xrick-0.20200527
===>   libretro-xrick-0.20200527 depends on executable: gcc9 - found
===>   Generating temporary packing list
/bin/mkdir -p /usr/home/menelkir/Development/ports/games/libretro-xrick/work/stage//usr/local/lib/libretro;
install  -s -m 0644 /usr/home/menelkir/Development/ports/games/libretro-xrick/work/xrick-libretro-5099ffa/xrick_libretro.so /usr/home/menelkir/Development/ports/games/libretro-xrick/work/stage//usr/local/lib/libretro;
====> Compressing man pages (compress-man)
Comment 4 Daniel Menelkir 2020-12-18 09:49:26 UTC
Created attachment 220692 [details]

Updated to last commit and removed the compiler from USES.
Comment 5 Max Brazhnikov freebsd_committer 2020-12-18 10:31:17 UTC
(In reply to Daniel Menelkir from comment #3)
well, apparently you have gcc in your system, but it's not available in a clean environment. USES=compiler:gcc-c++11-lib pulls gcc9, but not gcc.

Btw, are these libretro ports really need gcc to build or their Makefiles hardcode gcc as compiler?
Comment 6 Daniel Menelkir 2020-12-18 10:33:18 UTC
(In reply to Max Brazhnikov from comment #5)
It was necessary, it seems it compiles just fine without gcc now.
Comment 7 Max Brazhnikov freebsd_committer 2020-12-18 10:38:15 UTC
(In reply to Daniel Menelkir from comment #6)
FreeBSD doesn't have gcc by default. System cc is clang and ports are supposed to respect CC and CXX, see for details:

Comment 8 Max Brazhnikov freebsd_committer 2020-12-18 11:05:11 UTC
(In reply to Max Brazhnikov from comment #7)
--- Makefile.libretro.orig	2020-10-07 22:50:55 UTC
+++ Makefile.libretro
@@ -39,7 +39,7 @@ ifeq ($(platform), android)
    SHARED :=  -Wl,--fix-cortex-a8 -llog --shared -Wl,--version-script=$(CORE_DIR)/libretro/core/link.T -Wl,--no-undefined
 else ifeq ($(platform), unix)
-   CC = gcc
+   CC?= gcc
  TARGET := $(TARGET_NAME)_libretro.so
    fpic := -fPIC
    ifneq ($(findstring SunOS,$(shell uname -a)),)

It compiles with default cc with this patch. Could you run-test it?
Comment 9 Daniel Menelkir 2020-12-18 11:13:31 UTC
(In reply to Max Brazhnikov from comment #8)
I think you missed my last patch.
Comment 10 Max Brazhnikov freebsd_committer 2020-12-18 11:37:17 UTC
(In reply to Daniel Menelkir from comment #9)
I didn't, but it doesn't matter. The problem is that this project doesn't respect CC - see original Makefile.libretro from the sources and my patch. I suppose other libretro ports can be fixed in a similar way.
Comment 11 Daniel Menelkir 2020-12-18 11:45:07 UTC
(In reply to Max Brazhnikov from comment #10)
So if a port needs to use gcc, it's wrong? Then this information is inaccurate? https://www.freebsd.org/doc/en/books/porters-handbook/uses-compiler.html
Comment 12 Daniel Menelkir 2020-12-18 12:03:48 UTC
Created attachment 220695 [details]

Patch included.
Comment 13 commit-hook freebsd_committer 2020-12-18 12:17:22 UTC
A commit references this bug:

Author: makc
Date: Fri Dec 18 12:16:24 UTC 2020
New revision: 558369
URL: https://svnweb.freebsd.org/changeset/ports/558369

  Add new port games/libretro-xrick:

  Libretro implementation of "Rick Dangerous".


  PR:		246795
  Submitted by:	Daniel Menelkir

Comment 14 Max Brazhnikov freebsd_committer 2020-12-18 12:17:47 UTC
(In reply to Daniel Menelkir from comment #11)
Nothing is wrong with this info. The question is does this port really need gcc? It can't be built with clang or doesn't work as expected when it is built with clang? If it indeed relies on specific gcc features, so be it. But if upstream hardcoded gcc in Makefile for no reason, then it is a bug - it forces users to install one more compiler, when there is already one in the system.
Comment 15 Max Brazhnikov freebsd_committer 2020-12-18 12:20:27 UTC
(In reply to commit-hook from comment #13)
Committed with minor tweaks:

USE_LDCONFIG is not needed for this port, as it doesn't install shared libraries.