Page 1 of 1

Does not compile with kernel 5.2.1

Posted: Sun Jul 21, 2019 3:48 pm
by mowgli
Today I updated my kernel to version 5.2.1. With that, I was not able to compile oss4 anymore. Searching for it does not gave me an idea how to fix it.

So currently I have a very quite workstation with only the fan is creating noise. OSS4 is the only working sound system for me and currently it is not.

I use oss4 on debian (devuan) linux using the dmo package to build my own module package. The current version is 4.2-build2019-dmo1 and, as already mentioned, I try to compile it on kernel 5.2.1. The last kernel, 4.20.17 was working well as well as kernel 5.1.16 on gentoo.

The relevant part from compiling is the following:

Code: Select all

# Build the modules
/usr/bin/make -C /usr/src/linux-5.2.1 M=/usr/src/modules/oss4/core modules
make[3]: Verzeichnis »/usr/src/linux-5.2.1« wird betreten
  CC [M]  /usr/src/modules/oss4/core/oss_core.o
/usr/src/modules/oss4/core/oss_core.c: In function 'oss_cmn_err':
/usr/src/modules/oss4/core/oss_core.c:726:1: warning: the frame size of 1056 bytes is larger than 1024 bytes [-Wframe-larger-than=]
 }
 ^
  CC [M]  /usr/src/modules/oss4/core/os_linux.o
In file included from ./include/linux/limits.h:6,
                 from /usr/include/x86_64-linux-gnu/bits/local_lim.h:38,
                 from /usr/include/x86_64-linux-gnu/bits/posix1_lim.h:161,
                 from /usr/include/limits.h:183,
                 from /usr/include/x86_64-linux-gnu/sys/param.h:26,
                 from /usr/src/modules/oss4/core/os.h:55,
                 from /usr/src/modules/oss4/core/oss_config.h:39,
                 from /usr/src/modules/oss4/core/os_linux.c:16:
./include/linux/types.h:15:26: error: conflicting types for 'fd_set'
 typedef __kernel_fd_set  fd_set;
                          ^~~~~~
In file included from /usr/include/x86_64-linux-gnu/sys/types.h:196,
                 from /usr/src/modules/oss4/core/os.h:54,
                 from /usr/src/modules/oss4/core/oss_config.h:39,
                 from /usr/src/modules/oss4/core/os_linux.c:16:
/usr/include/x86_64-linux-gnu/sys/select.h:70:5: note: previous declaration of 'fd_set' was here
   } fd_set;
     ^~~~~~
In file included from ./include/linux/limits.h:6,
                 from /usr/include/x86_64-linux-gnu/bits/local_lim.h:38,
                 from /usr/include/x86_64-linux-gnu/bits/posix1_lim.h:161,
                 from /usr/include/limits.h:183,
                 from /usr/include/x86_64-linux-gnu/sys/param.h:26,
                 from /usr/src/modules/oss4/core/os.h:55,
                 from /usr/src/modules/oss4/core/oss_config.h:39,
                 from /usr/src/modules/oss4/core/os_linux.c:16:
./include/linux/types.h:16:25: error: conflicting types for 'dev_t'
 typedef __kernel_dev_t  dev_t;
                         ^~~~~
In file included from /usr/src/modules/oss4/core/os.h:54,
                 from /usr/src/modules/oss4/core/oss_config.h:39,
                 from /usr/src/modules/oss4/core/os_linux.c:16:
/usr/include/x86_64-linux-gnu/sys/types.h:59:17: note: previous declaration of 'dev_t' was here
 typedef __dev_t dev_t;
                 ^~~~~
In file included from ./include/linux/limits.h:6,
                 from /usr/include/x86_64-linux-gnu/bits/local_lim.h:38,
                 from /usr/include/x86_64-linux-gnu/bits/posix1_lim.h:161,
                 from /usr/include/limits.h:183,
                 from /usr/include/x86_64-linux-gnu/sys/param.h:26,
                 from /usr/src/modules/oss4/core/os.h:55,
                 from /usr/src/modules/oss4/core/oss_config.h:39,
                 from /usr/src/modules/oss4/core/os_linux.c:16:
./include/linux/types.h:20:15: error: conflicting types for 'nlink_t'
 typedef u32   nlink_t;
               ^~~~~~~
