graphics/freeglut fails to build: 'sys/joystick.h' not found

Good day!

I'm update ports, and have a stuck with graphics/freeglut. It needs sys/joystick.h. I have no any joystick or gamepad and not installs joystick driver for xorg.
Code:
===>  License MIT accepted by the user
===>   freeglut-3.0.0_1 depends on file: /usr/local/sbin/pkg - found
===> Fetching all distfiles required by freeglut-3.0.0_1 for building
===>  Extracting for freeglut-3.0.0_1
=> SHA256 Checksum OK for freeglut-3.0.0.tar.gz.
===>  Patching for freeglut-3.0.0_1
===>  Applying FreeBSD patches for freeglut-3.0.0_1
===>   freeglut-3.0.0_1 depends on file: /usr/local/bin/cmake - found
===>   freeglut-3.0.0_1 depends on executable: ninja - found
===>   freeglut-3.0.0_1 depends on package: xorgproto>=0 - found
===>   freeglut-3.0.0_1 depends on package: xorgproto>=0 - found
===>   freeglut-3.0.0_1 depends on file: /usr/local/libdata/pkgconfig/ice.pc - found
===>   freeglut-3.0.0_1 depends on file: /usr/local/libdata/pkgconfig/x11.pc - found
===>   freeglut-3.0.0_1 depends on file: /usr/local/libdata/pkgconfig/xi.pc - found
===>   freeglut-3.0.0_1 depends on file: /usr/local/libdata/pkgconfig/xrandr.pc - found
===>   freeglut-3.0.0_1 depends on shared library: libGL.so - found (/usr/local/lib/libGL.so)
===>   freeglut-3.0.0_1 depends on shared library: libGLU.so - found (/usr/local/lib/libGLU.so)
===>  Configuring for freeglut-3.0.0_1
===>  Performing in-source build
/bin/mkdir -p /usr/ports/graphics/freeglut/work/freeglut-3.0.0
-- The C compiler identification is Clang 6.0.1
-- The CXX compiler identification is Clang 6.0.1
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Found OpenGL: /usr/local/lib/libGL.so   
-- Looking for XOpenDisplay in /usr/local/lib/libX11.so;/usr/local/lib/libXext.so
-- Looking for XOpenDisplay in /usr/local/lib/libX11.so;/usr/local/lib/libXext.so - found
-- Looking for gethostbyname
-- Looking for gethostbyname - found
-- Looking for connect
-- Looking for connect - found
-- Looking for remove
-- Looking for remove - found
-- Looking for shmat
-- Looking for shmat - found
-- Looking for IceConnectionNumber in ICE
-- Looking for IceConnectionNumber in ICE - found
-- Found X11: /usr/local/lib/libX11.so
CMake Warning (dev) at /usr/local/share/cmake/Modules/CheckIncludeFiles.cmake:110 (message):
  Policy CMP0075 is not set: Include file check macros honor
  CMAKE_REQUIRED_LIBRARIES.  Run "cmake --help-policy CMP0075" for policy
  details.  Use the cmake_policy command to set the policy and suppress this
  warning.

  CMAKE_REQUIRED_LIBRARIES is set to:

    m

  For compatibility with CMake 3.11 and below this check is ignoring it.
Call Stack (most recent call first):
  CMakeLists.txt:272 (CHECK_INCLUDE_FILES)
This warning is for project developers.  Use -Wno-dev to suppress it.

