MantisBT - Doomseeker
View Issue Details
0003496Doomseeker[All Projects] Documentationpublic2018-09-18 21:002022-08-25 10:22
WubTheCaptain 
 
lowfeatureN/A
confirmedopen 
amd64OpenBSD6.4-current
1.1 
 
0003496: Document instructions to build Doomseeker on OpenBSD
I thought building Doomseeker from source on OpenBSD would be easy after installing qt5 port and whatnot, but nope. There's no documentation specific for OpenBSD in Doomseeker's source distribution, with relevant other frustrations and takes way longer than I'd like to figure out to a mildly professional OpenBSD user like me (or in other words, building Doomseeker is easier on GNU/Linux).

The frustrations include system bzlib.h error, bad Qt5 detection and so on, probably to be solved in other tickets. (Tested with Doomseeker 1.2~beta.)
Quote from pkg_info qt4
People who want to use qt4 to compile applications outside the ports tree
should note that qt4's installation conforms to OpenBSD habits, not
TrollTech's recommendations.
Accordingly:
- libs are separated from includes.
- moc is installed as /usr/local/bin/moc4, in order not to conflict
  with other qt versions.
- uic is installed as /usr/local/bin/uic4

Generally, it's just a question of invoking

env MOC=moc4 UIC=uic4 configure --with-qt-includes=/usr/local/include/X11/qt4
        --with-qt-libraries=/usr/local/lib/qt4

Or to force MOC/UIC in your make/gmake invocation:
make MOC=moc4 UIC=uic4
will override the Makefile contents.

Warning: the qt4 library also appears under /usr/local/lib, but you
*must* make sure your application sees /usr/local/lib/qt4 *first*, because
/usr/local/lib may also contain a later incarnation of Qt, in which case
the linker will pick up the most recent library.


Quote from pkg_info qt5
People who want to use Qt5 to compile applications outside the ports tree
should note that Qt5's installation conforms to OpenBSD habits, not
TrollTech's recommendations. Accordingly:
- libs are separated from includes.
- moc is installed as /usr/local/bin/moc-qt5, in order not to conflict
  with other Qt versions.
- uic is installed as /usr/local/bin/uic-qt5

Generally, it's just a question of invoking:

  env MOC=moc-qt5 UIC=uic-qt5 configure \
        --with-qt-includes=/usr/local/include/X11/qt5 \
        --with-qt-libraries=/usr/local/lib/qt5

... or, to force MOC/UIC in your make/gmake invocation:

  make MOC=moc-qt5 UIC=uic-qt5

