Author Topic: OpenBSD port  (Read 15578 times)

0 Members and 1 Guest are viewing this topic.

Offline m!m

  • 211
snd_update_3d_pos uses the sound number as the channel ID. I'm not very familiar with the sound code but other function suggest that ds_get_channel should be used to get the actual channel id that can be passed to ds3d_update_buffer.

 

Offline AdmiralRalwood

  • 211
  • The Cthulhu programmer himself!
    • Skype
    • Steam
    • Twitter
snd_update_3d_pos uses the sound number as the channel ID. I'm not very familiar with the sound code but other function suggest that ds_get_channel should be used to get the actual channel id that can be passed to ds3d_update_buffer.
I'll try to take a look at this soon, but any idea why this is only a problem on OpenBSD?
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
I'm still not entirely convinced it is :P  it could just be that the sound numbers happen to coordinate to channel ids for many windows users, even if it's not the right one, and occasionally it could still be wrong, leading to a crash.  But I'm probably just way too optimistic this actually fixes several reports that we've tied to #3130.
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'm still not entirely convinced it is :P  it could just be that the sound numbers happen to coordinate to channel ids for many windows users, even if it's not the right one, and occasionally it could still be wrong, leading to a crash.  But I'm probably just way too optimistic this actually fixes several reports that we've tied to #3130.
That's the thing, though. If it's not the right channel, it shouldn't have sounded like the beam was panning at all, and instead some unrelated sound would have been panning. I'm just completely baffled that the code worked as it was at all. I just compiled, tested, and committed a fix to make ituse ds_get_channel() as m!m suggested. Could somebody try compiling latest SVN on OpenBSD and make sure 3D sound works with beams?
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
Hopefully by tomorrow so that if it does for sure fix OpenBSD, I can run a full suite of nightlies and see if it helps with anyone's beam crashes at all.  I really am setting myself up for disappointment on this though, but either way I'll be running RC5 shortly after.
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
Hopefully by tomorrow so that if it does for sure fix OpenBSD, I can run a full suite of nightlies and see if it helps with anyone's beam crashes at all.  I really am setting myself up for disappointment on this though, but either way I'll be running RC5 shortly after.
I think we can conclusively say that this has nothing to do with 3130 since 3130 happens with code that predates that revision (and even happens with sound turned off).
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.

 
I confirm it works. It would be nice if you would patch configure.ac, so it compiles out of the box on OpenBSD without applying this patch manually:
Code: [Select]
--- configure.ac.orig Fri Aug 15 23:22:48 2014
+++ configure.ac Thu Nov  6 17:59:28 2014
@@ -169,6 +169,18 @@ case "$target" in
  LDFLAGS="$LDFLAGS -L/usr/local/lib"
  CPPFLAGS="$CPPFLAGS -I/usr/local/include"
  ;;
+ *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"
+ ;;
  *)
  # Unknown
  echo "fs2_open does not support $host_cpu-$host_os"

 

Offline chief1983

  • Still lacks a custom title
  • Moderator
  • 212
  • ⬇️⬆️⬅️⬅️🅰➡️⬇️
    • Minecraft
    • Skype
    • Steam
    • Twitter
    • Fate of the Galaxy
Added OpenBSD to the FreeBSD line to keep it simple.  It could turn out those presets even work for NetBSD, so I'm kind of curious to try it now.  But a fresh svn checkout should work without changes now on OpenBSD, from 11214+.
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

 
There's also DragonFlyBSD, and then you've covered all the BSDs.

 

Offline chief1983

  • Still lacks a custom title
  • Moderator
  • 212
  • ⬇️⬆️⬅️⬅️🅰➡️⬇️
    • Minecraft
    • Skype
    • Steam
    • Twitter
    • Fate of the Galaxy
Apparently Net uses /usr/pkg by default, due to pkgsrc as its default manager.  I don't know about DragonFly yet but could look into it too :P

Have you tested the latest SVN yet?
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

 
Latest SVN works great.