-- Looking for include file /usr/local/include/X11/extensions/XInput2.h
-- Looking for include file /usr/local/include/X11/extensions/XInput2.h - not found
-- Looking for include file sys/types.h
-- Looking for include file sys/types.h - found
-- Looking for include file unistd.h
-- Looking for include file unistd.h - found
-- Looking for include file sys/time.h
-- Looking for include file sys/time.h - found
-- Looking for include file stdbool.h
-- Looking for include file stdbool.h - found
-- Looking for include file sys/param.h
-- Looking for include file sys/param.h - found
-- Looking for include file sys/ioctl.h
-- Looking for include file sys/ioctl.h - found
-- Looking for include file fcntl.h
-- Looking for include file fcntl.h - found
-- Looking for include file usbhid.h
-- Looking for include file usbhid.h - found
-- Looking for gettimeofday
-- Looking for gettimeofday - found
-- Looking for XParseGeometry
-- Looking for XParseGeometry - not found
-- Looking for include file stdint.h
-- Looking for include file stdint.h - found
-- Looking for include file inttypes.h
-- Looking for include file inttypes.h - found
-- Configuring done
-- Generating done
CMake Warning:
  Manually-specified variables were not used by the project:

    CMAKE_CXX_FLAGS_DEBUG
    CMAKE_C_FLAGS_DEBUG
    CMAKE_MODULE_LINKER_FLAGS
    CMAKE_VERBOSE_MAKEFILE
    THREADS_HAVE_PTHREAD_ARG


-- Build files have been written to: /usr/ports/graphics/freeglut/work/freeglut-3.0.0
===>  Building for freeglut-3.0.0_1
[1/139] /usr/bin/cc -DHAVE_CONFIG_H -Isrc -Iinclude -I. -I/usr/local/include -Os -pipe -march=native  -fstack-protector -fno-strict-aliasing -Os -pipe -march=native  -fstack-protector -fno-strict-aliasing -MD -MT CMakeFiles/subwin.dir/progs/demos/subwin/subwin.c.o -MF CMakeFiles/subwin.dir/progs/demos/subwin/subwin.c.o.d -o CMakeFiles/subwin.dir/progs/demos/subwin/subwin.c.o   -c progs/demos/subwin/subwin.c
[2/139] /usr/bin/cc -DHAVE_CONFIG_H -Dfreeglut_EXPORTS -Isrc -Iinclude -I. -I/usr/local/include -Os -pipe -march=native  -fstack-protector -fno-strict-aliasing -Os -pipe -march=native  -fstack-protector -fno-strict-aliasing -fPIC -MD -MT CMakeFiles/freeglut.dir/src/fg_cursor.c.o -MF CMakeFiles/freeglut.dir/src/fg_cursor.c.o.d -o CMakeFiles/freeglut.dir/src/fg_cursor.c.o   -c src/fg_cursor.c
FAILED: CMakeFiles/freeglut.dir/src/fg_cursor.c.o
/usr/bin/cc -DHAVE_CONFIG_H -Dfreeglut_EXPORTS -Isrc -Iinclude -I. -I/usr/local/include -Os -pipe -march=native  -fstack-protector -fno-strict-aliasing -Os -pipe -march=native  -fstack-protector -fno-strict-aliasing -fPIC -MD -MT CMakeFiles/freeglut.dir/src/fg_cursor.c.o -MF CMakeFiles/freeglut.dir/src/fg_cursor.c.o.d -o CMakeFiles/freeglut.dir/src/fg_cursor.c.o   -c src/fg_cursor.c
In file included from src/fg_cursor.c:29:
In file included from src/fg_internal.h:192:
src/x11/fg_internal_x11.h:177:22: fatal error: 'sys/joystick.h' file not found
#            include <sys/joystick.h>
                     ^~~~~~~~~~~~~~~~
1 error generated.
[3/139] /usr/bin/cc -DHAVE_CONFIG_H -Dfreeglut_EXPORTS -Isrc -Iinclude -I. -I/usr/local/include -Os -pipe -march=native  -fstack-protector -fno-strict-aliasing -Os -pipe -march=native  -fstack-protector -fno-strict-aliasing -fPIC -MD -MT CMakeFiles/freeglut.dir/src/fg_callbacks.c.o -MF CMakeFiles/freeglut.dir/src/fg_callbacks.c.o.d -o CMakeFiles/freeglut.dir/src/fg_callbacks.c.o   -c src/fg_callbacks.c
FAILED: CMakeFiles/freeglut.dir/src/fg_callbacks.c.o
/usr/bin/cc -DHAVE_CONFIG_H -Dfreeglut_EXPORTS -Isrc -Iinclude -I. -I/usr/local/include -Os -pipe -march=native  -fstack-protector -fno-strict-aliasing -Os -pipe -march=native  -fstack-protector -fno-strict-aliasing -fPIC -MD -MT CMakeFiles/freeglut.dir/src/fg_callbacks.c.o -MF CMakeFiles/freeglut.dir/src/fg_callbacks.c.o.d -o CMakeFiles/freeglut.dir/src/fg_callbacks.c.o   -c src/fg_callbacks.c
In file included from src/fg_callbacks.c:29:
In file included from src/fg_internal.h:192:
src/x11/fg_internal_x11.h:177:22: fatal error: 'sys/joystick.h' file not found
#            include <sys/joystick.h>
                     ^~~~~~~~~~~~~~~~
