Author Topic: OpenBSD port  (Read 15583 times)

0 Members and 1 Guest are viewing this topic.

I managed to compile fs2_open on OpenBSD 5.5 AMD64. It works nicely.
Only two problems were encountered while compiling and those are:
1) Missing OpenBSD entry in the configure script (it was treated as an unknown OS).
2) Missing lua.pc (in OpenBSD it's named "luaversionnumber.pc", "lua51.pc" in this case).

Step by step tutorial:
Install all the necessary dependencies (all of which are available in the package repository).
Download the source code tarball (e. g. 3.7.2 RC4).
Replace AUTOMAKE_VERSION, AUTOCONF_VERSION and lua**.pc with the ones you have installed on your system.
Code: [Select]
cd /home/user/Downloads
tar xzvf fs2_open_3_7_2_RC4_src.tgz
cd fs2_open_3_7_2_RC4
export AUTOMAKE_VERSION=1.9  AUTOCONF_VERSION=2.69
su
cp /usr/local/lib/pkgconfig/lua51.pc /usr/local/lib/pkgconfig/lua.pc
exit
vi configure.ac

Find the line saying:
Code: [Select]
case "$target" in and add this after the FreeBSD entry:

Code: [Select]
*openbsd*)
# openbsd
echo "OPENBSD $host_cpu-$host_os"
fs2_os_bsd="yes"
if test "$host_cpu" = "amd64"
then
D_CFLAGS="$D_CFLAGS -m64 -march=athlon64 -ansi"
fi
D_CFLAGS="$D_CFLAGS -DLUA_USE_LINUX"
LDFLAGS="$LDFLAGS -L/usr/local/lib"
CPPFLAGS="$CPPFLAGS -I/usr/local/include"
;;

Then just compile as usual:
Code: [Select]
./autogen.sh
su
make install
exit

Play the game!
Code: [Select]
cp /usr/local/bin/fs2_open_3.7.2_RC4 /home/user/freespace2
cd /home/user/freespace2
su
chmod 0666 /dev/drm*
exit
chmod +x fs2_open_3.7.2_RC4
./fs2_open_3.7.2_RC4
Add command line options to your liking:
http://www.hard-light.net/wiki/index.php/Command-Line_Reference

The chmod 0666 part is essential if you don't want your game started in software mode (it's slow!).
You can download the port from here:
https://github.com/subliminalshadow/openbsd/tree/master/ports/games
« Last Edit: January 13, 2015, 11:51:33 am by subliminal »

 

Offline chief1983

  • Still lacks a custom title
  • Moderator
  • 212
  • ⬇️⬆️⬅️⬅️🅰➡️⬇️
    • Minecraft
    • Skype
    • Steam
    • Twitter
    • Fate of the Galaxy
Interesting, I was contemplating adding another nightly build arch to experiment with Vagrant.  Maybe I'll make it an OpenBSD one.
Fate of the Galaxy - Now Hiring!  Apply within | Diaspora | SCP Home | Collada Importer for PCS2
Karajorma's 'How to report bugs' | Mantis
#freespace | #scp-swc | #diaspora | #SCP | #hard-light on EsperNet

"You may not sell or otherwise commercially exploit the source or things you created based on the source." -- Excerpt from FSO license, for reference

Nuclear1:  Jesus Christ zack you're a little too hamyurger for HLP right now...
iamzack:  i dont have hamynerge i just want ptatoc hips D:
redsniper:  Platonic hips?!
iamzack:  lays

 
wxLauncher compiles as well. Just follow the readme, be sure you have all the dependencies installed and add:
Code: [Select]
-DPYTHON_EXECUTABLE=/usr/local/bin/python2.7 (else it will complain of missing markdown).

Like this:
Code: [Select]
cmake -DPYTHON_EXECUTABLE=/usr/local/bin/python2.7 -DUSE_OPENAL=1 -DCMAKE_INSTALL_PREFIX=/usr/local ../Copy the resulting binary to your freespace2 directory and have fun.

 
I made the ports for fs2_open and wxlauncher. You just need to download the archives and untar into /usr/ports/games. Then, cd to each directory and run
Code: [Select]
make install Finally, you can run both the fs2_open binary and wxlauncher from your freespace2 data directory.

