If you want to create scripts for San Andreas Multiplayer, you usually compile them on your windows PC.
But since you might want to automate it on a linux machine (e.g. to test your scripts on travis-ci), the pawncc.exe won't run on linux out of the box.
I am aware of the fact, that the team of the pawn language provides a native linux compiler called pawncc on their website, but the resulting .amx files do not work with the samp server.
To get our ubuntu linux box ready for compiling samp pawn scripts, we need some essentials.
First of all: the official wine repository, to get the latest version of wine:
sudo add-apt-repository ppa:ubuntu-wine/ppa
sudo apt-get update
Now we install latest wine stable (at the time of writing 1.7):
sudo apt-get install wine
Since wine applications run as X-Applications, we will need an X server installed. If you aren't
on a linux desktop PC, X server is not installed. We can use xvfb as alternative. The shipped commandline tool called xfvb-run
will allow us to run a single command with a "fake" X server and has less overhead then the entire X server system.
sudo apt-get install xvfb
Since we will need some dlls installed, to get pawncc.exe
running, we'll install winetricks to ease the installation of
those.
sudo apt-get install winetricks
Sine wine setups are user-wide, we need to continue by using a normal user and won't execute the next steps as root. That's why I did not append sudo
to the next commands.
Now we have to install vcrun6 (runtime of visual studio 6 projects) and vcrun2005 (runtime of visual studio 2005 projects) by using winetricks:
xvfb-run 'winetricks' --verbose --unattended vcrun6
xvfb-run 'winetricks' --verbose --unattended vcrun2005
If xvfb-run throws this error:
XIO: fatal IO error 11 (Resource temporarily unavailable) on X server ":99"
after 143 requests (140 known processed) with 0 events remaining.
you might start xvfb-run with the parameter: -n 1337
, to change the server port to 1337 instead of 99.
If something breaks with winetricks and you want to start from scratch: remove the .wine-folder and the wine environment will be entirely clean again.
Finally we can head into our samp server folder (samp server download) and execute:
cd gamemodes
wine start ../pawno/pawncc.exe grandlarc.pwn -ograndlarc.amx \
-O0 -";" -"(" -rcompile.info.log -ecompile.error.log \
2>errors.txt
Those parameters: -rcompile.info.log
, -ecompile.error.log
and piping the stderr output to errors.txt are helpful,
if you want to view the compile infos afterwards. You might omit this parameters.
Et voilà: grandlarc.amx
is generated!