So you want to make a linux build with Unity

All things Desktop Dungeons

So you want to make a linux build with Unity

Postby GoatBot on Fri May 30, 2014 11:08 am

User avatar
GoatBot
 
Posts: 0
Joined: Wed Jun 01, 2011 4:01 pm

Re: So you want to make a linux build with Unity

Postby Andir on Tue Jun 03, 2014 11:39 am

Posting this because the original author couldn't register here:

Well I can't reply because their cocking forum registration requires you to know what animal the forum bot is and only gives you three chances to get that right before it tells you to bugger off and try again later. Bollocks to that.

I wanted to reply because chmod 777 YourGame.x86 (suggested in the second point) is an awful idea. That makes a file not only executable but writeable by anybody on the system. They could replace your game with a script that just deleted your home files. Awesome, eh..? No. Use this instead:

chmod +x YourGame.x86
Andir
 
Posts: 1
Joined: Tue Jun 03, 2014 11:34 am

Re: So you want to make a linux build with Unity

Postby yochaigal on Tue Jun 03, 2014 11:45 am

Please do not tell people to use chmod 777 filename.sh - that makes it executable to ALL users; in general considered bad practice. Use chmod +x filename.sh.

Otherwise, great write-up! Thanks for making Linux games!
yochaigal
 
Posts: 1
Joined: Tue Jun 03, 2014 11:42 am

Re: So you want to make a linux build with Unity

Postby KillaW0lf04 on Tue Jun 03, 2014 12:05 pm

You should avoid using `chmod 777 YourGame.x86` because this enables writing, reading and executing for *anyone* on the system. This means that any guest user can just rewrite the executable with a malicious script and no one would be able to stop him.

What you really want to do is `chmod +x YourGame.x86` which just adds an execute flag for everyone.
KillaW0lf04
 
Posts: 1
Joined: Tue Jun 03, 2014 12:02 pm

Re: So you want to make a linux build with Unity

Postby Aequitas on Tue Jun 03, 2014 1:09 pm

Thanks for the feedback, I'll make that change to the post!
User avatar
Aequitas
Site Admin
 
Posts: 81
Joined: Fri Mar 25, 2011 3:26 pm

Re: So you want to make a linux build with Unity

Postby dislekcia on Tue Jun 03, 2014 1:15 pm

KillaW0lf04 wrote:You should avoid using `chmod 777 YourGame.x86` because this enables writing, reading and executing for *anyone* on the system. This means that any guest user can just rewrite the executable with a malicious script and no one would be able to stop him.

What you really want to do is `chmod +x YourGame.x86` which just adds an execute flag for everyone.


Right. That makes sense.

I assume that "chmod +x YourGame.x86" is functionally equivalent to the "right click -> properties -> permissions -> allow execution" method that we explained just before the chmod line? I suggested adding a similar console command just in case people weren't using the same GUI we were (which seems likely, given the number of variants out there)... If anyone's wondering, the right click method is what was used on the release build of Desktop Dungeons, so no need to frantically go reset your file permissions ;)
User avatar
dislekcia
 
Posts: 1715
Joined: Fri Mar 25, 2011 5:58 pm
Location: Cape Town, South Africa

Re: So you want to make a linux build with Unity

Postby dislekcia on Tue Jun 03, 2014 1:16 pm

Andir wrote:Posting this because the original author couldn't register here:

Well I can't reply because their cocking forum registration requires you to know what animal the forum bot is and only gives you three chances to get that right before it tells you to bugger off and try again later. Bollocks to that.


If that's how the original author is going to behave, I'm glad they couldn't register.
User avatar
dislekcia
 
Posts: 1715
Joined: Fri Mar 25, 2011 5:58 pm
Location: Cape Town, South Africa

Re: So you want to make a linux build with Unity

Postby Toost Inc. on Tue Jun 03, 2014 1:31 pm

More on chmod and Unix file permissions can be found here.
But the sweet and short version is:
Code: Select all
chmod +x ./FileName
adds executable rights to everyone.

Alternatively, in the numeric fashion
Code: Select all
chmod 755 ./FileName

restricts anyone but the owner to write to the file, but allows them to read and execute it.

Besides that, I'd only add that a LiveUSB/CD might not always be the best way to go.
Especially if your game is pretty intensive your performance can be severely hampered from running off a LiveUSB/CD all the time, and you might think there's something wrong with your game instead! In such cases it might be better to install Linux on a separate partition.
For Ubuntu there's also something called wubi for an easy install method under Windows, unless you're on Windows 8, which currently doesn't work.

Otherwise very nice article, and I'll add that I've had no problems at all so far on Arch Linux, so good job ;)
Toost Inc.
 
Posts: 1
Joined: Tue Jun 03, 2014 1:06 pm

Re: So you want to make a linux build with Unity

Postby DrMcCoy on Tue Jun 03, 2014 1:58 pm

Ah, the chmod 777 issue has already been fixed since I first saw the article. :)
It said "Comments are closed" at the time, so I didn't comment.

There's another two issues:

4) Don't use `getconf LONG_BIT`. That will also return 64 for a lot of other 64bit non-x86 architectures. Like ia64 and sparc64. Use `uname -m` instead; it'll return "x86_64" for 64bit x86 systems or "i686" for 32bit ones. Well, theoretically, it can also return i386, i486 and i586, but you probably won't release binaries compiled for those either (and i386 has been removed from the kernel with 3.8).

5) "LANG=en" is not really a valid locale. A locale consists of language, region and encoding, like "en_US.UTF-8". "LANG=en" might work, but might also not work.

Note, there's also the special locale "C" (alternative name "POSIX"). This probably does not apply to Unity3D, but if you're doing plain C or C++, it might be wise to set LC_ALL to POSIX; otherwise the glibc will do funky things for some string conversion functions, like the printf and scanf function families. The string "3.3" might or might not sscanf to the float 3.3; alternatively, the string "3,3" might sscanf to the float 3.3.
User avatar
DrMcCoy
 
Posts: 1
Joined: Tue Jun 03, 2014 1:30 pm

Re: So you want to make a linux build with Unity

Postby M@yeulC on Tue Jun 03, 2014 2:20 pm

Well, I couldn't reply either, but someone pointed me out which animal the goat was ;-)

I would recommend
Code: Select all
`uname -m` = "x86_64"
instead of
Code: Select all
`getconf LONG_BIT` = "64"
, because the former always outputs the correct architecture.

I would finally add that I had to put
Code: Select all
export LC_ALL=C
for a lot of unity games (this affects the sorting method of the system for non-US locales). Moreover, you should not use
Code: Select all
LANG=en
but rather something like
Code: Select all
LANG=en_US
or
Code: Select all
"LANG=en_US.UTF-8"
both are valid locales, while the one you quoted is not, as far as I know.

Just some thoughts on the article, from a user perspective ;-)
M@yeulC
 
Posts: 1
Joined: Tue Jun 03, 2014 2:05 pm

Next

Return to Desktop Dungeons

Who is online

Users browsing this forum: Google [Bot] and 2 guests