https://github.com/subliminalshadow/openbsd/tree/master/ports/games

NOTE: These are the first OpenBSD ports I made, so, feel free to report any bugs and mistakes considering the Makefiles.
UPDATE: 3.7.2 RC4 suffers from segmentation fault when beams are fired
UPDATE2: -no_3d_sound fixes the crash for 3.7.2 RC4
UPDATE3: recent revisions work perfectly
« Last Edit: January 13, 2015, 11:53:42 am by subliminal »

 

Offline chief1983

  • Still lacks a custom title
  • Moderator
  • 212
  • ⬇️⬆️⬅️⬅️🅰➡️⬇️
    • Minecraft
    • Skype
    • Steam
    • Twitter
    • Fate of the Galaxy
I still need to fire up an OpenBSD VM to try this out for myself.
Fate of the Galaxy - Now Hiring!  Apply within | Diaspora | SCP Home | Collada Importer for PCS2
Karajorma's 'How to report bugs' | Mantis
#freespace | #scp-swc | #diaspora | #SCP | #hard-light on EsperNet

"You may not sell or otherwise commercially exploit the source or things you created based on the source." -- Excerpt from FSO license, for reference

Nuclear1:  Jesus Christ zack you're a little too hamyurger for HLP right now...
iamzack:  i dont have hamynerge i just want ptatoc hips D:
redsniper:  Platonic hips?!
iamzack:  lays

 
 

Offline chief1983

  • Still lacks a custom title
  • Moderator
  • 212
  • ⬇️⬆️⬅️⬅️🅰➡️⬇️
    • Minecraft
    • Skype
    • Steam
    • Twitter
    • Fate of the Galaxy
I missed this update about beam crashes, I wonder if that's related to mantis 3130.  Would be crazy to find out it does hit other systems besides windows.  Did you test on nvidia by any chance?
Fate of the Galaxy - Now Hiring!  Apply within | Diaspora | SCP Home | Collada Importer for PCS2
Karajorma's 'How to report bugs' | Mantis
#freespace | #scp-swc | #diaspora | #SCP | #hard-light on EsperNet

"You may not sell or otherwise commercially exploit the source or things you created based on the source." -- Excerpt from FSO license, for reference

Nuclear1:  Jesus Christ zack you're a little too hamyurger for HLP right now...
iamzack:  i dont have hamynerge i just want ptatoc hips D:
redsniper:  Platonic hips?!
iamzack:  lays

 
OpenBSD doesn't support nouveau (open source nvidia driver) yet. I tested 3.7.2 RC4 on Intel GMA X3100.

 

Offline chief1983

  • Still lacks a custom title
  • Moderator
  • 212
  • ⬇️⬆️⬅️⬅️🅰➡️⬇️
    • Minecraft
    • Skype
    • Steam
    • Twitter
    • Fate of the Galaxy
Interesting, might get a message later about that.  In the meantime, you might want to watch/comment on #3130 and help us identify if it's the same crash or something different.
Fate of the Galaxy - Now Hiring!  Apply within | Diaspora | SCP Home | Collada Importer for PCS2
Karajorma's 'How to report bugs' | Mantis
#freespace | #scp-swc | #diaspora | #SCP | #hard-light on EsperNet

"You may not sell or otherwise commercially exploit the source or things you created based on the source." -- Excerpt from FSO license, for reference

Nuclear1:  Jesus Christ zack you're a little too hamyurger for HLP right now...
iamzack:  i dont have hamynerge i just want ptatoc hips D:
redsniper:  Platonic hips?!
iamzack:  lays

 

Offline AdmiralRalwood

  • 211
  • The Cthulhu programmer himself!
    • Skype
    • Steam
    • Twitter
I missed this update about beam crashes, I wonder if that's related to mantis 3130.  Would be crazy to find out it does hit other systems besides windows.  Did you test on nvidia by any chance?
It can't be the same problem as 3130; not because it's not crashing in the Windows nVidia drivers, but because 3130 doesn't go away if one goes back to 3.7.0. It could be a similar problem related to whatever is triggering 3130 in the first place, though.
Ph'nglui mglw'nafh Codethulhu GitHub wgah'nagl fhtagn.

schrödinbug (noun) - a bug that manifests itself in running software after a programmer notices that the code should never have worked in the first place.

When you gaze long into BMPMAN, BMPMAN also gazes into you.

"I am one of the best FREDders on Earth" -General Battuta

<Aesaar> literary criticism is vladimir putin

<MageKing17> "There's probably a reason the code is the way it is" is a very dangerous line of thought. :P
<MageKing17> Because the "reason" often turns out to be "nobody noticed it was wrong".
(the very next day)
<MageKing17> this ****ing code did it to me again
<MageKing17> "That doesn't really make sense to me, but I'll assume it was being done for a reason."
<MageKing17> **** ME
<MageKing17> THE REASON IS PEOPLE ARE STUPID
<MageKing17> ESPECIALLY ME

<MageKing17> God damn, I do not understand how this is breaking.
<MageKing17> Everything points to "this should work fine", and yet it's clearly not working.
<MjnMixael> 2 hours later... "God damn, how did this ever work at all?!"
(...)
<MageKing17> so
<MageKing17> more than two hours
<MageKing17> but once again we have reached the inevitable conclusion
<MageKing17> How did this code ever work in the first place!?

<@The_E> Welcome to OpenGL, where standards compliance is optional, and error reporting inconsistent

<MageKing17> It was all working perfectly until I actually tried it on an actual mission.

<IronWorks> I am useful for FSO stuff again. This is a red-letter day!
* z64555 erases "Thursday" and rewrites it in red ink

<MageKing17> TIL the entire homing code is held up by shoestrings and duct tape, basically.

 

Offline chief1983

  • Still lacks a custom title
  • Moderator
  • 212
  • ⬇️⬆️⬅️⬅️🅰➡️⬇️
    • Minecraft
    • Skype
    • Steam
    • Twitter
    • Fate of the Galaxy
True.  Still, since this bug at least seems revision dependent, doing a divide-and-conquer throughout different revisions to identify the change that is causing the OpenBSD crash would be very helpful.  It could shed light on other issues with the beam firing code to know what's causing this one, but that's likely a long shot.
Fate of the Galaxy - Now Hiring!  Apply within | Diaspora | SCP Home | Collada Importer for PCS2
Karajorma's 'How to report bugs' | Mantis
#freespace | #scp-swc | #diaspora | #SCP | #hard-light on EsperNet

"You may not sell or otherwise commercially exploit the source or things you created based on the source." -- Excerpt from FSO license, for reference

Nuclear1:  Jesus Christ zack you're a little too hamyurger for HLP right now...
iamzack:  i dont have hamynerge i just want ptatoc hips D:
redsniper:  Platonic hips?!
iamzack:  lays

 
The last fully working revision on OpenBSD is r10797.

 

Offline AdmiralRalwood

  • 211
  • The Cthulhu programmer himself!
    • Skype
    • Steam
    • Twitter
Almost certainly not the same problem, then; r10798 is sound-related (and my patch :().
Ph'nglui mglw'nafh Codethulhu GitHub wgah'nagl fhtagn.

schrödinbug (noun) - a bug that manifests itself in running software after a programmer notices that the code should never have worked in the first place.

When you gaze long into BMPMAN, BMPMAN also gazes into you.

"I am one of the best FREDders on Earth" -General Battuta

<Aesaar> literary criticism is vladimir putin

<MageKing17> "There's probably a reason the code is the way it is" is a very dangerous line of thought. :P
<MageKing17> Because the "reason" often turns out to be "nobody noticed it was wrong".
(the very next day)
<MageKing17> this ****ing code did it to me again
<MageKing17> "That doesn't really make sense to me, but I'll assume it was being done for a reason."
<MageKing17> **** ME
<MageKing17> THE REASON IS PEOPLE ARE STUPID
<MageKing17> ESPECIALLY ME

<MageKing17> God damn, I do not understand how this is breaking.
<MageKing17> Everything points to "this should work fine", and yet it's clearly not working.
<MjnMixael> 2 hours later... "God damn, how did this ever work at all?!"
(...)
<MageKing17> so
<MageKing17> more than two hours
<MageKing17> but once again we have reached the inevitable conclusion
<MageKing17> How did this code ever work in the first place!?

<@The_E> Welcome to OpenGL, where standards compliance is optional, and error reporting inconsistent

<MageKing17> It was all working perfectly until I actually tried it on an actual mission.

<IronWorks> I am useful for FSO stuff again. This is a red-letter day!
* z64555 erases "Thursday" and rewrites it in red ink

<MageKing17> TIL the entire homing code is held up by shoestrings and duct tape, basically.

 

Offline chief1983

  • Still lacks a custom title
  • Moderator
  • 212
  • ⬇️⬆️⬅️⬅️🅰➡️⬇️
    • Minecraft
    • Skype
    • Steam
    • Twitter
    • Fate of the Galaxy
Just out of curiosity, what version of OpenAL( Soft) is on your system, and can you see if -no_3d_sound prevents the crash with newer revisions?
Fate of the Galaxy - Now Hiring!  Apply within | Diaspora | SCP Home | Collada Importer for PCS2
Karajorma's 'How to report bugs' | Mantis
#freespace | #scp-swc | #diaspora | #SCP | #hard-light on EsperNet

"You may not sell or otherwise commercially exploit the source or things you created based on the source." -- Excerpt from FSO license, for reference

Nuclear1:  Jesus Christ zack you're a little too hamyurger for HLP right now...
iamzack:  i dont have hamynerge i just want ptatoc hips D:
redsniper:  Platonic hips?!
iamzack:  lays

 

Offline AdmiralRalwood

  • 211
  • The Cthulhu programmer himself!
    • Skype
    • Steam
    • Twitter
Additionally, can you compile a debug build (of r10802 or later) and see if you trip any assertions when a beam fires?
Ph'nglui mglw'nafh Codethulhu GitHub wgah'nagl fhtagn.

schrödinbug (noun) - a bug that manifests itself in running software after a programmer notices that the code should never have worked in the first place.

When you gaze long into BMPMAN, BMPMAN also gazes into you.

"I am one of the best FREDders on Earth" -General Battuta

<Aesaar> literary criticism is vladimir putin

<MageKing17> "There's probably a reason the code is the way it is" is a very dangerous line of thought. :P
<MageKing17> Because the "reason" often turns out to be "nobody noticed it was wrong".
(the very next day)
<MageKing17> this ****ing code did it to me again
<MageKing17> "That doesn't really make sense to me, but I'll assume it was being done for a reason."
<MageKing17> **** ME
<MageKing17> THE REASON IS PEOPLE ARE STUPID
<MageKing17> ESPECIALLY ME

<MageKing17> God damn, I do not understand how this is breaking.
<MageKing17> Everything points to "this should work fine", and yet it's clearly not working.
<MjnMixael> 2 hours later... "God damn, how did this ever work at all?!"
(...)
<MageKing17> so
<MageKing17> more than two hours
<MageKing17> but once again we have reached the inevitable conclusion
<MageKing17> How did this code ever work in the first place!?

<@The_E> Welcome to OpenGL, where standards compliance is optional, and error reporting inconsistent

<MageKing17> It was all working perfectly until I actually tried it on an actual mission.

<IronWorks> I am useful for FSO stuff again. This is a red-letter day!
* z64555 erases "Thursday" and rewrites it in red ink

<MageKing17> TIL the entire homing code is held up by shoestrings and duct tape, basically.

 
Just out of curiosity, what version of OpenAL( Soft) is on your system, and can you see if -no_3d_sound prevents the crash with newer revisions?
It indeed does prevent the crash. Now all revisions work! I have OpenAL Soft version 1.15.1 installed.
The original crash happened during Psamtik beam fire in Surrender, Belisarius! mission, so that's why I thought it was beam-related. It also happened in custom missions during beam fire, but now it all works.
On a side note, I'm also able to max it out with 2014 MediaVPs and get mostly lag-free gameplay on Intel GMA X3100 using 1280x800 as my resolution.
« Last Edit: January 05, 2015, 04:07:25 pm by subliminal »

 

Offline chief1983

  • Still lacks a custom title
  • Moderator
  • 212
  • ⬇️⬆️⬅️⬅️🅰➡️⬇️
    • Minecraft
    • Skype
    • Steam
    • Twitter
    • Fate of the Galaxy
Just checking, because the commit that broke for you had most of the changes only affect when 3d sound is enabled.  We can probably figure out a fix for it so you don't have to force that off though.
Fate of the Galaxy - Now Hiring!  Apply within | Diaspora | SCP Home | Collada Importer for PCS2
Karajorma's 'How to report bugs' | Mantis
#freespace | #scp-swc | #diaspora | #SCP | #hard-light on EsperNet

"You may not sell or otherwise commercially exploit the source or things you created based on the source." -- Excerpt from FSO license, for reference

Nuclear1:  Jesus Christ zack you're a little too hamyurger for HLP right now...
iamzack:  i dont have hamynerge i just want ptatoc hips D:
redsniper:  Platonic hips?!
iamzack:  lays

 

Offline AdmiralRalwood

  • 211
  • The Cthulhu programmer himself!
    • Skype
    • Steam
    • Twitter
You might also want to try a newer version of OpenAL Soft (pretty sure 1.16 is still the latest); I still want to know if a debug build triggers an Assertion with 3D sound on.
Ph'nglui mglw'nafh Codethulhu GitHub wgah'nagl fhtagn.

schrödinbug (noun) - a bug that manifests itself in running software after a programmer notices that the code should never have worked in the first place.

When you gaze long into BMPMAN, BMPMAN also gazes into you.

"I am one of the best FREDders on Earth" -General Battuta

<Aesaar> literary criticism is vladimir putin

<MageKing17> "There's probably a reason the code is the way it is" is a very dangerous line of thought. :P
<MageKing17> Because the "reason" often turns out to be "nobody noticed it was wrong".
(the very next day)
<MageKing17> this ****ing code did it to me again
<MageKing17> "That doesn't really make sense to me, but I'll assume it was being done for a reason."
<MageKing17> **** ME
<MageKing17> THE REASON IS PEOPLE ARE STUPID
<MageKing17> ESPECIALLY ME

<MageKing17> God damn, I do not understand how this is breaking.
<MageKing17> Everything points to "this should work fine", and yet it's clearly not working.
<MjnMixael> 2 hours later... "God damn, how did this ever work at all?!"
(...)
<MageKing17> so
<MageKing17> more than two hours
<MageKing17> but once again we have reached the inevitable conclusion
<MageKing17> How did this code ever work in the first place!?

<@The_E> Welcome to OpenGL, where standards compliance is optional, and error reporting inconsistent

<MageKing17> It was all working perfectly until I actually tried it on an actual mission.

<IronWorks> I am useful for FSO stuff again. This is a red-letter day!
* z64555 erases "Thursday" and rewrites it in red ink

<MageKing17> TIL the entire homing code is held up by shoestrings and duct tape, basically.

 
Building a debug build results in this:
Code: [Select]
windows_stub/stubs.cpp:47:23: error: malloc_np.h: No such file or directory
windows_stub/stubs.cpp: In function 'void* _vm_malloc(int, char*, int, int)':
windows_stub/stubs.cpp:586: error: 'malloc_usable_size' was not declared in this scope
windows_stub/stubs.cpp: In function 'void* _vm_realloc(void*, int, char*, int, int)':
windows_stub/stubs.cpp:608: error: 'malloc_usable_size' was not declared in this scope
windows_stub/stubs.cpp: In function 'void _vm_free(void*, char*, int)':
windows_stub/stubs.cpp:690: error: 'malloc_usable_size' was not declared in this scope
*** Error 1 in code (Makefile:5907 'stubs.o')

 
I was able to reproduce this issue on one of my systems; with retail data, it segfaults in Surrender, Belisarius! as soon as Psamtik fires a beam (after the charge effect is all done, but before the beam itself renders). Unfortunately, I was also able to reproduce the build failure with debug builds.  I did, however, build a release build after making this change to configure.ac (forcing release builds to be built with debug compiler flags):

Code: [Select]
diff --git a/configure.ac b/configure.ac
index 85de273..4a0f911 100644
--- a/configure.ac
+++ b/configure.ac
@@ -230,8 +230,8 @@ if test "$fs2_debug" = "yes" ; then
        fi
 else
        AC_DEFINE([NDEBUG])
-       D_CFLAGS="$D_CFLAGS -O2 -Wall -Wno-write-strings -funroll-loops"
-       D_LDFLAGS="$D_LDFLAGS "
+       D_CFLAGS="$D_CFLAGS -O0 -g -Wall -Wextra -Wno-unused-parameter -Wno-write-strings -Wshadow -funroll-loops"
+       D_LDFLAGS="$D_LDFLAGS -g"
 
        if test "$fs2_fred" = "yes" ; then
                AC_SUBST(FS2_BINARY, ["wxFRED2_${PACKAGE_VERSION}"])

and was able to get a good backtrace:
Code: [Select]

Program received signal SIGSEGV, Segmentation fault.
0x000015bd120ae201 in ds3d_update_buffer (channel=773, min=1500, max=3000, pos=0x7f7ffffe6dd4, vel=0x0) at sound/ds3d.cpp:46
46              ALuint source_id = Channels[channel].source_id;
(gdb) bt
#0  0x000015bd120ae201 in ds3d_update_buffer (channel=773, min=1500, max=3000, pos=0x7f7ffffe6dd4, vel=0x0) at sound/ds3d.cpp:46
#1  0x000015bd120b41aa in snd_update_3d_pos (soundnum=773, gs=0x15bfe7f15208, new_pos=0x7f7ffffe6dd4, radius=0, range_factor=1)
    at sound/sound.cpp:723
#2  0x000015bd120de8dc in beam_recalc_sounds (b=0x15bd13727140) at weapon/beam.cpp:1917
#3  0x000015bd120e1745 in beam_move_all_post () at weapon/beam.cpp:1099
#4  0x000015bd11f9245c in obj_move_all (frametime=0.0309906006) at object/object.cpp:1515
#5  0x000015bd11c5174d in game_simulation_frame () at freespace2/freespace.cpp:4094
#6  0x000015bd11c56349 in game_frame (paused=false) at freespace2/freespace.cpp:4487
#7  0x000015bd11c56882 in game_do_frame () at freespace2/freespace.cpp:4903
#8  0x000015bd11c56b69 in game_do_state (state=2) at freespace2/freespace.cpp:6586
#9  0x000015bd11d0d0ea in gameseq_process_events () at gamesequence/gamesequence.cpp:409
#10 0x000015bd11c5332b in game_main (cmdline=0x15bf1d3a20d0 "") at freespace2/freespace.cpp:7153
#11 0x000015bd11c53505 in main (argc=1, argv=0x7f7ffffe71c8) at freespace2/freespace.cpp:7288
(gdb)

This is with r11204 (https://github.com/scp-fs2open/fs2open.github.com/commit/7250cd13a63a22857af7a45bfb8c00038e68b3c2) on OpenBSD/amd64 5.6 (OpenAL Soft version 1.15.1).