Bug 118230

Summary: [linux] games/linux-quake4 fails to start
Product: Base System Reporter: Barbara <barbara.xxx1975>
Component: kernAssignee: Jose Alonso Cardenas Marquez <acm>
Status: Open ---    
Severity: Affects Only Me CC: coderdreams, danfe, trasz
Priority: Normal    
Version: 6.3-PRERELEASE   
Hardware: Any   
OS: Any   
Bug Depends on:    
Bug Blocks: 247219    

Description Barbara 2007-11-24 03:00:01 UTC
I've installed games/linux-quake4 (for my nephews :P).
If I try to start it I get:

$ linux-quake4
/usr/local/lib/quake4/quake4.x86: error while loading shared libraries: /usr/local/lib/libX11.so.6: ELF file OS ABI invalid

and

$ linux-quake4smp
/usr/local/lib/quake4/quake4smp.x86: error while loading shared libraries: libSDL-1.2.id.so.0: cannot open shared object file: No such file or directory


I have

$ pkg_info -r linux-quake4\*
Information for linux-quake4-1.4.2,1:

Depends on:
Dependency: linux_base-fc-4_10
Dependency: linux-expat-1.95.8
Dependency: linux-fontconfig-2.2.3_7
Dependency: linux-xorg-libs-6.8.2_5
Dependency: linux-sdl-1.2.10,1

If it does matter I have xorg-7.3_1 with nvidia-driver-100.14.19 installed from ports.

How-To-Repeat: Install games/linux-quake4 from ports
Run linux-quake4 or linux-quake4smp
Comment 1 Edwin Groothuis freebsd_committer freebsd_triage 2007-11-24 03:00:15 UTC
Responsible Changed
From-To: freebsd-ports-bugs->acm

Over to maintainer (via the GNATS Auto Assign Tool)
Comment 2 Barbara 2008-01-04 06:53:26 UTC
I have it working doing this steps:

    # cd /usr/compat/linux/usr/local/lib
    # ln -s ../../lib/libGL.so.1
    # ln -s ../../lib/libGLcore.so.1
    # ln -s ../../lib/libSDL-1.2.so.0
    # ln -s ../../X11R6/lib/libX11.so.6
    # ln -s ../../X11R6/lib/libXext.so.6
    # ln -s ../../lib/libnvidia-tls.so.1

Is it a problem with the sw or my configuration or with the port/linuxlat=
or/nvidia-driver & linux-sdl?



The smp version is still broken as libSDL-1.2.id.so.0 has been blown away=
.
http://cvsweb.freebsd.org/ports/games/linux-quake4/pkg-plist.diff?r1=3D1.=
6;r2=3D1.7;f=3Dh

So I did:

    # cd /usr/ports/games/linux-quake4
    # make patch
    # cp ./work/bin/Linux/x86/libSDL-1.2.id.so.0 /usr/local/lib/quake4/
    # cd /usr/local/lib/quake4
    # chmod 555 libSDL-1.2.id.so.0
    # cd /usr/compat/linux/usr/lib
    # ln -s /usr/local/lib/quake4/libSDL-1.2.id.so.0

Doing this it starts, but it exits as soon as I set multiple cpu/core sup=
port from the game menu with this message:
    
    Enabling SMP
    signal caught: Segmentation fault
    si_code 12
Comment 3 Jose Alonso Cardenas Marquez freebsd_committer freebsd_triage 2009-11-10 21:02:31 UTC
State Changed
From-To: open->suspended

- It needs some tests with new linux-compat version. I'll test it ASAP
Comment 4 Barbara 2010-01-06 18:38:23 UTC
>Synopsis: games/linux-quake4 fails to start
>
>State-Changed-From-To: open-
>suspended
>State-Changed-By: acm
>State-Changed-When: Tue Nov 10 21:02:31 UTC 
2009
>State-Changed-Why: 
>- It needs some tests with new linux-compat version. 
I'll test it ASAP
>
>http://www.freebsd.org/cgi/query-pr.cgi?pr=118230

I did 
some tests and it's working on RELENG_8(*).
But now I had to make the following 
symlinks:
mkdir -p /usr/compat/linux/usr/local/lib
cd 
/usr/compat/linux/usr/local/lib
# ln -s ../../lib/libX11.so.6
# ln -s ../..
/lib/libXext.so.6
# ln -s ../../lib/libXau.so.6
# ln -s ../../lib/libXdmcp.so.6

# ln -s ../../lib/libGL.so.1
# ln -s ../../lib/libGLcore.so.1
# ln -s ../..
/lib/libnvidia-tls.so.1

The same fix I described about the smp version is 
working now!!


On RELENG_7 it's failing; but I want do further tests.


Thanks

Barbara