will override the Makefile contents.
No tags attached.
related to 0003499assigned Pol M Port Doomseeker to OpenBSD 
patch 0001-COMPILE.txt-Document-OpenBSD-build-instructions.patch (2,684) 2018-10-06 20:08
https://zandronum.com/tracker/file_download.php?file_id=2429&type=bug
patch 0001-COMPILE.txt-Document-OpenBSD-build-instructions.v2.patch (2,743) 2018-10-06 20:42
https://zandronum.com/tracker/file_download.php?file_id=2430&type=bug
patch 0001-COMPILE.txt-Document-OpenBSD-build-instructions.v3.patch (2,847) 2018-10-07 10:03
https://zandronum.com/tracker/file_download.php?file_id=2431&type=bug
patch 0002-CHANGELOG.md-Add-Added-OpenBSD-documentation.patch (861) 2018-10-07 10:33
https://zandronum.com/tracker/file_download.php?file_id=2432&type=bug
Issue History
2018-09-18 21:00WubTheCaptainNew Issue
2018-09-18 21:07WubTheCaptainAdditional Information Updatedbug_revision_view_page.php?rev_id=11815#r11815
2018-09-18 21:07WubTheCaptainAdditional Information Updatedbug_revision_view_page.php?rev_id=11816#r11816
2018-09-18 21:27WubTheCaptainNote Added: 0019547
2018-09-18 21:27WubTheCaptainNote Edited: 0019547bug_revision_view_page.php?rev_id=11818
2018-09-19 11:06WubTheCaptainNote Added: 0019554
2018-09-19 15:25WubTheCaptainNote Deleted: 0019547
2018-09-19 17:36WubTheCaptainRelationship addedchild of 0003499
2018-09-19 17:46WubTheCaptainNote Added: 0019574
2018-09-23 00:55WubTheCaptainNote Added: 0019682
2018-09-23 00:55WubTheCaptainStatusnew => acknowledged
2018-09-24 19:37WubTheCaptainRelationship replacedrelated to 0003499
2018-09-24 20:16WubTheCaptainNote Added: 0019714
2018-09-24 20:17WubTheCaptainNote Edited: 0019714bug_revision_view_page.php?rev_id=11969
2018-09-24 20:17WubTheCaptainNote Deleted: 0019714
2018-10-06 18:56WubTheCaptainAssigned To => WubTheCaptain
2018-10-06 18:56WubTheCaptainStatusacknowledged => assigned
2018-10-06 18:56WubTheCaptainTarget Version => 1.2
2018-10-06 20:08WubTheCaptainFile Added: 0001-COMPILE.txt-Document-OpenBSD-build-instructions.patch
2018-10-06 20:12WubTheCaptainNote Added: 0019963
2018-10-06 20:12WubTheCaptainStatusassigned => needs review
2018-10-06 20:22WubTheCaptainNote Added: 0019964
2018-10-06 20:23WubTheCaptainNote Added: 0019965
2018-10-06 20:25WubTheCaptainNote Added: 0019966
2018-10-06 20:29WubTheCaptainNote Added: 0019967
2018-10-06 20:30WubTheCaptainStatusneeds review => assigned
2018-10-06 20:42WubTheCaptainFile Added: 0001-COMPILE.txt-Document-OpenBSD-build-instructions.v2.patch
2018-10-06 20:43WubTheCaptainNote Added: 0019968
2018-10-06 20:43WubTheCaptainStatusassigned => needs review
2018-10-06 21:00WubTheCaptainNote Added: 0019969
2018-10-06 21:00WubTheCaptainStatusneeds review => assigned
2018-10-07 07:54WubTheCaptainNote Added: 0019978
2018-10-07 08:04WubTheCaptainNote Added: 0019979
2018-10-07 08:26WubTheCaptainNote Added: 0019980
2018-10-07 08:28WubTheCaptainNote Added: 0019981
2018-10-07 08:29WubTheCaptainNote Edited: 0019981bug_revision_view_page.php?bugnote_id=19981#r12162
2018-10-07 09:48WubTheCaptainNote Edited: 0019978bug_revision_view_page.php?bugnote_id=19978#r12169
2018-10-07 09:49WubTheCaptainNote Edited: 0019979bug_revision_view_page.php?bugnote_id=19979#r12171
2018-10-07 10:03WubTheCaptainFile Added: 0001-COMPILE.txt-Document-OpenBSD-build-instructions.v3.patch
2018-10-07 10:03WubTheCaptainStatusassigned => needs review
2018-10-07 10:05WubTheCaptainNote Added: 0019986
2018-10-07 10:24WubTheCaptainNote Added: 0019987
2018-10-07 10:25WubTheCaptainNote Edited: 0019987bug_revision_view_page.php?bugnote_id=19987#r12173
2018-10-07 10:27WubTheCaptainNote Added: 0019988
2018-10-07 10:33WubTheCaptainFile Added: 0002-CHANGELOG.md-Add-Added-OpenBSD-documentation.patch
2018-10-08 05:37Blzut3Note Added: 0020000
2018-10-08 08:10WubTheCaptainPrioritynormal => low
2018-10-08 08:10WubTheCaptainStatusneeds review => assigned
2018-10-08 08:19WubTheCaptainPrioritylow => normal
2018-10-08 11:01WubTheCaptainNote Added: 0020010
2018-10-08 11:01WubTheCaptainStatusassigned => needs review
2018-10-08 11:01WubTheCaptainNote Edited: 0020010bug_revision_view_page.php?bugnote_id=20010#r12187
2018-10-18 00:47Blzut3Note Added: 0020134
2018-10-18 00:59WubTheCaptainStatusneeds review => assigned
2018-10-18 01:01WubTheCaptainTarget Version1.2 => 1.3
2018-12-17 05:24WubTheCaptainCategorySuggestion => Documentation
2018-12-17 05:49WubTheCaptainStatusassigned => confirmed
2019-06-23 08:33WubTheCaptainPrioritynormal => low
2019-06-23 08:33WubTheCaptainTarget Version1.3 =>
2022-08-25 10:22WubTheCaptainAssigned ToWubTheCaptain =>

Notes
(0019554)
WubTheCaptain   
2018-09-19 11:06   
intox8907 reported these steps to compile on OpenBSD in ticket 0003494:

export Qt5Widgets_DIR=/usr/local/lib/qt5/cmake/Qt5Widgets/
export Qt5LinguistTools_DIR=/usr/local/lib/qt5/cmake/Qt5LinguistTools/
export Qt5Multimedia_DIR=/usr/local/lib/qt5/cmake/Qt5Multimedia
export Qt5Xml_DIR=/usr/local/lib/qt5/cmake/Qt5Xml
export CPATH=$CPATH:/usr/local/include
cmake ..
make


It should also be tested if compiling with gcc 4.2.1 in OpenBSD 6.3 -stable works or not. (I would guess it won't work.)
(0019574)
WubTheCaptain   
2018-09-19 17:46   
Quote from WubTheCaptain
It should also be tested if compiling with gcc 4.2.1 in OpenBSD 6.3 -stable works or not. (I would guess it won't work.)


CXX=g++ (4.2.1) is not supported by cmake 3.10 in OpenBSD 6.4-current, so I guess not. Gladly there's clang++ for that at least, and gcc 4.9.4 in ports for OpenBSD 6.3. gcc 4.2.1 works for C source files in Doomseeker (which there aren't many anyway).
(0019682)
WubTheCaptain   
2018-09-23 00:55   
Since 0003495 was resolved, the steps to build on OpenBSD are much more simplified:

export Qt5_DIR=/usr/local/lib/qt5/cmake/Qt5
cmake -DCMAKE_CXX_FLAGS='-I/usr/local/include' $DOOMSEEKER_SRC
make


CMAKE_CXX_FLAGS include path need to be passed for bzlib.h. No idea if -O2 is also required or not. (I actually came across the solution from'https://github.com/citra-emu/citra/wiki/Building-for-OpenBSD [^]' , thanks!)
(0019963)
WubTheCaptain   
2018-10-06 20:12   
Patch by me attached. I agree to the GNU All-Permissive license at the footer of the file, although if may I'll just dedicate this to public domain with no warranties (CC0 1.0 Universal (CC0 1.0) Public Domain Dedication) because I "don't" have a legal name I'd like to use for the contribution.

Includes a foreword warning about issue 0003494; please make a comment there about this COMPILE.txt blurb if merged.
(0019964)
WubTheCaptain   
2018-10-06 20:22   
Quote from 0001-COMPILE.txt-Document-OpenBSD-build-instructions.patch
+OpenBSD's base operating system comes with zlib and libbz2. Install the
+required ports:


"Install the required ports:" → "Install the required ports, depending on your OpenBSD operating system version:" ?
(0019965)
WubTheCaptain   
2018-10-06 20:23   
Quote from 0001-COMPILE.txt-Document-OpenBSD-build-instructions.patch
-Supported compilers are GCC and, on Windows, MSVC. For compiling on
+Supported compilers are GCC, clang and, on Windows, MSVC. For compiling on


This pushes the line length past 72 characters width limit (which I enforced for my text in the OpenBSD section), but the paragraph below and above are all over the place anyway...
(0019966)
WubTheCaptain   
2018-10-06 20:25   
Quote from 0001-COMPILE.txt-Document-OpenBSD-build-instructions.patch
Add Clang to list of supported compilers. This is a prerequisite, since
it's the default C/C++ compiler since OpenBSD 6.4 I believe.


s/since/because/ on first occurence (with 72 line width), probably.
(0019967)
WubTheCaptain   
2018-10-06 20:29   
Quote from 0001-COMPILE.txt-Document-OpenBSD-build-instructions.patch
+not Trolltech or Qt Project/The Qt Company's recommendations. Setting Qt5_DIR
+is necessary for CMake to know to look for it.


Qt5_DIR → `Qt5_DIR`

Quote from 0001-COMPILE.txt-Document-OpenBSD-build-instructions.patch
+`-I /usr/local/include` is required to find bzlib.h (system bzip2 library).


bzlib.h → `bzlib.h`
(0019968)
WubTheCaptain   
2018-10-06 20:43   
New v2 patch attached with fixes mentioned in previous notes.
(0019969)
WubTheCaptain   
2018-10-06 21:00   
Sigh, let me test GCC 4.2.1 again tomorrow before merging this.
(0019978)
WubTheCaptain   
2018-10-07 07:54   
(edited on: 2018-10-07 09:48)
Quote from 0001-COMPILE.txt-Document-OpenBSD-build-instructions.v2.patch
+Doomseeker has been tested on OpenBSD 6.4-current with both GCC 4.2.1 and Clang
+6.0.0 toolchains, as of October 2018.


GCC 4.2.1 → g++ 4.9.4. Mention incompatibility with g++ 4.2.1 in base.

g++ 4.2.1 is unsupported by CMake (cxx_decltype error). GCC 4.2.1 is fine for $CC, for what little C language code there is. g++ 4.9.4 from snapshot ports (OpenBSD 6.4) works with CMake without CMAKE_CXX_FLAGS, this will be installed at `/usr/local/bin/eg++`.

clang in OpenBSD base (since OpenBSD 6.1 on arm64, since OpenBSD 6.3 on armv6 and sparc64) and works out of the box without additional ports.

Quote from 0001-COMPILE.txt-Document-OpenBSD-build-instructions.v2.patch
+    pkg_add qtbase cmake # OpenBSD >= 6.2, latest Qt version (Qt5)


qtbase doesn't uninstall the required libraries. Remove this line.

(0019979)
WubTheCaptain   
2018-10-07 08:04   
(edited on: 2018-10-07 09:49)
clang became the default compiler on amd64 and i386 on OpenBSD 6.2, although this was not mentioned in the OpenBSD 6.2 release announcement.

Oh, and I got a runtime error from that g++ 4.9.4 build of Doomseeker. I'm investigating it... perhaps we only support OpenBSD >= 6.1/6.2, nonetheless only the latest two -stable releases are officially supported.

(0019980)
WubTheCaptain   
2018-10-07 08:26   
Quote from 0001-COMPILE.txt-Document-OpenBSD-build-instructions.v2.patch
+    cmake \
+    	-DCMAKE_CXX_FLAGS="-I /usr/local/include" \
+	..


Probably should not override `CXXFLAGS` (or `CPPFLAGS`), but amend them. Either pass `CXXFLAGS` or `CPPFLAGS` before calling `cmake`, or use `cmake -E`.
(0019981)
WubTheCaptain   
2018-10-07 08:28   
(edited on: 2018-10-07 08:29)
Quote from WubTheCaptain
g++ 4.2.1 is unsupported by CMake (cxx_decltype error).


Documented in CMake's documentation: cmake-compile-features(7) § Supported Compilers.

Quote from cmake-compile-features(7) § Supported Compilers (C++)
GNU: GNU compiler versions 4.4 through 8.0.


(0019986)
WubTheCaptain   
2018-10-07 10:05   
Patch v3 attached. Rebase to tip if necessary.

We could do our CXXFLAGS thing in CMake build files, but I've decided against it for now.
(0019987)
WubTheCaptain   
2018-10-07 10:24   
(edited on: 2018-10-07 10:25)
Question: Although I already put this up for review, should I use CPATH instead of CXXFLAGS?

CPATH can be exported to the environment, which the GNU C Preprocessor (and Clang) looks for after any paths given with -I option. I don't know what CMake does with this.

CXXFLAGS gets added to CMAKE_CXX_FLAGS on initial configuration and cached to CMakeCache.txt (or something), and then ignored afterwards. If you messed up the initial configuration, you need to start over. On the flip side, you don't need to type CXXFLAGS again or export it to your environment; it stays in the directory.

(0019988)
WubTheCaptain   
2018-10-07 10:27   
Fyi, bsd.port.mk(5) doesn't support CPATH but supports CXXFLAGS anyway.
(0020000)
Blzut3   
2018-10-08 05:37   
Should be possible to set BZIP2_INCLUDE_DIR to /usr/local/include. Also with the Qt5_DIR variable, I believe you can use -DQt5_DIR= on the CMake command line. Actually kind of surprised that CMake checks for environment variables for those.
(0020010)
WubTheCaptain   
2018-10-08 11:01   
Quote from Blzut3
Should be possible to set BZIP2_INCLUDE_DIR to /usr/local/include.


No, it's not possible. Not -DBZIP2_INCLUDE_DIR=/usr/local/include nor environment variable before calling CMake. bzlib.h won't be found.

Quote from Blzut3
Also with the Qt5_DIR variable, I believe you can use -DQt5_DIR= on the CMake command line.


This is possible.

What do you suggest?

(0020134)
Blzut3   
2018-10-18 00:47   
For BZip2, CMake has a ton of ways to specify search paths documented in find_path:'https://cmake.org/cmake/help/latest/command/find_path.html [^]'

I would probably suggest looking at BZip2_ROOT (https://cmake.org/cmake/help/latest/variable/PackageName_ROOT.html#variable:%3CPackageName%3E_ROOT) and failing that CMAKE_FIND_ROOT_PATH.

I would say I prefer -D over environment variables since environment variables feel too much like globals to me and I feel better minimizing them.