Pages: [1]
  Print  
Author Topic: GtkRadiant on LInux - Where's BSPC? Here it is!  (Read 48863 times)
bill-----
Half-Nub


Cakes 8
Posts: 60


« on: February 03, 2009, 09:42:31 PM »

So, you decided to create a .aas file for bots for your new map you
made with GtkRadiant on Linux, and instead of joy you got pain with a
'BSP process monitoring' popup, and looking at the log output in the
terminal window you started GtkRadiant from you found a line like

'sh: /home/oamap/gtkradiant/GtkRadiant/install/bspc: not found'

What happened?

bspc isn't part of radiant, and in fact comes with the Q3 engine
source code along with an earlier version of the map compiler, q3map.
Some versions of radiant came with a pre-compiled bspc program, but
1.6 doesn't.

So, what to do?  Build it ourselves, of course.

The code for bspc isn't in the ioquake3 source (OA is based on ioquake3)
either, so we must go to the original source.

The Q3 source code is available from any number of locations you can
find with your favorite search engine.  Download the code (I assume you
got the .zip file), and let's build bspc!

Code:
mkdir id
cd id
unzip <somewhere>/quake3-1.32b-source.zip
cd quake3-1.32b/code/bspc

Correct what gcc considers to be a syntax error in l_bsp_hl.c at line
250 using your text editor of choice.

Make a backup first!

Code:
cp  l_bsp_hl.c  l_bsp_hl.c.orig

Be a man!

Code:
vi l_bsp_hl.c

Line 250  looks like this:

                checksum = (checksum << 4) ^ *((char *)buffer)++;

But should look like this:

                checksum = (checksum << 4) ^ *((char *)buffer++);

The difference is that 'buffer)++' has changed to 'buffer++)'.  Basically,
the ')' was moved from the left of to the right of '++'.

Change line 250 as explained above, save and exit the editor.

Compile.

Code:
make

Copy the resultant bspc executable to a location where GtkRadiant will
look for it.  If you followed my earlier post about building GtkRadiant
1.6, you would run

Code:
cp bspc /home/oamap/gtkradiant/GtkRadiant/install

where oamap is understood to be your login name. Otherwise, put it in
the directory mentioned in the 'not found' message you got beforehand.

When you attempt to use bspc you'll still get the pop-up in GtkRadiant
with title 'BSP process monitoring' and text beginning 'The connection
timed out'. Just close it and consider it a nuisance.  We may come up
with a solution later.

Look for something like

BSPC run time is     4 seconds
Closed log bspc.log
system() returned

in the terminal window for an indication of completion.  You can also
look at the file bspc.log, which will be in the directory you were in
when you started GtkRadiant, for more details on how the AAS compile went.

Logged
Neon_Knight
In the year 3000
***

Cakes 49
Posts: 3775


Trickster God.


« Reply #1 on: November 19, 2010, 04:41:17 PM »

Awesome. ^^

However, in the make step, this was the output:
Code:
gcc -Dstricmp=strcasecmp -m486 -O6 -ffast-math -funroll-loops -fomit-frame-pointer -fexpensive-optimizations -malign-loops=2 -malign-jumps=2 -malign-functions=2 -DLINUX -DBSPC -o _files.o -c _files.c
cc1: error: unrecognized command line option "-m486"
_files.c:1: warning: -malign-loops is obsolete, use -falign-loops
_files.c:1: warning: -malign-jumps is obsolete, use -falign-jumps
_files.c:1: warning: -malign-functions is obsolete, use -falign-functions
make: *** [_files.o] Error 1

And there's no executable to copy. What am I doing wrong?
Logged


"Detailed" is nice, but if it gets in the way of clarity, it ceases being a nice addition and becomes a problem. - TVT
Want to contribute? Read this.
sago007
Posts a lot
*

Cakes 62
Posts: 1664


Open Arena Developer


WWW
« Reply #2 on: November 19, 2010, 04:44:22 PM »

Using 64 bit?

I don't remember the error message but I had to compile bspc in 32 bit. Rather annoying.
Logged

There are nothing offending in my posts.
Neon_Knight
In the year 3000
***

Cakes 49
Posts: 3775


Trickster God.


« Reply #3 on: November 19, 2010, 04:55:32 PM »

I'm using 32-bit.
Logged