(*) configuration:
# uname -a
FreeBSD satanasso.local.net 8.0-STABLE 
FreeBSD 8.0-STABLE #0: Fri Jan  1 18:47:59 CET 2010     root@satanasso.local.
net:/usr/obj/usr/src/sys/SATANASSO  i386

# sysctl -a compat.linux.osrelease

compat.linux.osrelease: 2.6.16

# pkg_info -Ex nvidia linux
linux-doom3-
1.3.1.1304,1
linux-dri-7.4_1
linux-enemyterritory-2.60b
linux-f10-atk-1.24.0

linux-f10-cairo-1.8.0
linux-f10-curl-7.19.6
linux-f10-cyrus-sasl2-2.1.22
linux-
f10-expat-2.0.1
linux-f10-flashplugin-10.0r42
linux-f10-fontconfig-2.6.0
linux-
f10-gtk2-2.14.7
linux-f10-jpeg-6b
linux-f10-libssh2-0.18
linux-f10-nspr-4.7.6

linux-f10-nss-3.12.2.0
linux-f10-openldap-2.4.12_1
linux-f10-openssl-0.9.8g

linux-f10-pango-1.22.3
linux-f10-png-1.2.37
linux-f10-sdl-1.2.13
linux-f10-
sqlite3-3.5.9_1
linux-f10-tiff-3.8.2
linux-f10-xorg-libs-7.4_1
linux-quake4-
1.4.2,1
linux_base-f10-10_2
linux_kdump-1.5_2
nvidia-driver-195.22
nvidia-
settings-195.30
Comment 5 Barbara 2010-01-30 15:15:37 UTC
I'm able to start linux-quake4 on RELENG_7(*) as well.

For who is interested, create the needed links:
# mkdir -p /usr/compat/linux/usr/local/lib
# cd /usr/compat/linux/usr/local/lib
# ln -s ../../lib/libGLcore.so.1
# ln -s ../../lib/libX11.so.6
# ln -s ../../lib/libXext.so.6
# ln -s ../../lib/libnvidia-tls.so.1

then start quake4 with:
$ LD_PRELOAD=3D\
/compat/linux/usr/lib/libGL.so.1 \
/usr/local/lib/quake4/quake4.x86

The same workaround works for linux-doom3, which in the meanwhile was bro=
ken too. Just replace the last line with:
/usr/local/lib/linux-doom3/doom.x86


Other tests needed?

Best Regards
Barbara


(*) configuration:
$ uname -rsm 
FreeBSD 7.3-PRERELEASE i386

$ sysctl -a compat.linux.osrelease
compat.linux.osrelease: 2.4.2

$ pkg_info -Ex nvidia linux
linux-atk-1.9.1_3
linux-cairo-1.0.2_2
linux-doom3-1.3.1.1304,1
linux-enemyterritory-2.60b
linux-enemyterritory-jaymod-2.1.7_2
linux-enemyterritory-omni-bot-0.660
linux-expat-1.95.8_2
linux-flashplugin-9.0r260
linux-fontconfig-2.2.3_9
linux-gtk2-2.6.10_3
linux-jpeg-6b.34_2
linux-openssl-0.9.7f_2
linux-pango-1.10.2_3
linux-png-1.2.8_4
linux-quake4-1.4.2,1
linux-sdl-1.2.10_2,1
linux-tiff-3.7.1_2
linux-xorg-libs-6.8.2_7
linux_base-fc-4_15
linux_dri-7.0_2
linux_kdump-1.5_2
nvidia-driver-195.22
nvidia-settings-195.30
Comment 6 Dmitry Marakasov freebsd_committer freebsd_triage 2014-11-27 18:03:47 UTC
Is this PR still relevant?
Comment 7 Alexey Dokuchaev freebsd_committer freebsd_triage 2017-05-10 10:29:02 UTC
Yes, it is still relevant.  The problem here happens due to the order of directories in which /compat/linux/lib/ld-linux.so.2 tries to find libraries, and the behaviour of linux_open(): it would first try to open a file under /compat/linux, and then, if not found, attempt to open the same file in global namespace.

Because /usr/local/lib is attempted before /usr/lib, the following would open FreeBSDish native shared library instead of Linuxish one (in most GNU/Linux distributions, all libraries go under /usr/lib with /usr/local/lib being typically empty):

> linux_open("/usr/local/lib/libX11.so.6", ...)
And, naturally, fail with aforementioned "ELF file OS ABI invalid" message.  To work-around this problem, instead of linking every library like suggested in the audit trail, symlinking just /compat/linux/usr/local/lib -> ../lib is sufficient in this particular case.
Comment 8 Coderdreams 2022-01-23 08:20:34 UTC
The only thing that I needed to make linux-quake4-demo work in 2022 is to install linux-c7-dri

Seems that this dependency should be added to the game.