--- a/src/core/opamUnix.c
+++ b/src/core/opamUnix.c
@@ -8,6 +8,12 @@
 /*                                                                        */
 /**************************************************************************/

+#ifdef __sun
+/* illumos/Solaris: struct winsize and TIOCGWINSZ in termios */
+#include <sys/termios.h>
+#include <unistd.h>
+#endif
+
 #include <sys/ioctl.h>

 CAMLprim value opam_stdout_ws_col(value _unit) {
