Opened 7 years ago

Closed 7 years ago

Last modified 6 years ago

#1463 closed defect (fixed)

Add support for OpenBSD

Reported by: Anthony J. Bentley Owned by: leper
Priority: Nice to Have Milestone: Alpha 11
Component: Build & Packages Keywords:
Cc: Patch:

Description (last modified by leper)

Make these libraries compile on OpenBSD and fix all remaining issues.

FCollada r11936
nvtt r11962 upstream bug report
SpiderMonkey r11942

Attachments (5)

0ad-openbsd-build.txt (36.5 KB) - added by Anthony J. Bentley 7 years ago.
Full build log
openbsd-fcollada.diff (6.0 KB) - added by Anthony J. Bentley 7 years ago.
Patch that adds OpenBSD to #ifdefs.
more_openbsd_compat.diff (14.5 KB) - added by leper 7 years ago.
openbsd.diff (19.4 KB) - added by leper 7 years ago.
premake_backport.diff (16.1 KB) - added by leper 7 years ago.

Download all attachments as: .zip

Change History (27)

Changed 7 years ago by Anthony J. Bentley

Attachment: 0ad-openbsd-build.txt added

Full build log

comment:1 Changed 7 years ago by Anthony J. Bentley

I should probably add that this is on amd64.

comment:2 Changed 7 years ago by Ben Brian

You probably need to search for __FreeBSD__ in all the FCollada source files and add a check for __OpenBSD__ as well. I don't know if that will fix this particular error but it's likely required for a successful build.

Last edited 7 years ago by Ben Brian (previous) (diff)

comment:3 Changed 7 years ago by Anthony J. Bentley

You're right, it doesn't fix this particular error, but I'll attach the patch anyway. Initial problem is still present.

Changed 7 years ago by Anthony J. Bentley

Attachment: openbsd-fcollada.diff added

Patch that adds OpenBSD to #ifdefs.

comment:4 Changed 7 years ago by Ben Brian

In FCollada/FUtils/FUStringBuilder.h, change line 138 to:

#elif defined(__APPLE__) || defined(__OpenBSD__)

which makes sense if it works, since OS X builds on BSD in many respects (not sure why this fix isn't required on FreeBSD as well...)

comment:5 Changed 7 years ago by Anthony J. Bentley

That fix (combined with the patch I attached above) allows FCollada to build on OpenBSD. Thanks.

comment:6 Changed 7 years ago by Ben Brian

Good to hear :) How does the rest of the build go? If that's all we need, I'll commit the fixes.

comment:7 Changed 7 years ago by Kieran P

Keywords: patch review added
Milestone: BacklogAlpha 11
Priority: Should HaveNice to Have
Summary: error: call of overloaded 'append(const long unsigned int&)' is ambiguous[PATCH] error: call of overloaded 'append(const long unsigned int&)' is ambiguous

comment:8 Changed 7 years ago by Anthony J. Bentley

Spidermonkey won't configure unless I pass --disable-tracejit to it. When that's done, the build fails here:

c++ -o jsnativestack.o -c  -I./dist/system_wrappers_js -include ../config/gcc_hidden.h -DOSTYPE=\"OpenBSD5\" -DOSARCH=OpenBSD -DEXPORT_JS_API -D__STDC_LIMIT_MACROS  -I.. -I. -I./dist/include -I./dist/include/nsprpub     -I.. -I../assembler -I../yarr  -fPIC  -fno-rtti -fno-exceptions -Wall -Wpointer-arith -Woverloaded-virtual -Wsynth -Wno-ctor-dtor-privacy -Wno-non-virtual-dtor -Wcast-align -Wno-invalid-offsetof -Wno-variadic-macros -Werror=return-type -pedantic -Wno-long-long -fno-strict-aliasing -pthread -pipe  -DDEBUG -D_DEBUG -DTRACING -g -DUSE_SYSTEM_MALLOC=1 -DENABLE_ASSEMBLER=1 -DENABLE_JIT=1   -DMOZILLA_CLIENT -include ./js-confdefs.h -MD -MF .deps/jsnativestack.pp ../jsnativestack.cpp
../jsnativestack.cpp: In function 'void* js::GetNativeStackBaseImpl()':
../jsnativestack.cpp:207: error: 'pthread_getattr_np' was not declared in this scope
gmake[1]: *** [jsnativestack.o] Error 1
gmake[1]: *** Waiting for unfinished jobs....
gmake[1]: Leaving directory

I currently tell 0ad to use the system spidermonkey (1.9.2.16). No doubt this will cause errors later on down the line.

nvtt doesn't build either. I opened a bug upstream: https://code.google.com/p/nvidia-texture-tools/issues/detail?id=176

comment:9 Changed 7 years ago by leper

In 11936:

Make FCollada compile on OpenBSD, based on patch by anthonyjbentley. Refs #1463.

comment:10 Changed 7 years ago by leper

Description: modified (diff)
Keywords: patch review removed
Summary: [PATCH] error: call of overloaded 'append(const long unsigned int&)' is ambiguousAdd support for OpenBSD

Thanks for the patch. I modified the ticket to add support for OpenBSD. I'll probably give the remaining issues a try in the next days, but if you have some other patches just add them here.

comment:11 Changed 7 years ago by leper

The SpiderMonkey build failure is fixed upstream (so we just need to add a patch to our version).

The nano-jit one is probably https://bugzilla.mozilla.org/show_bug.cgi?id=633857

Last edited 7 years ago by leper (previous) (diff)

comment:12 Changed 7 years ago by leper

In 11942:

Fix SpiderMonkey build on OpenBSD. Refs #1463.

comment:13 Changed 7 years ago by leper

Description: modified (diff)

Changed 7 years ago by leper

Attachment: more_openbsd_compat.diff added

comment:14 Changed 7 years ago by leper

The attached work in progress patch makes nvtt build (based on anthonyjbentley's patch) and disables asynchronous IO (as OpenBSD doesn't provide the POSIX.1b aio.h header. Some of the changes to premake aren't cleaned up and I won't commit them in this state, but I added the patch so you can test some more.

What should be changed is the linking of rt on BSD systems (as at least on OpenBSD this isn't needed). I'm currently having a linking problem due to some undefined symbols in a vorbis lib.

comment:15 in reply to:  14 ; Changed 7 years ago by Ben Brian

Replying to leper:

What should be changed is the linking of rt on BSD systems (as at least on OpenBSD this isn't needed).

I didn't notice a problem there on FreeBSD. The only remaining build problems I know of on FreeBSD are missing ecvt() in FCollada and build/gmake.unix/Premake4.make linking dl which causes an error - but apparently that's needed on GNU/kFreeBSD. It seems every BSD requires a slightly different build config, which is inconvenient and Premake currently makes no distinction between them :(

comment:16 in reply to:  15 Changed 7 years ago by leper

It's running: http://ompldr.org/vZTZzYw (I assume the textures are still loading and that may take some time and also it is using the mesa software renderer and a VM isn't the best possible environment for a 3D game ;-) )

Replying to historic_bruno:

It seems every BSD requires a slightly different build config, which is inconvenient and Premake currently makes no distinction between them :(

I added some os type detection to premake so that we can differentiate between the various BSD versions. I also added detection of BSD systems to update-workspaces.sh to not link with dl (except GNU/kFreeBSD).

Executing pyrogenesis still needs some manual intervention to preload libogg and libvorbis as otherwise we get undefined symbol errors.

I still need to clean up my changes but I'll add a working patch in the next days.

comment:17 Changed 7 years ago by leper

In 11962:

Fix NVTT build on OpenBSD based on patch by anthonyjbentley. Refs #1463.

Changed 7 years ago by leper

Attachment: openbsd.diff added

Changed 7 years ago by leper

Attachment: premake_backport.diff added

comment:18 Changed 7 years ago by leper

premake_backport.diff includes premake4.4's os.getversion() and extends that to work on POSIX-compilant systems. I'll probably adjust the other patch to work with this and commit this soon.

comment:19 Changed 7 years ago by leper

Owner: set to leper
Resolution: fixed
Status: newclosed

In 11970:

Add support for OpenBSD. Fixes #1463.
Backport os_getversion from premake4.4-beta4 and extend it to support POSIX-compilant systems.
Add some missing newlines at the end of file as these cause warnings on OpenBSD.
Update the config paths.

comment:20 Changed 7 years ago by leper

Description: modified (diff)

Some remaining issues (though I don't think they are big enough to keep this ticket open): OpenBSDs packaged libxml is built without threading support and atlas depends on that, so you should run update-workspaces.sh with --disable-atlas .
You probably need to run pyrogenesis with LD_PRELOAD=/usr/local/lib/libogg.so.6.2:/usr/local/lib/libvorbis.so.8.0 as those aren't linked (see the TODO in extern_libs4.lua)
Also you need to symlink libmozjs185-ps-release.so.1.0 to libmozjs185-ps-release.so.1.0.1.0 (I'd really like to know why...)

Apart from that it should work (though I've only tested it in a VM). There is one test failure that is already covered by #1142.

comment:21 Changed 6 years ago by Anthony J. Bentley

Thanks for the work you've put into this. The game does build and run, though textures take several minutes to load even on real hardware.

I'll see what I can do about getting this packaged, and also enabling threads in libxml.

comment:22 Changed 6 years ago by leper

I added OpenBSD to our BuildInstructions. If I missed a dependency just add it there.

Note: See TracTickets for help on using tickets.