In file included from /usr/src/modules/oss4/core/os.h:54,
                 from /usr/src/modules/oss4/core/oss_config.h:39,
                 from /usr/src/modules/oss4/core/os_linux.c:16:
/usr/include/x86_64-linux-gnu/sys/types.h:74:19: note: previous declaration of 'nlink_t' was here
 typedef __nlink_t nlink_t;
                   ^~~~~~~
In file included from ./include/linux/limits.h:6,
                 from /usr/include/x86_64-linux-gnu/bits/local_lim.h:38,
                 from /usr/include/x86_64-linux-gnu/bits/posix1_lim.h:161,
                 from /usr/include/limits.h:183,
                 from /usr/include/x86_64-linux-gnu/sys/param.h:26,
                 from /usr/src/modules/oss4/core/os.h:55,
                 from /usr/src/modules/oss4/core/oss_config.h:39,
                 from /usr/src/modules/oss4/core/os_linux.c:16:
./include/linux/types.h:26:26: error: conflicting types for 'timer_t'
 typedef __kernel_timer_t timer_t;
                          ^~~~~~~
In file included from /usr/include/x86_64-linux-gnu/sys/types.h:130,
                 from /usr/src/modules/oss4/core/os.h:54,
                 from /usr/src/modules/oss4/core/oss_config.h:39,
                 from /usr/src/modules/oss4/core/os_linux.c:16:
/usr/include/x86_64-linux-gnu/bits/types/timer_t.h:7:19: note: previous declaration of 'timer_t' was here
 typedef __timer_t timer_t;
                   ^~~~~~~
In file included from ./include/linux/limits.h:6,
                 from /usr/include/x86_64-linux-gnu/bits/local_lim.h:38,
                 from /usr/include/x86_64-linux-gnu/bits/posix1_lim.h:161,
                 from /usr/include/limits.h:183,
                 from /usr/include/x86_64-linux-gnu/sys/param.h:26,
                 from /usr/src/modules/oss4/core/os.h:55,
                 from /usr/src/modules/oss4/core/oss_config.h:39,
                 from /usr/src/modules/oss4/core/os_linux.c:16:
./include/linux/types.h:46:26: error: conflicting types for 'loff_t'
 typedef __kernel_loff_t  loff_t;
                          ^~~~~~
In file included from /usr/src/modules/oss4/core/os.h:54,
                 from /usr/src/modules/oss4/core/oss_config.h:39,
                 from /usr/src/modules/oss4/core/os_linux.c:16:
/usr/include/x86_64-linux-gnu/sys/types.h:42:18: note: previous declaration of 'loff_t' was here
 typedef __loff_t loff_t;
                  ^~~~~~
In file included from ./include/linux/limits.h:6,
                 from /usr/include/x86_64-linux-gnu/bits/local_lim.h:38,
                 from /usr/include/x86_64-linux-gnu/bits/posix1_lim.h:161,
                 from /usr/include/limits.h:183,
                 from /usr/include/x86_64-linux-gnu/sys/param.h:26,
                 from /usr/src/modules/oss4/core/os.h:55,
                 from /usr/src/modules/oss4/core/oss_config.h:39,
                 from /usr/src/modules/oss4/core/os_linux.c:16:
./include/linux/types.h:113:15: error: conflicting types for 'u_int64_t'
 typedef u64   u_int64_t;
               ^~~~~~~~~
In file included from /usr/src/modules/oss4/core/os.h:54,
                 from /usr/src/modules/oss4/core/oss_config.h:39,
                 from /usr/src/modules/oss4/core/os_linux.c:16:
/usr/include/x86_64-linux-gnu/sys/types.h:180:1: note: previous declaration of 'u_int64_t' was here
 __u_intN_t (64, __DI__);
 ^~~~~~~~~~
In file included from ./include/linux/limits.h:6,
                 from /usr/include/x86_64-linux-gnu/bits/local_lim.h:38,
                 from /usr/include/x86_64-linux-gnu/bits/posix1_lim.h:161,
                 from /usr/include/limits.h:183,
                 from /usr/include/x86_64-linux-gnu/sys/param.h:26,
                 from /usr/src/modules/oss4/core/os.h:55,
                 from /usr/src/modules/oss4/core/oss_config.h:39,
                 from /usr/src/modules/oss4/core/os_linux.c:16:
./include/linux/types.h:114:15: error: conflicting types for 'int64_t'
 typedef s64   int64_t;
               ^~~~~~~