"Detailed" is nice, but if it gets in the way of clarity, it ceases being a nice addition and becomes a problem. - TVT
Want to contribute? Read this.
Neon_Knight
In the year 3000
***

Cakes 49
Posts: 3775


Trickster God.


« Reply #4 on: November 19, 2010, 05:02:49 PM »

Anyway, (sorry for the double post) I've found another working bspc here: https://github.com/bnoordhuis/bspc
Logged


"Detailed" is nice, but if it gets in the way of clarity, it ceases being a nice addition and becomes a problem. - TVT
Want to contribute? Read this.
Falkland
Member


Cakes 6
Posts: 590


« Reply #5 on: November 19, 2010, 05:50:15 PM »

Awesome. ^^

However, in the make step, this was the output:
Code:
gcc -Dstricmp=strcasecmp -m486 -O6 -ffast-math -funroll-loops -fomit-frame-pointer -fexpensive-optimizations -malign-loops=2 -malign-jumps=2 -malign-functions=2 -DLINUX -DBSPC -o _files.o -c _files.c
cc1: error: unrecognized command line option "-m486"
_files.c:1: warning: -malign-loops is obsolete, use -falign-loops
_files.c:1: warning: -malign-jumps is obsolete, use -falign-jumps
_files.c:1: warning: -malign-functions is obsolete, use -falign-functions
make: *** [_files.o] Error 1

And there's no executable to copy. What am I doing wrong?

The compiler said what's wrong ( cc1: error: unrecognized command line option "-m486" ) : this option was already removed from gcc flags years ago . You should replace it with -march=i486 and/or -mtune=i486 even if nowadays it should be better use -march=i686 -mtune=i686 on a modern 32bit machine ( >= PentiumII , single core )

-O6 doesn't have any sense since gcc max optimization level is -O3

-fexpensive-optimizazions is redundant since it's added automatically by gcc starting by the optimizazione level -O2

-malign-<series> are obsolete too , change them with the respective -falign-<series> ; anyway they are redundant too since gcc adds -falign-<series>=2 starting by -O2 level .
Logged
Peter Silie
Member


Cakes 2008
Posts: 610



« Reply #6 on: November 20, 2010, 04:09:28 AM »

+1

Maybe somebody should link a working file here?
Logged
GrosBedo
Member


Cakes 20
Posts: 710


« Reply #7 on: June 17, 2013, 05:08:38 AM »

That's highly weird that BSPC isn't in the ioquake3 repo since that's a needed file to compose maps.

Are the ioquake3 devs aware of the issue?

PS: the version linked by Neon_Knight seems to be a lot better since it fixes a few issues and add support for QuakeLive.
« Last Edit: June 17, 2013, 05:11:36 AM by GrosBedo » Logged
Neon_Knight
In the year 3000
***

Cakes 49
Posts: 3775


Trickster God.


« Reply #8 on: June 17, 2013, 06:46:50 AM »

BSPC isn't included into the ioquake3 releases. It comes from the original 1.32c soure code release. Hence why it's... outdated.
Logged


"Detailed" is nice, but if it gets in the way of clarity, it ceases being a nice addition and becomes a problem. - TVT
Want to contribute? Read this.
GrosBedo
Member


Cakes 20
Posts: 710


« Reply #9 on: July 02, 2013, 07:04:51 AM »

Yes indeed Neon_Knight, but maybe they should include it at last? What's the point of the engine if it misses such a critical part, the one that is able to generate maps...

However, here is another updated BSPC, called MBSPC:
http://linradiant.intron-trans.hu/mbspc.html

To my knowledge, this one isn't related to the other project, both seems to have forked from the original Q3 version.
Logged
Neon_Knight
In the year 3000
***

Cakes 49
Posts: 3775


Trickster God.


« Reply #10 on: July 11, 2013, 03:02:56 PM »

Here's a compiled version of BSPC for Windows from this repo: https://github.com/TTimo/bspc. It's a fork of the bnoordhuis repo linked some posts above.

Quote
Usage:   bspc [-<switch> [-<switch> ...]]
Example 1: bspc -bsp2aas /quake3/baseq3/maps/mymap?.bsp
Example 2: bspc -bsp2aas /quake3/baseq3/pak0.pk3/maps/q3dm*.bsp

