Compiling on FreeBSD

Trying to build your own version of Vega Strike and having problems? Unix users, paste your config.log here (stderr output alone is not helpful).
ace123
Lead Network Developer
Lead Network Developer
Posts: 2560
Joined: Sun Jan 12, 2003 9:13 am
Location: Palo Alto CA
Contact:

Post by ace123 »

There are indeed two ".vegastrike-0.5.0" directories--the one in the data directory has playlists that come with the game, and the one in the home directory has everything else. For future releases we can try to get rid of the one in data since it is mostly redundant I think.

So I'm wondering if you have changed anything. How had you gotten it to recognize the data directory?

It should be looking in Version.txt to determine the name of the home folder...I'm worried if it doesn't find that, it might default to blank or something.

If nothing changed in the code and you don't know why it's trying to write to the wrong place, would it be possible to strace (or ptrace) the setup program, and send the stderr to a file with 2> strace.log

There's a chance that doing this could allow me to see if there's anything in the data or home directory code that's acting weird on FreeBSD or soemthing of the sort.
AMDmi3
Explorer
Explorer
Posts: 14
Joined: Mon May 05, 2008 5:30 pm

Post by AMDmi3 »

safemode wrote:make sure your vegastrike.config is unchanged from svn.
I'm using source tarballs. .vegastrike-0.5.0 comes from there unchanged, yes.
ace123 wrote:So I'm wondering if you have changed anything. How had you gotten it to recognize the data directory?
Via passing --datadir to configure
ace123 wrote:It should be looking in Version.txt to determine the name of the home folder...I'm worried if it doesn't find that, it might default to blank or something.
Seems like there's no problem with this - it says `Found data in /usr/local/share/vegastrike' and [ks]trace shows Version.txt is opened successfully.
ace123 wrote:If nothing changed in the code and you don't know why it's trying to write to the wrong place, would it be possible to strace (or ptrace) the setup program, and send the stderr to a file with 2> strace.log
Please see amdmi3.ru/vegastrike, there are both strace and ktrace (FreeBSD specific tool afaik, somewhat more informative judging from log size) logs.

Some search led me to this (setup/src/include/file.cpp:294):

Code: Select all

// tmp1="/usr/local/share/vegastrike/vegastrike.config"
if ((wp = fopen(tmp1.c_str(), "w")) == NULL) {
    // wp = NULL,
    // but this is not displayed... maybe because buffers don't get flushed?
    fprintf (stderr, "Unable to write  to %s\n", CONFIG.config_file );
}
while ((p = fgets(line, MAX_READ, rp)) != NULL) {
    // wp = 0 -> segfault
    fprintf(wp, line);
}
So it tries to save into systemwide config instead of the local one.

PS. Btw, vegastrike itself runs normally, creates ~/.vegastrike-0.5.0 and populates it with some files.
ace123
Lead Network Developer
Lead Network Developer
Posts: 2560
Joined: Sun Jan 12, 2003 9:13 am
Location: Palo Alto CA
Contact:

Post by ace123 »

You're right--The code is completely broken--I don't know what I was thinking when I added the mkdir.
Go to setup.cpp, line 208, and move that "chdir" line to be after the call to "mkdir"... that way the directory is guaranteed to exist.

Now I'm just confused why nobody has complained about this after the release?
I suppose it's because it's such an obscure bug--only happens the first time you run "vssetup", and only if you hadn't run "vegastrike" beforehand.
AMDmi3
Explorer
Explorer
Posts: 14
Joined: Mon May 05, 2008 5:30 pm

Post by AMDmi3 »

ace123 wrote:You're right--The code is completely broken--I don't know what I was thinking when I added the mkdir.
Go to setup.cpp, line 208, and move that "chdir" line to be after the call to "mkdir"... that way the directory is guaranteed to exist.
Doesn't help. I've tried setup.cpp from SVN.
ace123 wrote: Now I'm just confused why nobody has complained about this after the release?
I suppose most people use VS inplace after unpacking the tarball/checking out SVN.
ace123
Lead Network Developer
Lead Network Developer
Posts: 2560
Joined: Sun Jan 12, 2003 9:13 am
Location: Palo Alto CA
Contact:

Post by ace123 »

I was only fixing the problem where it doesn't make the ".vegastrike-0.5.0" directory the first time you run it.

Are you sure that you have at least revision 12203 that was backported to the 0.5.0 tag on April 26? you can also update to latest SVN which now includes the mkdir change I was talking about.

In the latest SVN, vegastrike/setup/src/include/file.cpp has on line 304:

Code: Select all

	string tmp1 = CONFIG.config_file;
/*
	if(origconfig) {
		tmp1 = mangle_config (CONFIG.config_file);
	}
*/
	if ((wp = fopen(tmp1.c_str(), "w")) == NULL) {
		tmp1 = mangle_config (CONFIG.config_file);
		if ((wp = fopen(tmp1.c_str(), "w")) == NULL) {
			tmp1 = CONFIG.config_file;
			if ((wp = fopen(tmp1.c_str(), "w")) == NULL) {
				fprintf (stderr, "Unable to write  to %s\n", CONFIG.config_file );
				exit(1);
			}
		}
	}
	while ((p = fgets(line, MAX_READ, rp)) != NULL) {
		fprintf(wp, line);
	}
CONFIG.config_file should be within your home directory, and only if it fails it will try the one in the game directory... Only if that fails will it call "exit(1)".

The code segment you pasted looks like old vssetup code. [I'm pretty sure the source tarball included this change as well since that was only two days after the initial release...]

If you're still having the crash, would it be possible to compile vssetup with debug symbols so I know what line on Modconfig() was causing the crash? [I don't think it's possible for wp to be NULL at that point since it calls exit(1) before that]
AMDmi3
Explorer
Explorer
Posts: 14
Joined: Mon May 05, 2008 5:30 pm

Post by AMDmi3 »

Oops, sorry. I thought the tarball had latest revision of file.cpp. After updating to _really_ latest revision everything works finally - no crashes, both dotdir and config are created.

So the mission is now complete, I've just submitted the ports, they should be added into the tree in a week or so. I'll notify you then.

Thanks for your help, thanks for a great game and keep up the good work :)
AMDmi3
Explorer
Explorer
Posts: 14
Joined: Mon May 05, 2008 5:30 pm

Post by AMDmi3 »

Vega strike is now in FreeBSD ports. You can count FreeBSD as supported platform :)

http://www.freshports.org/games/vegastrike/
http://www.freshports.org/games/vegastrike-data/
loki1950
The Shepherd
Posts: 5841
Joined: Fri May 13, 2005 8:37 pm
Location: Ottawa
Contact:

Post by loki1950 »

Great news :D :D might add that to my announcement at the LXF forum :wink:

Enjoy the Choice :)
my box::HP Envy i5-6400 @2Q70GHzx4 8 Gb ram/1 Tb(Win10 64)/3 Tb Mint 19.2/GTX745 4Gb acer S243HL K222HQL
Q8200/Asus P5QDLX/8 Gb ram/WD 2Tb 2-500 G HD/GF GT640 2Gb Mint 17.3 64 bit Win 10 32 bit acer and Lenovo ideapad 320-15ARB Win 10/Mint 19.2
ace123
Lead Network Developer
Lead Network Developer
Posts: 2560
Joined: Sun Jan 12, 2003 9:13 am
Location: Palo Alto CA
Contact:

Post by ace123 »

Cool, I added links to them on the download page.
Post Reply