In file included from /usr/include/x86_64-linux-gnu/sys/types.h:155,
                 from /usr/src/modules/oss4/core/os.h:54,
                 from /usr/src/modules/oss4/core/oss_config.h:39,
                 from /usr/src/modules/oss4/core/os_linux.c:16:
/usr/include/x86_64-linux-gnu/bits/stdint-intn.h:27:19: note: previous declaration of 'int64_t' was here
 typedef __int64_t int64_t;
                   ^~~~~~~
In file included from ./include/linux/limits.h:6,
                 from /usr/include/x86_64-linux-gnu/bits/local_lim.h:38,
                 from /usr/include/x86_64-linux-gnu/bits/posix1_lim.h:161,
                 from /usr/include/limits.h:183,
                 from /usr/include/x86_64-linux-gnu/sys/param.h:26,
                 from /usr/src/modules/oss4/core/os.h:55,
                 from /usr/src/modules/oss4/core/oss_config.h:39,
                 from /usr/src/modules/oss4/core/os_linux.c:16:
./include/linux/types.h:131:13: error: conflicting types for 'blkcnt_t'
 typedef u64 blkcnt_t;
             ^~~~~~~~
In file included from /usr/src/modules/oss4/core/os.h:54,
                 from /usr/src/modules/oss4/core/oss_config.h:39,
                 from /usr/src/modules/oss4/core/os_linux.c:16:
/usr/include/x86_64-linux-gnu/sys/types.h:209:20: note: previous declaration of 'blkcnt_t' was here
 typedef __blkcnt_t blkcnt_t;  /* Type to count number of disk blocks.  */
                    ^~~~~~~~
In file included from /usr/include/stdint.h:37,
                 from /usr/lib/gcc/x86_64-linux-gnu/8/include/stdint.h:9,
                 from /usr/src/modules/oss4/core/oss_ddi.h:35,
                 from /usr/src/modules/oss4/core/os.h:58,
                 from /usr/src/modules/oss4/core/oss_config.h:39,
                 from /usr/src/modules/oss4/core/os_linux.c:16:
/usr/include/x86_64-linux-gnu/bits/stdint-uintn.h:27:20: error: conflicting types for 'uint64_t'
 typedef __uint64_t uint64_t;
                    ^~~~~~~~
In file included from ./include/linux/limits.h:6,
                 from /usr/include/x86_64-linux-gnu/bits/local_lim.h:38,
                 from /usr/include/x86_64-linux-gnu/bits/posix1_lim.h:161,
                 from /usr/include/limits.h:183,
                 from /usr/include/x86_64-linux-gnu/sys/param.h:26,
                 from /usr/src/modules/oss4/core/os.h:55,
                 from /usr/src/modules/oss4/core/oss_config.h:39,
                 from /usr/src/modules/oss4/core/os_linux.c:16:
./include/linux/types.h:112:15: note: previous declaration of 'uint64_t' was here
 typedef u64   uint64_t;
               ^~~~~~~~
/usr/src/modules/oss4/core/os_linux.c: In function 'osdev_create_201903060654':
/usr/src/modules/oss4/core/os_linux.c:162:10: warning: assignment discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers]
  devpath = oss_pci_read_devpath (osdev->dip);
          ^
make[4]: *** [scripts/Makefile.build:279: /usr/src/modules/oss4/core/os_linux.o] Fehler 1
make[3]: *** [Makefile:1595: _module_/usr/src/modules/oss4/core] Fehler 2
make[3]: Verzeichnis »/usr/src/linux-5.2.1« wird verlassen
make[2]: *** [debian/rules:46: binary-modules] Fehler 2
make[2]: Verzeichnis »/usr/src/modules/oss4« wird verlassen
make[1]: *** [/usr/share/modass/include/common-rules.make:56: kdist_build] Fehler 2
make[1]: Verzeichnis »/usr/src/modules/oss4« wird verlassen
Module /usr/src/modules/oss4 failed.


Any idea how to fix that?

Re: Does not compile with kernel 5.2.1

Posted: Thu Oct 10, 2019 9:01 pm
by seawright
Just had the same problem.
This patch should fix it:

Code: Select all

