You are not logged in.

#1 2021-07-28 14:57:42

ZenRen
Member
Registered: 2020-05-08
Posts: 17

Makepkg fails to make, but manually running make in the src dir works

I was installing np2kai-libretro-git, an outdated package, I corrected a directory in the PKGBUILD, the package started compiling but make fails with:

g++: warning: mtune=znver1: linker input file unused because linking not done
g++: error: mtune=znver1: linker input file not found: No such file or directory
make: *** [Makefile.libretro:949: ../sound/fmgen/fmgen_fmgen.o] Error 1

I don't really know what this means, but I do know I changed march and mtune in my makepkg.conf, hasn't been an issue yet, but I assumed this package was an exception and just needed a few arguments added to make.
I changed that line to make CFLAGS='march=x86-64 mtune=generic' CXXFLAGS='march=x86-64 mtune=generic' I didn't know if that was right, but the compiler still failed, different message, I can get it if it is important, but that's a fair bit of work to do something that is probably wrong. I also considered that march=x86-64 might not be right if it was being compiled on arm, so that was not a portable example.
I then decided to just go in the src dir and run make... and it worked. I don't know if that doesn't pass the same flags, I assume it doesn't. I edited the PKGBUILD a bit to omit the build section, ran makepkg, and installed it with pacman -U. It seems to work and shows up under retroarch.

The reason I am so curious about this is I would gladly repackage this on the aur, however, I don't know what is going on with make. How can I force makepkg to run with the same CFAGS and CXXFLAGS as make does regardless of the users makepkg.conf? Or if I am totally off track with what went wrong please educate me.

Link to package: https://aur.archlinux.org/packages/np2kai-libretro-git/

Offline

#2 2021-07-28 16:41:07

loqs
Member
Registered: 2014-03-06
Posts: 17,463

Re: Makepkg fails to make, but manually running make in the src dir works

With the following CFLAGS and CXXFLAGS

CFLAGS="-march=x86-64 -mtune=generic -O2 -pipe -fno-plt"
CXXFLAGS="-march=x86-64 -mtune=generic -O2 -pipe -fno-plt"

and git diff of changes to PKGBUILD

diff --git a/PKGBUILD b/PKGBUILD
index 1309699..75852ba 100644
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -1,6 +1,6 @@
 # Maintainer: Andy Delgado <cuba200611@gmail.com>
 pkgname=np2kai-libretro-git 
-pkgver=170.86c5344
+pkgver=1034.3e8fedc
 pkgrel=1
 pkgdesc="libretro port of the Kai fork of Neko Project 2 (a PC-98 emulator)"
 arch=('i686' 'x86_64' 'arm' 'armv6h' 'armv7h')
@@ -21,11 +21,11 @@ pkgver() {
 }
 
 build() {
-       cd "NP2kai/sdl2"
+       cd "NP2kai/sdl"
        make
 }
 
 package() {
-       install -Dm644 "NP2kai/sdl2/np2kai_libretro.so" "${pkgdir}/usr/lib/libretro/np2kai_libretro.so"
+       install -Dm644 "NP2kai/sdl/np2kai_libretro.so" "${pkgdir}/usr/lib/libretro/np2kai_libretro.so"
        install -Dm644 "nekop2_libretro.info" "${pkgdir}/usr/share/libretro/info/nekop2_libretro.info"
 }

np2kai-libretro-git builds in a clean chroot.
Edit:
Why is the PKGBUILD only building and installing the contents of the sdl directory and not the main project?

Last edited by loqs (2021-07-28 18:20:23)

Offline

#3 2021-07-28 20:05:39

ZenRen
Member
Registered: 2020-05-08
Posts: 17

Re: Makepkg fails to make, but manually running make in the src dir works

Ok, so what I assumed is correct. I know the problem is with my make flags, but the package should enforce the flags it needs. Changing the make line to:

make CFLAGS="-march=x86-64 -mtune=generic -O2 -pipe -fno-plt" CXXFLAGS="-march=x86-64 -mtune=generic -O2 -pipe -fno-plt"

I don't think would work for i686, arm, armv6h, and armv7h. Can you enforce make flags and keep them architecture agnostic? I don't think it should be march=native.

