Statically Linked Linux Binary?
Moderator: Forum Moderators
Statically Linked Linux Binary?
We definitely don't have the resources to provide a Wesnoth binary for every distribution of Linux.
However, how difficult would it be to make a statically linked binary for Linux, that would be runnable on almost any distribution?
I have no idea how to do this kind of thing. Does anyone?
David
However, how difficult would it be to make a statically linked binary for Linux, that would be runnable on almost any distribution?
I have no idea how to do this kind of thing. Does anyone?
David
“At Gambling, the deadly sin is to mistake bad play for bad luck.” -- Ian Fleming
Thats not hard. From the gcc man-page:
-static
On systems that support dynamic linking, this prevents linking with the shared libraries. On other systems, this option has no effect.
All you have to do, is change the gcc Flag variables in the Makefiles and add "-static" to them. I have done so, and compiling Weshnot that way right now. Looks like every sourcefile is compiled using this Flag and there are no errors. Of course I don't have the means to test out whether the result really works without the libraries: I'm not going to install an older version of libc
But if you want to, I can either send you the compiled result (better: upload it somewhere) or I could send you the modified Makefiles. Of course they won't work for you if you have a different version of Linux running (I have Debian unstable), and ./configure would overwrite the Makefiles...
However, changing them yourself really isn't all that hard.
-static
On systems that support dynamic linking, this prevents linking with the shared libraries. On other systems, this option has no effect.
All you have to do, is change the gcc Flag variables in the Makefiles and add "-static" to them. I have done so, and compiling Weshnot that way right now. Looks like every sourcefile is compiled using this Flag and there are no errors. Of course I don't have the means to test out whether the result really works without the libraries: I'm not going to install an older version of libc
But if you want to, I can either send you the compiled result (better: upload it somewhere) or I could send you the modified Makefiles. Of course they won't work for you if you have a different version of Linux running (I have Debian unstable), and ./configure would overwrite the Makefiles...
However, changing them yourself really isn't all that hard.
Mhhh...
Doesn't seem to work fully automatic
The code compiled Ok, but did not link
The message I got:
martin@Terminus:~/downloads/wesnoth-0.7$ make
make all-recursive
make[1]: Entering directory `/home/martin/downloads/wesnoth-0.7'
Making all in src
make[2]: Entering directory `/home/martin/downloads/wesnoth-0.7/src'
Making all in .
make[3]: Entering directory `/home/martin/downloads/wesnoth-0.7/src'
g++ -I/usr/include/SDL -D_REENTRANT -DWESNOTH_PATH=\"/usr/local/share/wesnoth\" -g -O2 -static -lSDL -lpthread -lSDL_image -lSDL_mixer -lSDL_net -lSDL_ttf -o wesnoth about.o actions.o ai.o ai_attack.o ai_move.o config.o dialogs.o display.o events.o filesystem.o font.o game.o game_config.o game_events.o gamestatus.o hotkeys.o image.o intro.o key.o language.o log.o map.o mapgen.o mapgen_dialog.o mouse.o multiplayer.o multiplayer_client.o multiplayer_connect.o multiplayer_lobby.o network.o pathfind.o playlevel.o playturn.o preferences.o race.o replay.o reports.o sdl_utils.o show_dialog.o sound.o team.o terrain.o theme.o tooltips.o unit.o unit_types.o video.o button.o combo.o menu.o scrollbar.o slider.o textbox.o widget.o
about.o(.text+0x1c29): In function `about::show_about(display&)':
/home/martin/downloads/wesnoth-0.7/src/scoped_resource.hpp:88: undefined reference to `SDL_UpperBlit'
about.o(.text+0x1de2):/home/martin/downloads/wesnoth-0.7/src/scoped_resource.hpp:88: undefined reference to `SDL_UpperBlit'
I verified that the code DOES compile for me without the static option.
It looks like it can't find its files it needs. I checked though: The searched directory is there. I tried inserting a space behind the "-l", but that does not change the result. I don't now how to proceed from here...
Dave, or anybody else?
Doesn't seem to work fully automatic
The code compiled Ok, but did not link
The message I got:
martin@Terminus:~/downloads/wesnoth-0.7$ make
make all-recursive
make[1]: Entering directory `/home/martin/downloads/wesnoth-0.7'
Making all in src
make[2]: Entering directory `/home/martin/downloads/wesnoth-0.7/src'
Making all in .
make[3]: Entering directory `/home/martin/downloads/wesnoth-0.7/src'
g++ -I/usr/include/SDL -D_REENTRANT -DWESNOTH_PATH=\"/usr/local/share/wesnoth\" -g -O2 -static -lSDL -lpthread -lSDL_image -lSDL_mixer -lSDL_net -lSDL_ttf -o wesnoth about.o actions.o ai.o ai_attack.o ai_move.o config.o dialogs.o display.o events.o filesystem.o font.o game.o game_config.o game_events.o gamestatus.o hotkeys.o image.o intro.o key.o language.o log.o map.o mapgen.o mapgen_dialog.o mouse.o multiplayer.o multiplayer_client.o multiplayer_connect.o multiplayer_lobby.o network.o pathfind.o playlevel.o playturn.o preferences.o race.o replay.o reports.o sdl_utils.o show_dialog.o sound.o team.o terrain.o theme.o tooltips.o unit.o unit_types.o video.o button.o combo.o menu.o scrollbar.o slider.o textbox.o widget.o
about.o(.text+0x1c29): In function `about::show_about(display&)':
/home/martin/downloads/wesnoth-0.7/src/scoped_resource.hpp:88: undefined reference to `SDL_UpperBlit'
about.o(.text+0x1de2):/home/martin/downloads/wesnoth-0.7/src/scoped_resource.hpp:88: undefined reference to `SDL_UpperBlit'
I verified that the code DOES compile for me without the static option.
It looks like it can't find its files it needs. I checked though: The searched directory is there. I tried inserting a space behind the "-l", but that does not change the result. I don't now how to proceed from here...
Dave, or anybody else?
-
- Posts: 719
- Joined: December 9th, 2003, 9:31 pm
- Contact:
I've built a static binary with current CVS codebase. You can get it here. Please test it.
To run it you have to do:
If you test it, please tell us which version of glibc you have and if it worked or not.
To run it you have to do:
Code: Select all
./wesnoth path/to/data/files
Static binary
The static binary works fine for me with:
-Chris Potter
- Slackware 9.0
Glibc 2.3.1
-Chris Potter
"Mind over matter: If you don't mind, then it doesn't matter."
Re: Static binary
Thanks; glad you enjoy it!cp1134 wrote: P.S. I'm new here and just wanted to say that this is a fun game.
David
“At Gambling, the deadly sin is to mistake bad play for bad luck.” -- Ian Fleming
YESSS!!! I couldn't get the new versions (.7.8+) working on linux, because I need a new version of gcc to compile them, but this could really help me!
It runs on SuSE 8.1 (linux kernel 2.4.x, glibc 2.2). Of course it doesn't run THAT well because I'm using the .7.7 data files!
It runs on SuSE 8.1 (linux kernel 2.4.x, glibc 2.2). Of course it doesn't run THAT well because I'm using the .7.7 data files!
Dark penguin of the sith.