1 error generated.
[4/139] /usr/bin/cc -DHAVE_CONFIG_H -Dfreeglut_EXPORTS -Isrc -Iinclude -I. -I/usr/local/include -Os -pipe -march=native  -fstack-protector -fno-strict-aliasing -Os -pipe -march=native  -fstack-protector -fno-strict-aliasing -fPIC -MD -MT CMakeFiles/freeglut.dir/src/fg_display.c.o -MF CMakeFiles/freeglut.dir/src/fg_display.c.o.d -o CMakeFiles/freeglut.dir/src/fg_display.c.o   -c src/fg_display.c
FAILED: CMakeFiles/freeglut.dir/src/fg_display.c.o
/usr/bin/cc -DHAVE_CONFIG_H -Dfreeglut_EXPORTS -Isrc -Iinclude -I. -I/usr/local/include -Os -pipe -march=native  -fstack-protector -fno-strict-aliasing -Os -pipe -march=native  -fstack-protector -fno-strict-aliasing -fPIC -MD -MT CMakeFiles/freeglut.dir/src/fg_display.c.o -MF CMakeFiles/freeglut.dir/src/fg_display.c.o.d -o CMakeFiles/freeglut.dir/src/fg_display.c.o   -c src/fg_display.c
In file included from src/fg_display.c:29:
In file included from src/fg_internal.h:192:
src/x11/fg_internal_x11.h:177:22: fatal error: 'sys/joystick.h' file not found
#            include <sys/joystick.h>
                     ^~~~~~~~~~~~~~~~
1 error generated.
[5/139] /usr/bin/cc -DHAVE_CONFIG_H -Dfreeglut_EXPORTS -Isrc -Iinclude -I. -I/usr/local/include -Os -pipe -march=native  -fstack-protector -fno-strict-aliasing -Os -pipe -march=native  -fstack-protector -fno-strict-aliasing -fPIC -MD -MT CMakeFiles/freeglut.dir/src/fg_ext.c.o -MF CMakeFiles/freeglut.dir/src/fg_ext.c.o.d -o CMakeFiles/freeglut.dir/src/fg_ext.c.o   -c src/fg_ext.c
FAILED: CMakeFiles/freeglut.dir/src/fg_ext.c.o
/usr/bin/cc -DHAVE_CONFIG_H -Dfreeglut_EXPORTS -Isrc -Iinclude -I. -I/usr/local/include -Os -pipe -march=native  -fstack-protector -fno-strict-aliasing -Os -pipe -march=native  -fstack-protector -fno-strict-aliasing -fPIC -MD -MT CMakeFiles/freeglut.dir/src/fg_ext.c.o -MF CMakeFiles/freeglut.dir/src/fg_ext.c.o.d -o CMakeFiles/freeglut.dir/src/fg_ext.c.o   -c src/fg_ext.c
In file included from src/fg_ext.c:30:
In file included from src/fg_internal.h:192:
src/x11/fg_internal_x11.h:177:22: fatal error: 'sys/joystick.h' file not found
#            include <sys/joystick.h>
                     ^~~~~~~~~~~~~~~~
1 error generated.
ninja: build stopped: subcommand failed.
===> Compilation failed unexpectedly.
Try to set MAKE_JOBS_UNSAFE=yes and rebuild before reporting the failure to
the maintainer.
*** Error code 1

Stop.
make[2]: stopped in /usr/ports/graphics/freeglut
*** Error code 1