Switches:
   bsp2aas  <[pakfilter/]filter.bsp>    = convert BSP to AAS
   reach    <filter.bsp>                = compute reachability & clusters
   cluster  <filter.aas>                = compute clusters
   aasopt   <filter.aas>                = optimize aas file
   aasinfo  <filter.aas>                = show AAS file info
   output   <output path>               = set output path
   threads  <X>                         = set number of threads to X
   cfg      <filename>                  = use this cfg file
   optimize                             = enable optimization
   noverbose                            = disable verbose output
   breadthfirst                         = breadth first bsp building
   nobrushmerge                         = don't merge brushes
   noliquids                            = don't write liquids to map
   freetree                             = free the bsp tree
   nocsg                                = disables brush chopping
   forcesidesvisible                    = force all sides to be visible
   grapplereach                         = calculate grapple reachabilities
Logged


"Detailed" is nice, but if it gets in the way of clarity, it ceases being a nice addition and becomes a problem. - TVT
Want to contribute? Read this.
Gig
In the year 3000
***

Cakes 45
Posts: 4394


WWW
« Reply #11 on: September 13, 2013, 06:44:14 AM »

If you are interested, I repackaged q3map2build tool, for more comfortable installation.
You can find it here: http://digilander.iol.it/flagraiders/files/tools/q3map2build1_0_25_withDLL_BSPC.zip
And that zip includes a few different BSPC versions (for Windows).
« Last Edit: September 13, 2013, 06:58:13 AM by Gig » Logged

I never want to be aggressive, offensive or ironic with my posts. If you find something offending in my posts, read them again searching for a different mood there. If you still see something bad with them, please ask me infos. I can be wrong at times, but I never want to upset anyone.
Neon_Knight
In the year 3000
***

Cakes 49
Posts: 3775


Trickster God.


« Reply #12 on: January 02, 2014, 10:32:32 AM »

I want to cross-compile a version of BSPC from Linux for Windows, as it's really needed. What should I do in Linux?
Logged


"Detailed" is nice, but if it gets in the way of clarity, it ceases being a nice addition and becomes a problem. - TVT
Want to contribute? Read this.
pelya
Member


Cakes 6
Posts: 399


WWW
« Reply #13 on: January 03, 2014, 07:14:05 AM »