There's one more thing that can be fixed:
Running ./configure wants lua.pc, so this has to be done manually:
Code: [Select]
ln -s /usr/local/lib/pkgconfig/lua51.pc /usr/local/lib/pkgconfig/lua.pc
for fs2_open to compile. Could you make it find and use /usr/local/lib/pkgconfig/lua51.pc instead? (as that's the default on OpenBSD)
Code: [Select]
## Checking for lua.pc and if that fails lua5.1.pc ****and if that fails lua51.pc
**** [PKG_CHECK_MODULES([LUA], [lua51 >= 5.1.3 lua51 < 5.2], [])

 

Offline chief1983

  • Still lacks a custom title
  • Moderator
  • 212
  • ⬇️⬆️⬅️⬅️🅰➡️⬇️
    • Minecraft
    • Skype
    • Steam
    • Twitter
    • Fate of the Galaxy
If I'm right, you can just keep adding fallbacks to the check modules as a 4th argument, so I added another level and cleaned it up a bit so it's still somewhat legible.  Mind trying this out and see if it finds lua without any changes for you?

Code: [Select]
Index: configure.ac
===================================================================
--- configure.ac (revision 11214)
+++ configure.ac (working copy)
@@ -425,9 +425,22 @@
  [LUA],
  [lua >= 5.1.3 lua < 5.2],
  [], ## do nothing special
- [PKG_CHECK_MODULES([LUA], [lua5.1 >= 5.1.3 lua5.1 < 5.2], [], [
-        PKG_CHECK_MODULES([LUA], [lua-5.1 >= 5.1.3 lua-5.1 < 5.2], [])
-    ])])
+ [PKG_CHECK_MODULES(
+ [LUA],
+ [lua5.1 >= 5.1.3 lua5.1 < 5.2],
+ [], ## do nothing special
+ [PKG_CHECK_MODULES(
+ [LUA],
+ [lua-5.1 >= 5.1.3 lua-5.1 < 5.2],
+ [], ## do nothing special
+ [PKG_CHECK_MODULES(
+ [LUA],
+ [lua51 >= 5.1.3 lua51 < 5.2],
+ [], ## do nothing special
+ )]
+ )]
+ )]
+)
 D_CFLAGS=$D_CFLAGS" $LUA_CFLAGS"
 FS2_LIBS=$FS2_LIBS" $LUA_LIBS"
 
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

 
That works.
There's also this one, when building a debug build:
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:3340 'windows_stub/stubs.o')

malloc_np.h and jemalloc are FreeBSD features.
« Last Edit: January 13, 2015, 02:09:09 pm by subliminal »

 

Offline chief1983

  • Still lacks a custom title
  • Moderator
  • 212
  • ⬇️⬆️⬅️⬅️🅰➡️⬇️
    • Minecraft
    • Skype
    • Steam
    • Twitter
    • Fate of the Galaxy
I wonder our Solaris' #define MALLOC_USABLE(pointer) (*((size_t*)(pointer)-1)) would work fine on all the BSDs then (Net doesn't have that function either) instead of #define MALLOC_USABLE(pointer) malloc_usable_size(pointer).  Would actually clean up that section of code a bit instead of making it more complicated with more OS-specific checks.  Or, I could try to use HAVE_MALLOC_NP_H somewhere instead.  I have some ideas, I'll experiment and hopefully come up with something even cleaner than what we have now.  Might need help testing a patch or two.  Or I'll try to find a Vagrant VM for OpenBSD I can fire up quickly.
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 niffiwan

  • 211
  • Eluder Class
Using the block one before the pointer returned by malloc to get the size of the allocated memory is implementation specific, it may not work at all especially given that OpenBSD seems to take a very secure approach to malloc and if I'm reading the net correctly one that's not really based on the other implementations. You could just define it as something that returns zero the entire time, I think the only issue will be that some memory usage tracking will be effectively disabled in debug (but do we really need that anyway?).
Creating a fs2_open.log | Red Alert Bug = Hex Edit | MediaVPs 2014: Bigger HUD gauges | 32bit libs for 64bit Ubuntu
----
Debian Packages (testing/unstable): Freespace2 | wxLauncher
----
m|m: I think I'm suffering from Stockholm syndrome. Bmpman is starting to make sense and it's actually written reasonably well...

 

Offline chief1983

  • Still lacks a custom title
  • Moderator
  • 212
  • ⬇️⬆️⬅️⬅️🅰➡️⬇️
    • Minecraft
    • Skype
    • Steam
    • Twitter
    • Fate of the Galaxy
Yeah I was wondering if we might have to resort to disabling that behavior on all but FreeBSD for now.
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

 
It would be nice if you could implement the option to choose a custom executable path in wxLauncher. Lets say the port installs fs2_open as /usr/local/bin/fs2_open_3.7.1. This would eliminate the need to copy the executable to local data directory (e. g. $HOME/freespace2), as it's possible to run the executable (from /usr/local/bin) while residing in local data directory and it does use data files correctly.

 

Offline chief1983

  • Still lacks a custom title
  • Moderator
  • 212
  • ⬇️⬆️⬅️⬅️🅰➡️⬇️
    • Minecraft
    • Skype
    • Steam
    • Twitter
    • Fate of the Galaxy
It's not the launcher's limitation, it's the engine's.  It doesn't support having the data live anywhere else other than ./ currently, but it is something we'd like to fix in the future.  It would also allow the launchers and mods more flexibility, such as requiring specific versions and having multiple versions of the binary available, and the launcher picking the best one, etc, without having to worry about manually selecting them.  That's just a dream at the moment 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 niffiwan

  • 211
  • Eluder Class
I think it is a launcher limitation  :nervous:

As long as you launch FSO with your current working directory being the game data directory the binary can be anywhere. IIRC the old YAL allowed you to do that but wxlauncher doesn't yet.  Here's the "issue" for this enhancement.
Creating a fs2_open.log | Red Alert Bug = Hex Edit | MediaVPs 2014: Bigger HUD gauges | 32bit libs for 64bit Ubuntu
----
Debian Packages (testing/unstable): Freespace2 | wxLauncher
----
m|m: I think I'm suffering from Stockholm syndrome. Bmpman is starting to make sense and it's actually written reasonably well...

 

Offline m!m

  • 211
I am not sure about Linux but at least on Windows the engine will always change the current directory to the directory of the executable.