deadpixi / mtm

Perhaps the smallest useful terminal multiplexer in the world.
1.1k stars 51 forks source link

Build fails on OpenBSD-current #32

Open vext01 opened 5 years ago

vext01 commented 5 years ago
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 commented 5 years ago

Please try adding

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

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

domrc commented 4 years ago

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 commented 4 years ago

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 commented 4 years ago

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 commented 4 years ago

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

vext01 commented 4 years ago
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 commented 4 years ago

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