You are not logged in.

#1 2017-08-08 22:11:18

lemurni
Member
Registered: 2017-08-08
Posts: 2

Torque 3D package works but requires sudo

This is my first post on the Arch forums. I am trying to create a AUR package for Torque 3D game engine. :)

I have written the following files

  • PKGBUILD -> gets latest stable GitHub release of precompiled binaries, installs whole directory in /opt/torque3d-bin, installs launcher and desktop entry

  • torque3d.desktop -> desktop entry for the launcher below

  • torque3d_launch.sh -> installed in /usr/bin, simply cd to torque3d-bin install dir to run from there

Basically everything is working, after makepkg and pacman -U <pkgname>.pkg.tar.xz i can start ./Torque3D from the torque3d-bin install directory (only from there!). HOWEVER, it crashes unless i use sudo, which is unacceptable.
Note: the same happens when installing to /opt/torque3d-bin and ~/torque3d-bin (just wanted to test that).

When i download the 3.10 binary sources from the GitHub repo, it works out of the box. I haven't been able to figure out the difference though.

PKGBUILD
_pkgname=torque3d
pkgname=${_pkgname}-bin
pkgver=3.10
pkgrel=1
epoch=
pkgdesc="An open-source cross-platform 3D game engine."
arch=('i686' 'x86_64')
url="https://github.com/GarageGames/Torque3D"
license=('MIT')
groups=()
makedepends=('gcc' 'automake' 'cmake' 'extra-cmake-modules' 'ninja' 'nasm')
depends=('xorg-server' 'xorg-util-macros' 'libxrandr' 'libxinerama' 'libxft' 'libx11' 'libxxf86vm' 'libxcursor' 'libxi' 'libxss' 'glu' 'freeglut' 'gtk3' 'freetype2' 'openal' 'libogg')
checkdepends=()
optdepends=()
provides=()
conflicts=()
replaces=()
backup=()
options=()
install=
changelog=
source=("https://github.com/GarageGames/Torque3D/releases/download/${pkgver}/Torque3D-${pkgver}-LinBinaries.zip" "torque3d.desktop" "torque3d_launch.sh")
noextract=()
md5sums=('SKIP' 'SKIP' 'SKIP')  # TODO cant just skip these, look for upstream md5 checksums!
validpgpkeys=()

package() {

	cd ${srcdir}
	
	# creating needed directories
	# note: $pkgdir is in a fake root environment
	# files copied to paths of same name in actual root
	install -d -m755 ${pkgdir}/usr/bin
	install -d -m755 ${pkgdir}/opt/${pkgname}
	install -d -m755 ${pkgdir}/usr/share/pixmaps
	install -d -m755 ${pkgdir}/usr/share/applications

	# install whole directory
	# except .desktop entry and source .zip
	# TODO the zip must be removed or Torque will try to load it and crash
	# how to avoid it being copied in the srcdir in the first place?
	cp -R ${srcdir}/* ${pkgdir}/opt/${pkgname}
	chmod 755 -R ${pkgdir}/opt/${pkgname}
	rm ${pkgdir}/opt/${pkgname}/torque3d.desktop
	rm ${pkgdir}/opt/${pkgname}/Torque3D-${pkgver}-LinBinaries.zip

	# install launcher shell script
 	# launcher is required to cd to install dir before running
 	install -m755 torque3d_launch.sh ${pkgdir}/usr/bin/torque3d

	# install .desktop entry and icon
	install -m755 torque3d.desktop ${pkgdir}/usr/share/applications
	install -m755 ${srcdir}/core/torque.png ${pkgdir}/usr/share/pixmaps/torque3d.png

}
Desktop entry
[Desktop Entry]
Name=Torque 3D
Comment=Open-source cross-platform 3D game engine.
Exec=torque3d
Icon=/usr/share/pixmaps/torque3d.png
Terminal=false
Type=Application
Categories=Development;Game
Launcher script
#!/bin/bash

# enter install directory
cd /opt/torque3d-bin

# add path to system libs and launch
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:${PWD} ./Torque3D

Do you have any idea what the issue might be?

Thank you very much!
Niko

Last edited by lemurni (2017-08-08 22:14:56)

Offline

#2 2017-08-08 22:34:26

lemurni
Member
Registered: 2017-08-08
Posts: 2

Re: Torque 3D package works but requires sudo

Running namcap gives me the following (besides telling me to clean up the dependencies which i will definitely do)

torque3d-bin E: ELF file ('opt/torque3d-bin/libSDL2-2.0.so.0.4.1') outside of a valid path.
torque3d-bin E: ELF file ('opt/torque3d-bin/Torque3D') outside of a valid path.
torque3d-bin E: Missing custom license directory (usr/share/licenses/torque3d-bin)
torque3d-bin E: Insecure RPATH '/home/jeff/Desktop/310/Engine/lib/sdl' in file ('opt/torque3d-bin/Torque3D')
torque3d-bin W: Referenced library 'libSDL2-2.0.so.1' is an uninstalled dependency

Note: i am not jeff, maybe that is some leftover from the makefile? guess i may have to just install the libSDL2-2.0.sp somewhere else?

Last edited by lemurni (2017-08-08 22:34:59)

Offline

#3 2017-08-09 12:17:19

Lone_Wolf
Member
From: Netherlands, Europe
Registered: 2005-10-04
Posts: 5,559

Re: Torque 3D package works but requires sudo

HOWEVER, it crashes unless i use sudo, which is unacceptable.

Normal users can do very little in /opt , the crash can probably be avoided by changing permissions on the torque folders.
full error output is needed.


The insecure rpath is a leftover from the sourcecode that should have been removed during build .
The binary includes SDL2 libraries, it is unlikely it will use system libraries


The reason everything is spread over $srcdir is that the zip file doesn't have  a top level directory.
(very common for compressed files created by windows users ... )

I think prepending the source url with somename::    should lead to extracting to $srcdir/somename/ , but am not sure.
(man makepkg used to mention this , but doesn't anymore ? )

Last edited by Lone_Wolf (2017-08-09 12:18:09)


Booting with apg Openrc, NOT systemd.
Automounting : not needed, i prefer pmount
Aur helpers : makepkg + my own local repo === rarely need them

Offline

#4 2017-08-09 21:59:26

Eschwartz
Bug Wrangler
Registered: 2014-08-08
Posts: 1,155

Re: Torque 3D package works but requires sudo

Lone_Wolf wrote:

I think prepending the source url with somename::    should lead to extracting to $srcdir/somename/ , but am not sure.
(man makepkg used to mention this , but doesn't anymore ? )

No, that just changes the download filename, which is typically done when upstream doesn't include a pkgver in the filename, or when you use Github archives that result in "v1.0.0.tar.gz" (since makepkg doesn't respect the content-disposition header or redirected server names).

What I would do is specify the file with noextract, then perform the extraction myself in prepare()

noextract=("${_pkgname}-${pkgver}.zip")
prepare() {
    unzip -qqo "${_pkgname}-${pkgver}.zip" -d "${_pkgname}-${pkgver}"
}

Offline

Board footer

Powered by FluxBB