Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build fails on OpenBSD-current #32

Open
vext01 opened this issue Jul 23, 2019 · 7 comments
Open

Build fails on OpenBSD-current #32

vext01 opened this issue Jul 23, 2019 · 7 comments

Comments

@vext01
Copy link

vext01 commented Jul 23, 2019

fremen:mtm> make
cc -O2 -pipe  -D_POSIX_C_SOURCE=200809L -D_XOPEN_SOURCE=600 -D_XOPEN_SOURCE_EXTENDED -o mtm  vtparser.c mtm.c  -lncursesw -lutil
In file included from mtm.c:40:
./config.h:81:10: fatal error: 'pty.h' file not found
#include FORKPTY_INCLUDE_H
         ^~~~~~~~~~~~~~~~~
./config.h:78:35: note: expanded from macro 'FORKPTY_INCLUDE_H'
        #define FORKPTY_INCLUDE_H <pty.h>
                                  ^~~~~~~
1 error generated.

I didn't investigate further, sorry :)

@deadpixi
Copy link
Owner

Please try adding

#include <termios.h>
#include <util.h>

to your config.h file and see if that works.

@domrc
Copy link
Contributor

domrc commented Jan 19, 2020

I'm trying to compile mtm on OpenBSD 6.6 stable and ran into a similar
problem. I did some research and found out what seems to be most, if
not all, of the compilation issues for this situation. It can not
compile further, due to OpenBSD 6.6 only bundling ncurses version 5.7
with itself, making it difficult to compile further and find any other
issues. I've created a diff of what I've found so far. Please let me
know if you would like this patch as a pull request or if you need any
more information.

--- config.def.h	Sat Jan 18 15:21:46 2020
+++ config.h	Sun Jan 19 13:38:18 2020
@@ -61,7 +61,7 @@
 
 /* The path for the wide-character curses library. */
 #ifndef NCURSESW_INCLUDE_H
-    #if defined(__APPLE__) || !defined(__linux__) || defined(__FreeBSD__)
+    #if defined(__APPLE__) || !defined(__linux__) || defined(__FreeBSD__) || defined(__OpenBSD__)
         #define NCURSESW_INCLUDE_H <curses.h>
     #else
         #define NCURSESW_INCLUDE_H <ncursesw/curses.h>
@@ -71,7 +71,7 @@
 
 /* Includes needed to make forkpty(3) work. */
 #ifndef FORKPTY_INCLUDE_H
-    #if defined(__APPLE__)
+    #if defined(__APPLE__) || defined(__OpenBSD__)
         #define FORKPTY_INCLUDE_H <util.h>
     #elif defined(__FreeBSD__)
         #define FORKPTY_INCLUDE_H <libutil.h>
@@ -80,6 +80,22 @@
     #endif
 #endif
 #include FORKPTY_INCLUDE_H
+
+/* Needed for OpenBSD */
+#if defined(__OpenBSD__)
+    #include <termios.h>
+    #include <util.h>
+#endif
+
+/* Specify needed NCurses version */
+/* Needed due to OpenBSD 6.6 bundling version 5.7, it will not
+   compile due to the missing function alloc_pair() */
+/* May need to be researched further as the required version is
+   a guess */
+/* Sorry for this hack */
+#if NCURSES_VERSION_MAJOR < 6
+	#include <ncurses6+>
+#endif
 
 /* You probably don't need to alter these much, but if you do,
  * here is where you can define alternate character sets.

@deadpixi
Copy link
Owner

deadpixi commented Feb 6, 2020

Hi @domrc,
Does OpenBSD provide newer versions of ncurses in their ports? If so, it might be possible to create a ports-related dependency there.

@domrc
Copy link
Contributor

domrc commented Feb 8, 2020

Hello @deadpixi,
I double checked OpenBSD's ports via pkg_add & /usr/ports, neither one had a newer version of ncurses. Just to check if a newer version could be compiled, I tried compiling ncurses-6.1 and had no success. While doing some more research I stumbled upon this FAQ which summarizes the current ncurses situation per platform. The current outlook for getting mtm on OpenBSD doesn't look too promising, to say the least, but I will persist in my efforts to get it working in the future.

BTW: Thank you for mtm!

@deadpixi
Copy link
Owner

Could you try the latest master? I think I've removed the curses 6.1+ dependency.

@vext01
Copy link
Author

vext01 commented Jun 18, 2020

arrakis:mtm> make
cp -i config.def.h config.h
cc -O2 -pipe  -D_POSIX_C_SOURCE=200809L -D_XOPEN_SOURCE=600 -D_XOPEN_SOURCE_EXTENDED -o mtm  vtparser.c mtm.c pair.c  -lncursesw -lutil
In file included from mtm.c:35:
./config.h:82:10: fatal error: 'pty.h' file not found
#include FORKPTY_INCLUDE_H
         ^~~~~~~~~~~~~~~~~
./config.h:79:35: note: expanded from macro 'FORKPTY_INCLUDE_H'
        #define FORKPTY_INCLUDE_H <pty.h>
                                  ^~~~~~~
1 error generated.
In file included from pair.c:3:
./config.h:82:10: fatal error: 'pty.h' file not found
#include FORKPTY_INCLUDE_H
         ^~~~~~~~~~~~~~~~~
./config.h:79:35: note: expanded from macro 'FORKPTY_INCLUDE_H'
        #define FORKPTY_INCLUDE_H <pty.h>
                                  ^~~~~~~
1 error generated.
*** Error 1 in /home/edd/source/mtm (Makefile:14 'mtm')

@domrc
Copy link
Contributor

domrc commented Jun 20, 2020

I performed a git pull and with two small line changes it compiled on OpenBSD 6.6 stable! I am aware 6.7 is out and I will try to compile mtm on the new version, but in the meantime, mind if I send a pull request?
The current code doesn't compile without some changes, as @vext01 has shown.

Edit: I've made a pull request. It's pull request #47

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants