16.04.2017, 10:36
(
Последний раз редактировалось kurta999; 27.12.2017 в 11:38.
)
I see that for a few people it is still problem to compile plugins for linux. But nowadays it's very easy, even easier than it was before. I will demostrate my two best solutions.
THIS TUTORIAL IS TESTED ON UBUNTU 14.04
Solution 1 - Compiling plugins under linux with GCC:
First of all, you have to understand the basic linux command line commands.
cd - change directory.
dir - list directory
For more use ******, now we don't need them right now.
If you have a cleary setted up Linux machine, then you first need to install GCC compiler. You can do it with these commands: (paste every command to your command line at once)
(We are going to install GCC4.8 + 6.0, 4.8 is old and doesn't support C++14 standard. To avoid problems in future, this is the best solution)
Source: https://gist.github.com/application2...cf9f56315a2d91
If you have x64 OS, then after former commands run these too:
Done.
OPTIONAL: It will use GCC6 by default, but if you want to change it then do with this command: sudo update-alternatives --config gcc
Now you have two choise:
1.) You can download the project from github with command line:
First you have to download the application which handles git.
Okey.
Now let's clone the project which you want to compile:
We have to go to the given directory with cd command.
And let's build the project wit GCC/G++.
After "make", you should see something similar like this:
It means that project has been successfully compiled and the binary file located in the project directory.
2). Suppose that you already have a source files already on linux machine
Now you have to go to project dir with "cd" command, where it's located. Eg cd /location/of/project
And let's build the project wit GCC/G++.
Solution 2 - Compiling plugin for linux under Windows 10:
If you don't have Windows 10, then it won't work for you! You even must have Windows 10 Redstone update for this solution, Microsoft implemented Linux Subsystem here.
First step is enabling Linux Subsystem: https://www.howtogeek.com/249966/how...on-windows-10/
If you did it succesfully, compiling works in same way as in the first solutin, you only need to specify differenct directory.
For installing compiler, use the commands above.
Cloning YSF repository to: C:\YSF
Now you see that it's fucking easy, you don't need to download compiled binaries from remote computer, you have it right now on your hard disk.
But it can be even easyer, you can access linux subsystem bash with a .bat file. Let's create a .bat file in your project dir, eg: "linux_compile.bat" and write this line to it:
Save it and now you can launch that .bat file to compile your project! Easy, isn't it?
THIS TUTORIAL IS TESTED ON UBUNTU 14.04
Solution 1 - Compiling plugins under linux with GCC:
First of all, you have to understand the basic linux command line commands.
cd - change directory.
dir - list directory
For more use ******, now we don't need them right now.
If you have a cleary setted up Linux machine, then you first need to install GCC compiler. You can do it with these commands: (paste every command to your command line at once)
(We are going to install GCC4.8 + 6.0, 4.8 is old and doesn't support C++14 standard. To avoid problems in future, this is the best solution)
Source: https://gist.github.com/application2...cf9f56315a2d91
Код:
sudo apt-get update && \ sudo apt-get install build-essential software-properties-common -y && \ sudo add-apt-repository ppa:ubuntu-toolchain-r/test -y && \ sudo apt-get update && \ sudo apt-get install gcc-snapshot -y && \ sudo apt-get update && \ sudo apt-get install gcc-6 g++-6 -y && \ sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-6 60 --slave /usr/bin/g++ g++ /usr/bin/g++-6 && \ sudo apt-get install gcc-4.8 g++-4.8 -y && \ sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.8 60 --slave /usr/bin/g++ g++ /usr/bin/g++-4.8;
Код:
sudo apt-get install gcc-6.0-multilib g++-6.0-multilib sudo apt-get install gcc-4.8-multilib g++-4.8-multilib
OPTIONAL: It will use GCC6 by default, but if you want to change it then do with this command: sudo update-alternatives --config gcc
Now you have two choise:
1.) You can download the project from github with command line:
First you have to download the application which handles git.
Код:
sudo apt-get install git
Now let's clone the project which you want to compile:
Код:
git clone https://github.com/kurta999/YSF YSF --depth 1
Код:
cd ./YSF
Код:
make
Код:
g++ -m32 -std=c++14 -Ilib -fno-stack-protector -D YSF -c -O3 -fpack-struct=1 -fPIC -w -DLINUX ./lib/sdk/*.cpp g++ -m32 -std=c++14 -Ilib -fno-stack-protector -D YSF -c -O3 -fpack-struct=1 -fPIC -w -DLINUX ./lib/raknet/*.cpp gcc -m32 -Ilib -fno-stack-protector -D YSF -c -O3 -fpack-struct=1 -fPIC -w -DLINUX ./lib/subhook/subhook.c g++ -m32 -std=c++14 -Ilib -fno-stack-protector -D YSF -c -O3 -fpack-struct=1 -fPIC -w -DLINUX ./src/*.cpp gcc -m32 -Ilib -fno-stack-protector -nodefaultlibs -fshort-wchar -shared -o "./YSF.so" *.o
2). Suppose that you already have a source files already on linux machine
Now you have to go to project dir with "cd" command, where it's located. Eg cd /location/of/project
And let's build the project wit GCC/G++.
Код:
make
If you don't have Windows 10, then it won't work for you! You even must have Windows 10 Redstone update for this solution, Microsoft implemented Linux Subsystem here.
First step is enabling Linux Subsystem: https://www.howtogeek.com/249966/how...on-windows-10/
If you did it succesfully, compiling works in same way as in the first solutin, you only need to specify differenct directory.
For installing compiler, use the commands above.
Cloning YSF repository to: C:\YSF
Код:
git clone https://github.com/kurta999/YSF /mnt/c/YSF --depth 1 cd /mnt/c/YSF make
But it can be even easyer, you can access linux subsystem bash with a .bat file. Let's create a .bat file in your project dir, eg: "linux_compile.bat" and write this line to it:
Код:
bash -c "cd /mnt/c/YSF; make YSF"