Stop.
make[1]: stopped in /usr/ports/graphics/freeglut
*** Error code 1

Stop.
make: stopped in /usr/ports/graphics/freeglut
 
Code:
root@c2:~# ll /usr/include/sys/joystick.h
-r--r--r--  1 root  wheel  2197 Jul  4 11:30 /usr/include/sys/joystick.h
It's part of the base OS include headers, you should have it.

What version of FreeBSD?
 
I'm specially don't point used release, because of forum rules :)
Code:
FreeBSD BSD-NUC 13.0-CURRENT FreeBSD 13.0-CURRENT r339640 BSDSERV  amd64
 
Well, that explains it. Don't use -CURRENT unless you are a developer and/or know what you are doing.

This is where new developments are tested and evaluated, which means that any part of the system may break at any given time. For the most part, -CURRENT should be considered the playground for FreeBSD developers, and for 'adventurous users' who don't mind that their system breaks.
Topics about unsupported FreeBSD versions
 
talsamon said:
You can try if comment out the line

Code:
CPPFLAGS+=      -I${LOCALBASE}/include

in the Makefile helps.
No, it doesn't helps.
Helps a hack with copying joystick.h from -STABLE to /usr/include/sys
Thanks!
 
Hi!
joystick.h was removed as part of the removal of the old joy(4) driver, done in FreeBSD base r339563. This driver has been deprecated for some time.
As far as I can tell, no ioctls from joystick.h are actually used in freeglut. I'll try to update freeglut to not require joystick.h.
Regards
Niclas Zeising
FreeBSD X11/Graphics Team
 
I could put an empty sys/joystick.h back into the tree, but that would be pointless.
My recommendation is to remove it entirely from the freeglut port, unconditionally.
A quick grep shows that it doesn't use anything in it, at least no IOCTLs.
The following makes it compiles.

Code:
diff --git a/graphics/freeglut/files/patch-src_x11_fg__internal__x11.h b/graphics/freeglut/files/patch-src_x11_fg__internal__x11.h
index 41e551317b72..8e244e269cd8 100644
--- a/graphics/freeglut/files/patch-src_x11_fg__internal__x11.h
+++ b/graphics/freeglut/files/patch-src_x11_fg__internal__x11.h
@@ -1,6 +1,6 @@
---- src/x11/fg_internal_x11.h.orig     2014-10-20 15:27:04 UTC
-+++ src/x11/fg_internal_x11.h
-@@ -136,8 +136,42 @@ struct tagSFG_PlatformWindowState
+--- src/x11/fg_internal_x11.h.orig     2014-10-20 09:27:04.000000000 -0600
++++ src/x11/fg_internal_x11.h  2018-10-24 14:49:19.146384000 -0600
+@@ -136,11 +136,50 @@
  #include <string.h>

  #    if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__NetBSD__)
@@ -35,15 +35,24 @@
 +#        endif
 +#        include <dev/usb/usb.h>
 +#        include <dev/usb/usbhid.h>
-+
+
 +/* Compatibility with older usb.h revisions */
 +#        if !defined(USB_MAX_DEVNAMES) && defined(MAXDEVNAMES)
 +#            define USB_MAX_DEVNAMES MAXDEVNAMES
 +#        endif
-
++
  #        if defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
- #            include <sys/joystick.h>
-@@ -189,6 +223,30 @@ struct tagSFG_PlatformWindowState
+-#            include <sys/joystick.h>
++struct joystick {
++      int x;
++      int y;
++      int b1;
++      int b2;
++};
+ #        else
+ /*
+  * XXX NetBSD/amd64 systems may find that they have to steal the
+@@ -189,6 +228,30 @@
   */
  #    define _JS_MAX_AXES 16
  typedef struct tagSFG_PlatformJoystick SFG_PlatformJoystick;
 
Hi!
I'm working with a similar patch, but I need to at least test that it builds. I'll work together with bsdimp to get this sorted.
Thank you!
Regards
Niclas
 
Hi!
I just committed a fix to the ports tree for this.
Please be aware that the joystick support in freeglut is not really tested, and as such it's in as-is condition. :)
 
Back
Top