Please install mingw32 package - sudo apt-get install mingw32, download bspc (I've used this repo),
then edit Makefile - replace CC=gcc with CC=i586-mingw32msvc-gcc, replace -DLINUX with -DWIN32 in CFLAGS, remove -lpthread from LDFLAGS.
Run make, everything compiles Smiley I've also attached a patch.
Logged
Neon_Knight
In the year 3000
***

Cakes 49
Posts: 3775


Trickster God.


« Reply #14 on: January 03, 2014, 08:07:07 AM »

Tried with your steps, but it doesn't compile. Here's the log:

Code:
[tons of undefined references to functions]
collect2: ld returned 1 exit status
make: *** [bspc] Error 1

I've used this repo: https://github.com/bnoordhuis/bspc

I have two more to test.

EDIT: Tested also with your repo and TTimo's repo. All three of them compile a Linux binary but have the same output for Windows (the above error code).

Is there something I'm missing?
« Last Edit: January 03, 2014, 08:16:39 AM by Neon_Knight » Logged


"Detailed" is nice, but if it gets in the way of clarity, it ceases being a nice addition and becomes a problem. - TVT
Want to contribute? Read this.
pelya
Member


Cakes 6
Posts: 399


WWW
« Reply #15 on: January 03, 2014, 08:46:19 AM »

Seems like you have different mingw32 than me. try to add standard Windows libs to your LDFLAGS:
LDFLAGS=-lm -lmsvcrt -lkernel32 -luser32 -lgdi32
Look into directory /usr/i586-mingw32msvc/lib for more libs - just grep <undefined_symbol> *.a inside that dir.
Logged
sago007
Posts a lot
*

Cakes 62
Posts: 1664


Open Arena Developer


WWW
« Reply #16 on: June 28, 2016, 03:18:17 PM »

I looked around on Github and I merged some of the different versions of bspc.
I created a small fork there I fixed cross compiling and some undefined behaviors.
The memory limits are slightly increased so that it can actually create a aas file for islandctf4a3

The compiled version can be downloaded here: https://github.com/sago007/bspc/releases/download/v2016.6.28/sago007_bspc_2016-06-28.zip

Now I just need to find the reason for NetRadiant segfaulting in Ubuntu 16.04 64 bit.
Logged

There are nothing offending in my posts.
Neon_Knight
In the year 3000
***

Cakes 49
Posts: 3775


Trickster God.


« Reply #17 on: September 30, 2017, 10:16:54 AM »

Tried to compile your version of bspc, sago, and it outputted this:

Code:
CMake Error at CMakeLists.txt:3 (set):
  Syntax error in cmake code at
    $HOME/dev/radiantrepos/bspc/sago007/CMakeLists.txt:3
  when parsing string
    ${CMAKE_C_FLAGS} -Dstricmp=strcasecmp -DCom_Memcpy=memcpy -DCom_Memset=memset \
  -DMAC_STATIC= -DQDECL= -DBSPC -D_FORTIFY_SOURCE=2 \
  -I.  -Ideps -Wall -std=gnu11 -Wsuggest-attribute=noreturn \
  -Wsuggest-attribute=format -ffast-math
  syntax error, unexpected cal_SYMBOL, expecting $end (132)
-- Configuring incomplete, errors occurred!
Any solution to this?
Logged


"Detailed" is nice, but if it gets in the way of clarity, it ceases being a nice addition and becomes a problem. - TVT
Want to contribute? Read this.
sago007
Posts a lot
*

Cakes 62
Posts: 1664


Open Arena Developer


WWW
« Reply #18 on: September 30, 2017, 11:25:11 AM »

Just tried it. Worked fine.

To reproduce:
Code:
docker pull sago007/docker_mxe_openarena_engine_builder
docker run -it --rm --user root sago007/docker_mxe_openarena_engine_builder
In docker:
Code:
apt-get update && apt-get install mxe-x86-64-w64-mingw32.static-gcc
cd /staging
git clone https://github.com/sago007/bspc.git
cd bspc
x86_64-w64-mingw32.static-cmake .
make
And I have a Windows 64 bit binary.
Logged

There are nothing offending in my posts.
Neon_Knight
In the year 3000
***

Cakes 49
Posts: 3775


Trickster God.


« Reply #19 on: September 30, 2017, 11:30:15 AM »

Oh, forgot to mention the SO. Linux Mint 17.3 Cinnamon. Trying to cross-compile into Win32 and Win64 binaries.
Logged


"Detailed" is nice, but if it gets in the way of clarity, it ceases being a nice addition and becomes a problem. - TVT
Want to contribute? Read this.
sago007
Posts a lot
*

Cakes 62
Posts: 1664


Open Arena Developer


WWW
« Reply #20 on: September 30, 2017, 12:30:14 PM »

Seems like a problem with the Linux Mint cross compile options. It can be a hell to keep track of. I always cross build using MXE cmake and always through Docker. It is the only way I can get it to work consistently.
Logged

There are nothing offending in my posts.
Neon_Knight
In the year 3000
***

Cakes 49
Posts: 3775


Trickster God.


« Reply #21 on: September 30, 2017, 12:35:21 PM »

YAY! Managed to cross-compile this repo with Linux Mint, following the steps given by pelya above (Additionally: create a symbolic link from /usr/bin/i586-mingw32msvc-windres to usr/bin/windres)!

I will build 64-bit binaries later.
« Last Edit: October 03, 2017, 01:17:41 PM by Neon_Knight » Logged


"Detailed" is nice, but if it gets in the way of clarity, it ceases being a nice addition and becomes a problem. - TVT
Want to contribute? Read this.
Neon_Knight
In the year 3000
***

Cakes 49
Posts: 3775


Trickster God.


« Reply #22 on: October 03, 2017, 01:17:26 PM »

DOUBLE YAY! Got BSPC compiled from both bnoordhuis and ttimo repos just by following pelya's steps. Had to redownload both repos. Both Linux 32-bit, Win32 and Win64. PLEASE TEST!

https://www.dropbox.com/s/0cer389pvcohbc2/bspc-bnoordhuis-ttimo-multi-20171003.zip?dl=0
Logged


"Detailed" is nice, but if it gets in the way of clarity, it ceases being a nice addition and becomes a problem. - TVT
Want to contribute? Read this.
Pages: [1]
  Print  
 
Jump to: