Repository navigation
Building The 64 bit Server
The SWG Source server can be built as a 32-bit or a 64-bit program. 32-bit is still the default, so nothing changes unless you choose to switch. 32-bit and 64-bit servers use the same database, so your accounts and characters carry over.
There are three ways to run a 64-bit server. Pick the one that matches your setup; each is complete on its own.
| Route | Best for | What you install |
|---|---|---|
| A. Docker | A new server, or anyone who'd rather not set up Linux packages | Docker only. Everything else is built inside the containers. |
| B. The SWG Source 3.0 VM | Switching an existing VM to 64-bit | Nothing. The VM already has the 64-bit libraries. |
| C. Another Linux system | Your own Ubuntu, Debian or similar machine | Build tools, the 64-bit Oracle client and 64-bit Java |
Staying on 32-bit? You only need The database step. Every server needs it once after this update.
Each step below ends with a Check. If a check fails, stop and fix that step (see Troubleshooting) before moving on.
Every server needs this once after updating, 32-bit or 64-bit. The login server won't start until it's done.
The usual update does it for you:
cd ~/swg-main
ant stop
ant update_swg
If you update parts by hand instead, run ant update_database and then ant compile.
Check: the output says which station id scheme was recorded, normally gcc32. On later runs it says the database is already labelled.
What this is about: each account name is turned into a number, the station id, and characters are stored under it. The old way of working out that number depended on the compiler, so 32-bit and 64-bit builds gave different numbers for the same account. It now uses fixed rules, and the database records which one your accounts use:
- gcc32: what every 32-bit server has always used. Almost everyone has this, and it's what gets recorded unless your accounts prove otherwise.
-
gcc64: only for databases created by a 64-bit test build before this fix. If that's you, add
station_id_scheme = gcc64tolocal.propertiesbefore updating.
If your accounts prove a different rule from the one being recorded, the build stops and records nothing. Ask in Discord and include build/station_id_scheme/report.txt.
Docker (Route A) does this automatically on every start.
Two containers: Oracle Database Free, and the whole 64-bit server cluster (login, game, chat) compiled from master. You don't install Oracle, Java, CMake or a compiler yourself.
- A 64-bit Linux machine (or WSL2 / Docker Desktop) with Docker and Docker Compose.
- About 25 GB of free disk space and 8 GB of RAM. More CPU cores make the first build faster.
git clone https://github.com/SWG-Source/swg-main.git
cd swg-main/docker
cp .env.example .env
nano .env
Set SWG_PUBLIC_IP to the IP of this machine as your players see it, for example 192.168.1.50 on a home network. Set MAKE_JOBS to your number of CPU cores.
Check: cat .env shows your address.
docker compose up -d --build
The first build compiles the whole server, which takes roughly 20 to 60 minutes. The first start then creates the database. Later starts take seconds.
Check:
docker compose logs -f swg
Wait for LoginServer: station ids are derived with the gcc32 scheme, then for the game servers to start. With every planet loaded, that takes several minutes.
In your game client's login.cfg, set the login server to your SWG_PUBLIC_IP, port 44453, and log in.
| To... | Run (in swg-main/docker) |
|---|---|
| Stop the server | docker compose stop |
| Start it again | docker compose start |
| Follow the logs | docker compose logs -f swg |
| Rebuild with the latest code | docker compose build --no-cache swg && docker compose up -d |
| Delete everything, including the database | docker compose down -v |
Stopping saves the world. docker compose stop runs the server's normal shutdown: players are warned, the database does a final save, then the servers stop. It takes about a minute. The database lives in a Docker volume, so stopping, starting and rebuilding keep your accounts and characters. Only down -v deletes them.
More settings and details: swg-main/docker/README.md.
The 3.0 VM already has everything a 64-bit build needs: a 64-bit system (openSUSE Leap 15.3), GCC 7, CMake 3.17, the 64-bit Oracle client and a 64-bit Java 11. You only change settings and rebuild.
Do these as the swg user, in a terminal on the VM.
cd ~/swg-main
ant stop
git pull
Edit ~/swg-main/local.properties (create it if it doesn't exist), for example with nano ~/swg-main/local.properties, and add:
bits = 64
java_home.64 = /usr/lib64/jvm/java-11-openjdk
The Oracle client is already at the default 64-bit location, so it needs no setting.
Use local.properties, not build.properties. build.properties is replaced when you update, and your changes would conflict.
Check: cat ~/swg-main/local.properties shows both lines.
The server's config still points Java at /usr/java, which on the VM is the 32-bit Java. A 64-bit server can't load it. Add this line to the end of ~/.bashrc:
export LD_LIBRARY_PATH=/usr/lib64/jvm/java-11-openjdk/lib/server:$LD_LIBRARY_PATH
Then close the terminal and open a new one.
Check: echo $LD_LIBRARY_PATH starts with /usr/lib64/jvm/java-11-openjdk/lib/server.
Switching between 32-bit and 64-bit needs a clean rebuild:
cd ~/swg-main
ant clean_src
ant update_swg
This takes a while. It should end with BUILD SUCCESSFUL, and it also does the database step.
Check:
file ~/swg-main/build/bin/SwgGameServer
It says ELF 64-bit.
ant start
Check: log in with your client as usual. Your accounts and characters should all be there.
Going back to 32-bit: remove the two lines from local.properties and the line from ~/.bashrc, open a new terminal, and repeat B4.
These commands are for Ubuntu and Debian. Other distributions need the same things under their own package names. You also need an Oracle database for the server; the 3.0 VM and Route A both include one.
uname -m
Check: it prints x86_64. If it prints i686 or i386, the system is 32-bit and can't run a 64-bit server.
sudo apt-get update
sudo apt-get install -y ant bison flex build-essential git perl alien libaio1 wget \
libboost-dev libboost-program-options-dev libcurl4-gnutls-dev \
libncurses5-dev libpcre3-dev libsqlite3-dev libxml2-dev zlib1g-dev
On Ubuntu 24.04 and newer, libaio1 is called libaio1t64.
The chat server needs CMake 3.14 or newer. If cmake --version shows an older one (Ubuntu 18.04 ships 3.10), install a newer one:
cd /tmp
wget https://github.com/Kitware/CMake/releases/download/v3.17.5/cmake-3.17.5-Linux-x86_64.tar.gz
sudo tar -xzf cmake-3.17.5-Linux-x86_64.tar.gz -C /opt
sudo ln -sf /opt/cmake-3.17.5-Linux-x86_64/bin/* /usr/local/bin/
Check: cmake --version shows 3.14 or newer.
The server needs the 64-bit Oracle Instant Client: the basic, devel and sqlplus packages. These commands install version 21.18, the version the Docker route uses:
cd /tmp
for p in basic devel sqlplus; do
wget https://download.oracle.com/otn_software/linux/instantclient/2118000/oracle-instantclient-$p-21.18.0.0.0-1.x86_64.rpm
sudo alien -i --scripts oracle-instantclient-$p-21.18.0.0.0-1.x86_64.rpm
done
Check:
ls /usr/lib/oracle/21/client64/lib/libclntsh.so /usr/include/oracle/21/client64/oci.h
Both files are listed.
sudo apt-get install -y openjdk-11-jdk
Check: /usr/lib/jvm/java-11-openjdk-amd64/bin/java -version mentions 64-Bit.
Add this line to the end of ~/.bashrc, then close the terminal and open a new one:
export LD_LIBRARY_PATH=/usr/lib/oracle/21/client64/lib:/usr/lib/jvm/java-11-openjdk-amd64/lib/server:$LD_LIBRARY_PATH
Check: echo $LD_LIBRARY_PATH starts with /usr/lib/oracle/21/client64/lib.
Add to ~/swg-main/local.properties:
bits = 64
oracle_home.64 = /usr/lib/oracle/21/client64
oracle_include.64 = /usr/include/oracle/21/client64
java_home.64 = /usr/lib/jvm/java-11-openjdk-amd64
Check: cat ~/swg-main/local.properties shows the four lines.
cd ~/swg-main
ant stop
ant clean_src
ant update_swg
ant start
Check: file ~/swg-main/build/bin/SwgGameServer says ELF 64-bit, and you can log in with your client.
GCC is the default. To build with Clang instead, install it, add compiler = clang to local.properties, and rebuild with ant clean_src then ant compile.
The build runs the commands clang and clang++. If yours are installed with a version number (for example clang-10), link them to those names:
sudo ln -s /usr/bin/clang-10 /usr/local/bin/clang
sudo ln -s /usr/bin/clang++-10 /usr/local/bin/clang++
| Problem | Fix |
|---|---|
| The login server stops at startup and mentions the station id scheme | The database isn't labelled yet. Do the database step. |
| The game server stops at startup with a Java or libjvm error | The library path step (B3 or C5) is missing or was done in another terminal. Check echo $LD_LIBRARY_PATH in the terminal you run ant start from. |
| Build errors about oci.h or libclntsh |
oracle_home.64 or oracle_include.64 doesn't match where the Oracle client is installed. Re-run the check in C3. |
file still says 32-bit after building |
bits = 64 isn't in local.properties in the swg-main folder. Fix it, then ant clean_src and rebuild. |
cmake errors while building the chat server |
CMake is older than 3.14. See C2. |
Docker: docker compose up stops with an error about SWG_PUBLIC_IP or binding a port |
SWG_PUBLIC_IP in .env is missing or isn't an address of this machine. Check it with ip addr. |
Docker: the swg container stops or keeps restarting |
Run docker compose logs swg and read the last lines; they say which step failed. |
ORA-12504 when running sqlplus yourself |
The connect string needs the host as well as the service name: swg/swg@localhost/swg, not swg/swg@swg. |
Still stuck? Ask in Discord. Say which route and step failed, paste the error, and include your system (cat /etc/os-release) and compiler (gcc --version).
| Setup | Result |
|---|---|
| Docker (Route A), GCC 7.5 on Ubuntu 18.04 | Builds from master, starts all 82 server processes (38 game servers), restarts, and stops cleanly with a final save |
| SWG Source 3.0 VM, GCC 7 | 64-bit builds and runs; players logged in and saved movement with both the 32-bit and 64-bit clients |
| Clang 10 on Ubuntu 18.04 | All 21 server and tool programs build; not yet run |
| openSUSE Leap / Tumbleweed | Built and run by community testers |
| GCC 15 and 16 on Arch Linux | Build only, with two small header fixes that aren't merged yet |
If you get it running somewhere else, tell us in Discord and we'll add it here.
If your login and cluster tables live in different database schemas, or you want to see what the automatic step does, the manual steps are in src/game/server/database/tools/station_id_scheme/README.md.