It only installs the libretro libraries for retroarch, if you weren't using retroarch you would install package: xnp2kai-azo234 or np2kai-git

Offline

#4 2021-07-28 20:18:03

loqs
Member
Registered: 2014-03-06
Posts: 17,463

Re: Makepkg fails to make, but manually running make in the src dir works

Which flags are required?  Which should be removed?

options=(!buildflags)

Will unset CPPFLAGS, CFLAGS, CXXFLAGS, LDFLAGS.

  CFLAGS=${CFLAGS/-pipe/}
  CXXFLAGS=${CXXFLAGS/-pipe/}

Will remove -pipe from CFLAGS and CXXFLAGS.
Edit:
Were you original options:

CFLAGS="mtune=znver1"
CXXFLAGS="mtune=znver1"

Edit2:
Unrelated changes to the PKGBUILD,  change license to that listed by the project,  use checksum for nekop2_libretro.info,  add gcc-libs to depends.

diff --git a/PKGBUILD b/PKGBUILD
index 1309699..1280933 100644
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -1,19 +1,20 @@
 # Maintainer: Andy Delgado <cuba200611@gmail.com>
 pkgname=np2kai-libretro-git 
-pkgver=170.86c5344
+pkgver=1034.3e8fedc
 pkgrel=1
 pkgdesc="libretro port of the Kai fork of Neko Project 2 (a PC-98 emulator)"
 arch=('i686' 'x86_64' 'arm' 'armv6h' 'armv7h')
 url="http://domisan.sakura.ne.jp/article/np2kai/np2kai.html"
-license=('GPL2')
+license=('MIT')
 groups=('libretro')
 install=np2kai-libretro-git.install
+depends=('gcc-libs')
 makedepends=('git') 
 
 source=('git+https://github.com/AZO234/NP2kai.git'
        'https://raw.github.com/libretro/libretro-super/master/dist/info/nekop2_libretro.info')
 md5sums=('SKIP'
-       'SKIP')
+         '3a2b0dbb9e62f4234e9364d6ce21fb04')
 
 pkgver() {
        cd "NP2kai"
@@ -21,11 +22,12 @@ pkgver() {
 }
 
 build() {
-       cd "NP2kai/sdl2"
+       cd "NP2kai/sdl"
        make
 }
 
 package() {
-       install -Dm644 "NP2kai/sdl2/np2kai_libretro.so" "${pkgdir}/usr/lib/libretro/np2kai_libretro.so"
+       install -Dm644 "NP2kai/sdl/np2kai_libretro.so" "${pkgdir}/usr/lib/libretro/np2kai_libretro.so"
        install -Dm644 "nekop2_libretro.info" "${pkgdir}/usr/share/libretro/info/nekop2_libretro.info"
+       install -Dm644 NP2kai/LICENSE ""${pkgdir}/usr/share/licenses/$pkgname/LICENSE
 }

Last edited by loqs (2021-07-28 22:03:38)

Offline

#5 2021-07-29 10:07:37

Lone_Wolf
Forum Moderator
From: Netherlands, Europe
Registered: 2005-10-04
Posts: 11,971

Re: Makepkg fails to make, but manually running make in the src dir works

Builds fine on my system with either of

-march=native
-march=znver1
-march=x86-64 -mtune=znver1

in /etc/makepkg.conf .

I'm using the default ld linker from gnu binutils . Are you using a different linker (some examples are llvm lld , gnu gold ) ?


Disliking systemd intensely, but not satisfied with alternatives so focusing on taming systemd.


(A works at time B)  && (time C > time B ) ≠  (A works at time C)

Offline

#6 2021-07-29 11:29:35

loqs
Member
Registered: 2014-03-06
Posts: 17,463

Re: Makepkg fails to make, but manually running make in the src dir works

march=x86-64 mtune=znver1

Reproduces the issue.  Missing -

Offline

#7 2021-07-29 14:22:08

ZenRen
Member
Registered: 2020-05-08
Posts: 17

Re: Makepkg fails to make, but manually running make in the src dir works

I think I can confirm adding options=(!buildflags) works, at least for me. My makepkg.conf has these lines:

CFLAGS="-march=znver1 mtune=znver1 -O2 -pipe -fno-plt -fexceptions \
        -Wp,-D_FORTIFY_SOURCE=2 -Wformat -Werror=format-security \
        -fstack-clash-protection -fcf-protection"
CXXFLAGS="$CFLAGS -Wp,-D_GLIBCXX_ASSERTIONS"

I will try to see if this works on a pi 3 on Arch Linux arm at least.

Also the package conflict with libretro-core-info because /usr/share/libretro/info/nekop2_libretro.info is supplied by that package. I am also pretty sure that is the wrong info file, the correct one is nekop2kai_libretro.info. I don't think that the files are integral to the core, but should be supplied. I don't know if libretro-core-info should be a dependency, it adds a lot of unused files. Looking at a few of the pkgbuilds for some other cores, libretro-bsnes-git depends on libretro-core-info, as well as libretro-citra-git, libretro-dolphin-git, and libretro-fceumm-git... So I think it would be pretty safe to add that. Simple.

I would also like to point out that this package does not comply with the standard libretro package names and should be libretro-np2kai-git, is that a simple change, or will that break updates for the users who have the package already installed?... not that its getting updates.

Edit: I found libretro-desmume-git also pulls the info file from git, but that would also conflict with libretro-core-info

Edit2: I just noticed the flaw in my CFLAGS... Fixing and retrying... oops.

Edit3: Fixed the line in my makepkg.conf, compiles now lol.

CFLAGS="-march=znver1 mtune=znver1 -O2 -pipe -fno-plt -fexceptions \
CFLAGS="-march=znver1 -mtune=znver1 -O2 -pipe -fno-plt -fexceptions \

No need for options=(!buildflags) then, I guess I can put my pi back in the back of my desk drawer.

Last edited by ZenRen (2021-07-29 14:42:15)

Offline

#8 2021-07-29 15:27:27

ZenRen
Member
Registered: 2020-05-08
Posts: 17

Re: Makepkg fails to make, but manually running make in the src dir works

Currently my PKGBUILD looks like this

diff --git a/PKGBUILD b/PKGBUILD
index 254c271..4d4b886 100644
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -1,17 +1,18 @@
 # Maintainer: Andy Delgado <cuba200611@gmail.com>
-pkgname=np2kai-libretro-git 
+pkgname=np2kai-libretro-git
 pkgver=1034.3e8fedc
 pkgrel=1
 pkgdesc="libretro port of the Kai fork of Neko Project 2 (a PC-98 emulator)"
 arch=('i686' 'x86_64' 'arm' 'armv6h' 'armv7h')
 url="http://domisan.sakura.ne.jp/article/np2kai/np2kai.html"
-license=('GPL2')
+license=('MIT')
 groups=('libretro')
 install=np2kai-libretro-git.install
+depends=('gcc-libs' 'libretro-core-info')
 makedepends=('git') 
 
-source=('git+https://github.com/AZO234/NP2kai.git'
-   'https://raw.github.com/libretro/libretro-super/master/dist/info/nekop2_libretro.info')
+source=('git+https://github.com/AZO234/NP2kai.git')
+
 md5sums=('SKIP'
        'SKIP')
 
@@ -21,11 +22,11 @@ pkgver() {
 }
 
 build() {
-   cd "NP2kai/sdl2"
+ cd "NP2kai/sdl"
        make
 }
 
 package() {
-   install -Dm644 "NP2kai/sdl2/np2kai_libretro.so" "${pkgdir}/usr/lib/libretro/np2kai_libretro.so"
-   install -Dm644 "nekop2_libretro.info" "${pkgdir}/usr/share/libretro/info/nekop2_libretro.info"
+ install -Dm644 "NP2kai/sdl/np2kai_libretro.so" "${pkgdir}/usr/lib/libretro/np2kai_libretro.so"
+ install -Dm644 "NP2kai/LICENSE" "${pkgdir}/usr/share/licenses/$pkgname/LICENSE"
 }

I noticed you changed the md5sums line... idk anything about that. I still don't know about changing the package name.

Edit: Now I see that was the md5 for the .info file

Last edited by ZenRen (2021-07-29 16:37:35)

Offline

Board footer

Powered by FluxBB