LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Slackware (https://www.linuxquestions.org/questions/slackware-14/)
-   -   missing prerequisite headers? (https://www.linuxquestions.org/questions/slackware-14/missing-prerequisite-headers-596947/)

shadowsnipes 11-03-2007 07:07 PM

missing prerequisite headers?
 
I'm trying to compile kxmame for Slackware 12 and I cannot do it without configuring with --disable-joystick.

The root of the problem can be seen during a ./configure with no options

Code:

checking linux/joystick.h usability... no
checking linux/joystick.h presence... yes
configure: WARNING: linux/joystick.h: present but cannot be compiled
configure: WARNING: linux/joystick.h:    check for missing prerequisite headers?
configure: WARNING: linux/joystick.h: see the Autoconf documentation
configure: WARNING: linux/joystick.h:    section "Present But Cannot Be Compiled"
configure: WARNING: linux/joystick.h: proceeding with the preprocessor's result
configure: WARNING: linux/joystick.h: in the future, the compiler will take precedence
checking for linux/joystick.h... yes

Anybody know how I can fix this?

Thank you in advance for your help.

willysr 11-03-2007 07:33 PM

Do you have kernel-headers package?

shadowsnipes 11-03-2007 07:45 PM

Yes. I even reinstalled it just in case there was a problem with it. I even tried the non-smp version just for kicks. No go.

Right now I am messing with the configure.in file and running autoconf to see if that helps.

Basically, I am trying something similar to what's on this page:
http://www.cs.cmu.edu/cgi-bin/info2w...0Be%20Compiled

*********************************************
Edit:
Well it compiled now, but that's because I think it skipped the file as shown

checking for linux/joystick.h... no

I had changed a section of the configure to look like

Code:

if test "$enable_joystick" = auto ; then
    AC_CHECK_HEADERS([linux/input.h linux/joystick.h],
                    [enable_joystick=yes],
                    [enable_joystick=no],
                    [[#if HAVE_INPUT_H
                    # include <linux/input.h>
                    #endif
                    ]])

The input.h stuff wasn't in there before.

At any rate the end result of this test is that it still did not enable joystick support. All I have for options is SDL joystick, which is what I had when I configured with --disable-joystick. I know there is supposed to be another joystick option in there.

osor 11-03-2007 08:20 PM

Glad you got it to compile. Just curious though, what was shown in config.log when it didn’t configure correctly? Also, what happened if you just ignored the warning?

shadowsnipes 11-03-2007 08:34 PM

hmmm I don't think there were any extra warnings in the config.log file, but it's been overwritten by now. I'll remake it ;)

As far as what happens when I ignore the warning... Well, it doesn't compile at all.

I'll setup another build environment and post the results when I tried it the original way so I can show you what's in the config.log.

shadowsnipes 11-03-2007 09:09 PM

Okay, so first I untar the sources and ...
Code:

make -f Makefile.cvs
****************
Resultant output
****************
Code:

This Makefile is only for the CVS repository
This will be deleted before making the distribution

*** automake (GNU automake) 1.9.6 found.
*** Creating acinclude.m4
make[2]: Entering directory `/home/USERNAME/Compile/kxmame2/kxmame/trunk'
make[2]: Leaving directory `/home/USERNAME/Compile/kxmame2/kxmame/trunk'
*** Creating list of subdirectories
make[2]: Entering directory `/home/USERNAME/Compile/kxmame2/kxmame/trunk'
cd . && make -f admin/Makefile.common subdirs
make[3]: Entering directory `/home/USERNAME/Compile/kxmame2/kxmame/trunk'
make[3]: Leaving directory `/home/USERNAME/Compile/kxmame2/kxmame/trunk'
make[2]: Leaving directory `/home/USERNAME/Compile/kxmame2/kxmame/trunk'
*** Creating configure.files
*** Creating configure.in
make[2]: Entering directory `/home/USERNAME/Compile/kxmame2/kxmame/trunk'
cd . && make -f admin/Makefile.common configure.in ;
make[3]: Entering directory `/home/USERNAME/Compile/kxmame2/kxmame/trunk'
make[3]: Leaving directory `/home/USERNAME/Compile/kxmame2/kxmame/trunk'
make[2]: Leaving directory `/home/USERNAME/Compile/kxmame2/kxmame/trunk'
*** Creating aclocal.m4
/usr/share/aclocal/nspr.m4:8: warning: underquoted definition of AM_PATH_NSPR
  run info '(automake)Extending aclocal'
  or see http://sources.redhat.com/automake/automake.html#Extending-aclocal
/usr/share/aclocal/imlib.m4:9: warning: underquoted definition of AM_PATH_IMLIB
/usr/share/aclocal/imlib.m4:167: warning: underquoted definition of AM_PATH_GDK_IMLIB
/usr/share/aclocal/audiofile.m4:12: warning: underquoted definition of AM_PATH_AUDIOFILE
/usr/share/aclocal/aalib.m4:12: warning: underquoted definition of AM_PATH_AALIB
*** Creating configure
*** Creating config.h template
*** Creating Makefile templates
*** Postprocessing Makefile templates
unknown icon type  in src/Makefile.in (kxmame_64.png)
*** Creating date/time stamp
*** Finished
    Don't forget to run ./configure
    If you haven't done so in a while, run ./configure --help

Then I run
Code:

./configure --enable-joystick
*******************************
config.log sections of interest
(very long so I don't want to post the whole thing)
*******************************
Code:

configure:33483: checking linux/joystick.h usability
configure:33500: gcc -c -std=iso9899:1990 -W -Wall -Wchar-subscripts -Wshadow -Wpointer-arith -Wmissing-prototypes -Wwrite-strings -D_XOPEN_SOURCE=500 -D_BSD_SOURCE -O2  -Wformat-security -Wmissing-format-attribute -pthread -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include  -DKXMAME  -DQT_THREAD_SUPPORT  -D_REENTRANT -pthread -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include  conftest.c >&5
In file included from conftest.c:78:
/usr/include/linux/joystick.h:131: error: expected specifier-qualifier-list before '__s64'
configure:33506: $? = 1
configure: failed program was:
| /* confdefs.h.  */
| #define PACKAGE_NAME ""
| #define PACKAGE_TARNAME ""
| #define PACKAGE_VERSION ""
| #define PACKAGE_STRING ""
| #define PACKAGE_BUGREPORT ""
| #define PACKAGE "kxmame"
| #define VERSION "2.0-beta"
| #define KDELIBSUFF ""
| #define STDC_HEADERS 1
| #define HAVE_SYS_TYPES_H 1
| #define HAVE_SYS_STAT_H 1
| #define HAVE_STDLIB_H 1
| #define HAVE_STRING_H 1
| #define HAVE_MEMORY_H 1
| #define HAVE_STRINGS_H 1
| #define HAVE_INTTYPES_H 1
| #define HAVE_STDINT_H 1
| #define HAVE_UNISTD_H 1
| #define HAVE_DLFCN_H 1
| #define HAVE_SGI_STL 1
| #define HAVE_CRYPT 1
| #define kde_socklen_t socklen_t
| #define ksize_t socklen_t
| #define HAVE_SYS_TYPES_H 1
| #define HAVE_STDINT_H 1
| #define HAVE_SYS_BITYPES_H 1
| #define HAVE_RES_INIT 1
| #define HAVE_RES_INIT 1
| #define HAVE_RES_INIT_PROTO 1
| #define SIZEOF_INT 4
| #define SIZEOF_SHORT 2
| #define SIZEOF_LONG 4
| #define SIZEOF_CHAR_P 4
| #define SIZEOF_SIZE_T 4
| #define SIZEOF_UNSIGNED_LONG 4
| #define HAVE_VSNPRINTF 1
| #define HAVE_SNPRINTF 1
| #define HAVE_LIBZ 1
| #define HAVE_LIBPNG 1
| #define HAVE_LIBJPEG 1
| #define HAVE_LIBPTHREAD 1
| #define KDEMAXPATHLEN 4096
| /* end confdefs.h.  */
| #include <stdio.h>
| #ifdef HAVE_SYS_TYPES_H
| # include <sys/types.h>
| #endif
| #ifdef HAVE_SYS_STAT_H
| # include <sys/stat.h>
| #endif
| #ifdef STDC_HEADERS
| # include <stdlib.h>
| # include <stddef.h>
| #else
| # ifdef HAVE_STDLIB_H
| #  include <stdlib.h>
| # endif
| #endif
| #ifdef HAVE_STRING_H
| # if !defined STDC_HEADERS && defined HAVE_MEMORY_H
| #  include <memory.h>
| # endif
| # include <string.h>
| #endif
| #ifdef HAVE_STRINGS_H
| # include <strings.h>
| #endif
| #ifdef HAVE_INTTYPES_H
| # include <inttypes.h>
| #endif
| #ifdef HAVE_STDINT_H
| # include <stdint.h>
| #endif
| #ifdef HAVE_UNISTD_H
| # include <unistd.h>
| #endif
| #include <linux/joystick.h>
configure:33520: result: no
configure:33524: checking linux/joystick.h presence
configure:33539: gcc -E  -DQT_THREAD_SUPPORT  -D_REENTRANT -pthread -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include  conftest.c
configure:33545: $? = 0
configure:33559: result: yes
configure:33572: WARNING: linux/joystick.h: present but cannot be compiled
configure:33574: WARNING: linux/joystick.h:    check for missing prerequisite headers?
configure:33576: WARNING: linux/joystick.h: see the Autoconf documentation
configure:33578: WARNING: linux/joystick.h:    section "Present But Cannot Be Compiled"
configure:33580: WARNING: linux/joystick.h: proceeding with the preprocessor's result
configure:33582: WARNING: linux/joystick.h: in the future, the compiler will take precedence
configure:33587: checking for linux/joystick.h
configure:33595: result: yes

thanks again for helping me. I'm sure it will benefit many others who might want to compile kxmame on slackware 12.

shadowsnipes 11-03-2007 09:43 PM

I think I just fixed it by taking out all the '64' stuff (I figured it had something to do with 64-bit machines) at the end of the joystick.h file. At least it configured without the error...

I'll report back after I compile, package, and test it.

Edit:
************************************************
Well it compiled and installed just fine. kxmame detected my Logitech Gamepad upon startup and I was able to select games in the menu using it! However, when I tried to run a game it wouldn't work with my joypad. The kxmame conf GUI allows you to select if you want to have 'no joystick' or an 'SDL joystick'. It *should* also have an option for 'Standard Joystick' or something similar but it isn't there. The 'SDL joystick' option has never worked for me in this program, but the missing option does.

After playing around with my copy of xmame (xmame.SDL from linuxpackages) by itself I realized that perhaps my joystick is considered a SDL joystick as xmame.SDL runs my games with -jt 5 (SDL joystick) instead of -jt 1 (Standard Joystick). The funny thing is that kxmame griped about "joytype 1 is not available" when I had selected SDL joystick! So, obviously something is wrong with this program's GUI as it isn't even sending xmame what I am telling it to! An issue for another thread perhaps...

At any rate, I believe I successfully managed to compile this program with my hacks. Thanks osor for pointing out to me the obvious thing I should have done. Sometimes when you've been working on something for a long time you miss something obvious like checking the config log.

Here is what the end of the original /usr/include/linux/joystick.h looked like

Code:

struct JS_DATA_SAVE_TYPE_64 {
        __s32 JS_TIMEOUT;
        __s32 BUSY;
        __s64 JS_EXPIRETIME;
        __s64 JS_TIMELIMIT;
        struct JS_DATA_TYPE JS_SAVE;
        struct JS_DATA_TYPE JS_CORR;
};

#ifdef __KERNEL__
#if BITS_PER_LONG == 64
#define JS_DATA_SAVE_TYPE JS_DATA_SAVE_TYPE_64
#elif BITS_PER_LONG == 32
#define JS_DATA_SAVE_TYPE JS_DATA_SAVE_TYPE_32
#else
#error Unexpected BITS_PER_LONG
#endif
#endif

#endif /* _LINUX_JOYSTICK_H */

and here is my hack to get this program to compile with joystick support...I just took out the '64' stuff.

Code:

#ifdef __KERNEL__
#if BITS_PER_LONG == 32
#define JS_DATA_SAVE_TYPE JS_DATA_SAVE_TYPE_32
#else
#error Unexpected BITS_PER_LONG
#endif
#endif

#endif /* _LINUX_JOYSTICK_H */

the reason I did this was because of the error message show in the config.log file
Code:

/usr/include/linux/joystick.h:131: error: expected specifier-qualifier-list before '__s64'
I'm wondering if this joystick.h error should be reported to someone... But who should be taking a look at this? I mean is it the kernel headers fault, autoconfs fault, or the fault of a bad configure.in file (ie the kxmame developers fault)?

I'm guessing probably the latter considering the problems with the GUI and the fact that I haven't seen this problem crop up thus far.

osor 11-03-2007 10:30 PM

Quote:

Originally Posted by shadowsnipes (Post 2947407)
I think I just fixed it by taking out all the '64' stuff (I figured it had something to do with 64-bit machines) at the end of the joystick.h file. At least it configured without the error...

This will work for you provided you are on a machine with 32 bits per long (e.g., x86).

The overall problem is in “/usr/include/asm/types.h” (that’s the file which should contain the typedef for __s64). The problem is that on most 32-bit architectures, there is no strict 64-bit integer type. The type long long is provided as a GNU extension (at least for C89). The header file for those architectures will neglect to define the types __s64 and __u64 if it thinks you want strict ANSI conformance (which negates any desired GNU extensions). Normally, this would not be a problem, but when the CFLAGS include the option “-std=iso9899:1990” (or anything similar), the compiler will try to conform to strict ANSI C. Thus, with that combination (architecture and CFLAGS) the error is thrown when a source file tries to use __s64 or __u64.

So as a conclusion (and for anyone else who has a similar problem), the fix you performed is safe on archs with 32-bit longs (you have to look at the un-sanitized header to see this, but you can take my word). If you don’t happen to have root privileges, a different fix you might perform is to edit the Makefile (and remove “-std=iso9899:1990” from the CFLAGS).

shadowsnipes 11-03-2007 11:31 PM

osor, thanks for the great explanation! I think editing the configure file is the best solution for anyone having this problem. I just took out the "-std=iso9899:1990" part like you said and it configured just fine! The makefile of course won't have that in there now, so the rest should be all good. I'll notify the kxmame developer about this.

Thanks again for your help. It was very educational.

shadowsnipes 11-04-2007 08:24 PM

Quote:

Originally Posted by osor (Post 2947431)
a different fix you might perform is to edit the Makefile (and remove “-std=iso9899:1990” from the CFLAGS).

osor, today I edited my Build Scripts to do this automatically and everything configured with no errors as it did yesterday, but it did not compile (I tried it manually as well and got the same results).

So, unfortunately, it looks like people with 32-bit machines will have to patch their joystick.h file in order to compile kxmame. I was hoping for a fix that wouldn't involve patches. Oh well.

If you or anyone else can think of another way please let me know.

thank you


All times are GMT -5. The time now is 07:26 PM.