Source-Python-Dev-Team / Source.Python

This plugin aims to use boost::python and create an easily accessible wrapper around the Source Engine API for scripter use.
http://forums.sourcepython.com
GNU General Public License v3.0
163 stars 31 forks source link

[REQUEST] How to compile SP build #401

Closed NosferatuJoe closed 2 years ago

NosferatuJoe commented 3 years ago

Since the latest available SP download is months old I would love a feature where someone could beta test the latest SP version available on github. As a programming newb myself, it's kind of hard to find how to use the latest commit build on github. As far as I understand I have to compile it in Linux since I'm running a linux CSGO server. BUT I've never ran a linux distro nor do I understand how I need to do this. Is there an easier way or atleast a guide on how to do this?

I'm requesting this because some commits contain potential fixes for problems that I'm having.

srpg commented 3 years ago

There is Guide to compile yourself a build.

NosferatuJoe commented 3 years ago

Thanks for the heads-up. I tried to build SP on ubuntu 20.04 using virtualbox & on windows but I can't seem to get it to work. On ubuntu I struggled with installing GCC since you have to build that yourself and I'm a rookie with linux/ubuntu. Also on windows I installed all prerequirements and when I select the game it just doesn't do anything in the "cmd" window, nor does it create the files in the builds/windows/csgo/, it's just empty.

So now I'm kind of stuck since there is no specific guide on how to do all this. I'm not a computer dummy and mostly I find stuff myself but this is harder than I thought.

Ayuto commented 3 years ago

There are no beta builds for SP. We had a buildbot in the past that created a new release for every single GitHub commit and preserved the last 10 or 50 builds, but unfortunately we don't have that hosted server anymore. Instead, the buildbot is now running on a local virtual machine that has to be triggered manually.

To help you with building SP yourself I would need a little bit more information (e. g. the output of your cmd window).

Btw. I will create a new release today.

NosferatuJoe commented 3 years ago

First of all thank you so much for the update. According to my server cpu & ram usage, our WCS mod seems to run a lot better. Not sure if it's due to the update but I haven't done any changes besides it. CPU usage is stable around 40-50% while previously it would be 60% on idle and spike to 90-100%.

Also regarding the beta builds, isn't it possible to add a buildbot on github using "Actions"? Not sure if it's free and hard to implement, and besides that it would just be a convenience thing.

PS: Ya'll forgot to change the copyright date in "sp info" command, it still says 2019-2020.

Ayuto commented 3 years ago

Thanks for the heads up! I have updated the copyright date.

I don't think GitHub Actions has enough hardware resources in the free version. CPU time and disk space is very limited and probably wouldn't suffice for compiling all Source.Python configurations.

NosferatuJoe commented 3 years ago

Thanks for the heads up! I have updated the copyright date.

I don't think GitHub Actions has enough hardware resources in the free version. CPU time and disk space is very limited and probably wouldn't suffice for compiling all Source.Python configurations.

Fair enough. I'm not sure how to check, if the cost isn't that steep I might want to cover the cost of it.

NosferatuJoe commented 3 years ago

Could someone please make a video on how I can compile a build in Linux/Ubuntu? I tried it using the guide but it didn't work and I'm a noob at linux. I would even pay for someone to make a short video on how to do it. I can't wrap my head around it, it seems so simple in the guide but it doesn't work for me and I tried to install the versions which are specified..

I also wondered, if I compile on Windows that's only for .dll right?

@srpg

srpg commented 3 years ago

I haven't been able compile SP build on windows. I can't test Linux, since my computer only have windows.

NosferatuJoe commented 3 years ago

@srpg Do you have experience with compiling SP build on Linux/Ubuntu? I'm willing to pay for a tutorial video or detailed explanation since I can't get it to work.. I have like zero experience with Linux so the guide online is kind of very basic..

srpg commented 3 years ago

I don't have experience with compile SP build on Linux. I can't try it since i don't have any Linux computer.

NosferatuJoe commented 3 years ago

@srpg I tried it using ubuntu on virtual machine but I can't get my head around it. It isn't really easy without a decent step-by-step guide for a beginner linux user

srpg commented 3 years ago

I just tried aswell in linux but couldn't make work, but i just did manage make build from windows, after i got help from @CookStar to solve the issue not able to compile files.

Ayuto commented 3 years ago

Where exactly are you stucking? What's the output of your terminal? And why do you want to compile it yourself?

NosferatuJoe commented 3 years ago

I will reinstall ubuntu on a virtual machine and try to compile SP again and give you the output of the terminal.

I want to compile it myself so I can test out any new commits, because sometimes they contain useful fixes for me. I also like to test the latest commits before an official build is released, since there is no release history on the http://downloads.sourcepython.com/ page. There is only one build available and if, for whatever reason, that build doesn't work with your plugins, you're kind of fucked..

Ayuto commented 3 years ago

The previous version is also available. If you install Ubuntu, try Ubuntu 16. It still has the older GCC versions.

NosferatuJoe commented 3 years ago

@Ayuto Where can I find a previous version? And thanks for the hint, I'll try to compile it with Ubuntu 16 instead.

srpg commented 3 years ago

@Ayuto i tried to compile on linux at virtual machine but everytime i try to compile a new build it gives me these errors:

mitja@mitja-VirtualBox:~$ '/home/mitja/Työpöytä/Source.Python-master/src/Build.sh' Choose the branch you wish to build against:

/home/mitja/Työpöytä/Source.Python-master/src/Build.sh: 20: cd: can't cd to makefiles/branch -e (1) .vboxclient-clipboard -e (2) -e (3) -e (4) -e (5) -e (6) .vboxclient-seamless -e (7) .vboxclient-display-svga-x11 -e (8) .vboxclient-draganddrop -e (9)

Do you have any clue what causes that error? I would normaly compile at my windows computer, but linux server doesn't work with the build i make on windows.

satoon101 commented 3 years ago

You're currently in your home (~) directory, so when it tries to cd into the relative makefiles/branch directory, it's literally trying to cd into ~/makefiles/branch, which likely won't exist. Instead, you should just need to cd into the directory containing the Build.sh file and then execute it, ie:

cd /home/mitja/Työpöytä/Source.Python-master/src
sh Build.sh
CookStar commented 3 years ago

Useful commands: (cd /home/mitja/Työpöytä/Source.Python-master/src/ && ./Build.sh) or (cd /home/mitja/Työpöytä/Source.Python-master/src/ && ./Build.sh css)

srpg commented 3 years ago

I still fail to compile build in linux. mitja@mitja-VirtualBox:~$ cd /home/mitja/Työpöytä/Source.Python-master/src mitja@mitja-VirtualBox:~/Työpöytä/Source.Python-master/src$ '/home/mitja/Työpöytä/Source.Python-master/src/Build.sh' Choose the branch you wish to build against:

-e (1) tf2 -e (2) css -e (3) csgo -e (4) blade -e (5) l4d2 -e (6) bms -e (7) gmod -e (8) dods -e (9) hl2dm

2 /home/mitja/Työpöytä/Source.Python-master/src/Build.sh: 58: Bad substitution mitja@mitja-VirtualBox:~/Työpöytä/Source.Python-master/src$

I also tried those commands and didn't work

CookStar commented 3 years ago

Try bash Build.sh.

srpg commented 3 years ago

Still fails to build, here is the log from it build.log .

CookStar commented 3 years ago

Still fails to build, here is the log from it build.log .

It seems multilib is missing. Also, you will need an older version of GCC(4.8 recommended). https://github.com/Source-Python-Dev-Team/Source.Python/issues/413#issuecomment-922658272 http://wiki.sourcepython.com/contributing/building.html#linux

Edit: This may be helpful. https://stackoverflow.com/questions/4643197/missing-include-bits-cconfig-h-when-cross-compiling-64-bit-program-on-32-bit

srpg commented 3 years ago

I have issue to download older version of GCC. When i try: mitja@mitja-VirtualBox:~$ sudo apt-get install gcc-4.8 [sudo] password for mitja: Reading package lists... Done Building dependency tree
Reading state information... Done Package gcc-4.8 is not available, but is referred to by another package. This may mean that the package is missing, has been obsoleted, or is only available from another source

E: Package 'gcc-4.8' has no installation candidate

I also tried build from source, but i didn't manage to do it

Ayuto commented 3 years ago

Have you tried Ubuntu 16 as mentioned above? It should be available.

srpg commented 3 years ago

Have you tried Ubuntu 16 as mentioned above? It should be available.

I haven't try that, tomorrow will try it. Will in Ubuntu 16 work sudo apt-get install gcc-4.8 to download or does it have to compile manually?

srpg commented 3 years ago

I tried with Ubuntu 16, still came issues It shows: CMakeFiles/Makefile2:104: recipe for target 'CMakeFiles/core.dir/all' failed make[1]: [CMakeFiles/core.dir/all] Error 2 Makefile:83: recipe for target 'all' failed make: [all] Error 2 ./Build.sh: 152: ./Build.sh: Bad substitution mitja@mitja-VirtualBox:~$ Here is the build log build.log .

Ayuto commented 3 years ago

Sorry for the late reply. It looks like it's still compiling with 5.4. Please try setting the path to the 4.8 version:

CXX=/usr/bin/g++-4.8
srpg commented 3 years ago

Sorry for the late reply. It looks like it's still compiling with 5.4. Please try setting the path to the 4.8 version:

CXX=/usr/bin/g++-4.8

Where i need to set the path? Some reason it tries with 5.4, even i have installed 4.8 version.

Ayuto commented 3 years ago

Just set it in you terminal right before calling the build script.

srpg commented 3 years ago

It still seem to compile with 5.4 version. Even i did set it CXX=/usr/bin/g++-4.8 in terminal.

NosferatuJoe commented 2 years ago

I'm interested in this. @srpg Did you eventually get it working?

srpg commented 2 years ago

@NosferatuJoe I didn't get it work, i just don't get why it tries compile with 5.4 version even set the path to 4.8. I am pretty close to solve it, the compile part is anymore remaining issue for me

Ayuto commented 2 years ago

It still seem to compile with 5.4 version. Even i did set it CXX=/usr/bin/g++-4.8 in terminal.

I forgot to mention that you also need to export the variable: export CXX Alternatively, you can also set it inside of the script.

Please also make sure the path exists on your system.

srpg commented 2 years ago

Now i got it compile, thanks for the help!