--- setup/Linux/oss/build/Makefile.osscore
+++ setup/Linux/oss/build/Makefile.osscore
@@ -5,6 +5,7 @@ EXTRA_CFLAGS += -I${OSSLIBDIR}/include/internals -I${OSSLIBDIR}/include/sys
 ifneq ($(KERNELRELEASE),)
 
    obj-m := osscore.o
+   osscore-objs := osscore_lnk.o osscore_mainline.o
 
 else
 
--- setup/Linux/oss/build/Makefile.tmpl
+++ setup/Linux/oss/build/Makefile.tmpl
@@ -5,6 +5,7 @@ EXTRA_CFLAGS += -I${OSSLIBDIR}/include/internals -I${OSSLIBDIR}/include/sys
 ifneq ($(KERNELRELEASE),)
 
    obj-m := MODNAME.o
+   MODNAME-objs := MODNAME_lnk.o MODNAME_mainline.o
 
 else
 
--- setup/Linux/oss/build/install.sh
+++ setup/Linux/oss/build/install.sh
@@ -179,6 +179,7 @@ then
 fi
 
 cp -f ../objects/osscore.o osscore_mainline.o
+ln -s osscore.c osscore_lnk.c
 
 rm -f Makefile
 ln -s Makefile.osscore Makefile
@@ -203,11 +204,8 @@ then
    exit 3
 fi
 
-if ! $LD -r osscore.ko osscore_mainline.o -o /lib/modules/$UNAME/kernel/oss/osscore.ko
-then
-   echo Linking the osscore module failed
-   exit 5
-fi
+cp -f osscore.ko /lib/modules/$UNAME/kernel/oss/
+rm -f osscore_lnk.c
 
 if test -f Module.symvers
 then
@@ -228,10 +226,11 @@ do
    N=`basename $n .o`
    echo Building module $N
 
-   rm -f $N_mainline.o Makefile
+   rm -f $N\_mainline.o  $N\_lnk.c Makefile
 
-   sed "s/MODNAME/$N/" < Makefile.tmpl > Makefile
-   ln -s $n $N_mainline.o
+   sed "s/MODNAME/$N/g" < Makefile.tmpl > Makefile
+   ln -s $N.c $N\_lnk.c
+   ln -s $n $N\_mainline.o
 
    if ! make KERNELDIR=$KERNELDIR > build.list 2>&1
    then
@@ -240,13 +239,9 @@ do
       exit 4
    fi
 
-   if ! $LD -r $N.ko $N_mainline.o -o /lib/modules/$UNAME/kernel/oss/$N.ko
-   then
-      echo Linking $N module failed
-      exit 6
-   fi
-
-   rm -f $N_mainline.o
+   cp -f $N.ko /lib/modules/$UNAME/kernel/oss/
+   rm -f $N\_mainline.o
+   rm -f $N\_lnk.c
    make clean
 done
 

Copy the above code (or download it from: https://pastebin.com/smEYpXJW ) and save it as oss521fix.patch
then navigate to the oss directory (usually /usr/lib/oss).

As root run:
patch -p3 </path_to_patch_file/oss521fix.patch
cd build
/bin/bash install.sh &&soundon

Providing no errors were encountered revert back to normal user and test sound using osstest or any sound player that can use oss or oss4 as an output mode.

If building oss from source the patch could be applied to "setup/Linux/oss/build/" directory in the source tree.

Re: Does not compile with kernel 5.2.1

Posted: Sat Oct 26, 2019 4:15 pm
by fr314159
Thanks for the patch. It works with kernel-5.3.0.

However, for some reason the patch would not apply to the OSS source and I had to manually edit the source files to apply the changes.

Also, the file os_cmd/Linux/ossdetect/ossdetect.c needs the line " #include <sys/sysmacros.h>" added or else the compilation will fail due to lack of reference to "makedev."

I hope that your patch will also work with the upcoming kernel-5.4.

Re: Does not compile with kernel 5.2.1

Posted: Tue Oct 29, 2019 9:23 pm
by seawright
Have amended patch to remove a stale symlink which could exist in build directory under fault conditions.
Don't know why you had difficulty applying patch to source tree but two possibilities:
  1. Wrong value in patch -p... option. Only -p3 in oss directory.
  2. Windows line endings in patch file. If downloaded from pastebin
    open as oss521fix.txt and save as oss521fix.patch with Unix line endings.
As to whether it will work on kernel version 5.4, the short answer is I don't know.
It's pointless testing it on a release candidate.