MrMEEE / ironhide

Optimus Support for Linux Through VirtualGL - PPA version also available: https://launchpad.net/~mj-casalogic/+archive/ironhide
http://www.martin-juhl.dk
88 stars 0 forks source link

optirun issus #236

Open XYYHun opened 12 years ago

XYYHun commented 12 years ago

Some strange output is displayed when I run the following command.

Desktop$ optirun -f java -jar minecraft.jar 
The application will be run with Ironhide even if it's not connected to a power supply (e.g. running on battery)
file: invalid option -- 'j'
file: invalid option -- 'a'
Usage: file [-bchikLNnprsvz0] [--apple] [--mime-encoding] [--mime-type]
            [-e testname] [-F separator] [-f namefile] [-m magicfiles] file ...
       file -C [-m magicfiles]
       file [--help]
file: invalid option -- 'j'
file: invalid option -- 'a'
Usage: file [-bchikLNnprsvz0] [--apple] [--mime-encoding] [--mime-type]
            [-e testname] [-F separator] [-f namefile] [-m magicfiles] file ...
       file -C [-m magicfiles]
       file [--help]
 * Starting Ironhide X server ironhide                                            _PS0 Enabling nVidia Card Succeded.
.                                                                          [ OK ]

(java:14280): Gtk-WARNING **: Unable to locate theme engine in module_path: "pixmap",

(java:14280): Gtk-WARNING **: Unable to locate theme engine in module_path: "pixmap",

(java:14280): Gtk-WARNING **: Unable to locate theme engine in module_path: "pixmap",

(java:14280): Gtk-WARNING **: Unable to locate theme engine in module_path: "pixmap",
 * Stopping Ironhide X server ironhide                                            _PS0 Disabling nVidia Card Succeded.
                                                                           [ OK ]

Error might be here in optirun

for arg in $@; do

if [[ `echo $arg | grep wine` -eq 0  ]]; then

if [[ `file $arg | grep 64-bit |wc -l` -ne 0 ]];then
        VGL_DRIVER=/usr/lib/nvidia-current
        break
elif [[ `file $arg | grep 32-bit |wc -l` -ne 0 ]];then
        VGL_DRIVER=/usr/lib32/nvidia-current
    break
fi

fi

done

these code test aplication whether it is a 32-bit programs or 64-bit programs. but file command must use full path, and only works with binary files.

Lekensteyn commented 12 years ago

I suggest you to try Bumblebee which alleviates this issue by passing both library paths. http://bumblebee-project.org/

icb410 commented 12 years ago

Add a test to make sure arg is executable (get the real path with readlink in case it's a symlink). Also the test if it's a wine program needs to be fixed. I did this and tested it on "java -jar minecraft.jar". This worked for me:


for arg in $@; do
    if [[ `echo $arg | grep -c wine` -eq 0  ]]; then
        if [[ -x `which $arg` ]]; then
            pathtofile=`which $arg`
            abspath=`readlink -f $pathtofile`
            if [[ `file $abspath | grep -c 64-bit` -ne 0 ]];then
                    VGL_DRIVER=/usr/lib/nvidia-current
                    break
            elif [[ `file $abspath | grep -c 32-bit` -ne 0 ]];then
                    VGL_DRIVER=/usr/lib32/nvidia-current
                break
            fi
        fi
    fi

done

BTW. Just because MrMEEE had to take a sabbatical from development doesn't mean we should all switch over to Bumblebee and not try and work things out ourselves.

Ian

Lekensteyn commented 12 years ago

Neither program is perfect, you have the freedom to do whatever you want with it.These checks can be skipped by passing both library paths, the linker will take care of binding the right libraries:

VGL_DRIVER=/usr/lib/nvidia-current:/usr/lib32/nvidia-current