Kernel module compilation failed: asm-generic/types.h: No such file or directory

Hi,

I want compile the latest Mellanox drivers (Mellanox Products: ConnectX version 1.5.10) to get the best support for the QSFP Mellanox ConnectX-3 card.

I am using openSUSE 12.3 with all updates installed (19.04.2013).

When executing the install.sh script the Mellanox drivers try to compile a kernel module but that fails with the message:
/usr/src/linux-3.7.10-1.1/arch/x86/include/asm/types.h:4:31: fatal error: asm-generic/types.h: No such file or directory
compilation terminated.

The types.h that includes the missing header files are not from Mellanox so I guess it is an opensuse related problem.
Any ideas?

Uli

On 2013-04-19 16:06, uvoigt wrote:

> When executing the install.sh script the Mellanox drivers try to
> compile a kernel module but that fails with the message:
> /usr/src/linux-3.7.10-1.1/arch/x86/include/asm/types.h:4:31: fatal
> error: asm-generic/types.h: No such file or directory
> compilation terminated.

I have 12.1 and I have that file:


/usr/include/asm-generic/types.h
/usr/src/linux-3.1.10-1.16/include/asm-generic/types.h
/usr/src/linux-3.1.10-1.19/include/asm-generic/types.h


Cheers / Saludos,

Carlos E. R.
(from 12.1 x86_64 “Asparagus” at Telcontar)

On 04/19/2013 04:06 PM, uvoigt wrote:
> I guess it is an opensuse related problem.
> Any ideas?

have you installed the source for your kernel, and the “Base
Development” and “C/C++ Development” patterns

those are default installed by some linux distros, but not this one…


dd
openSUSE®, the “German Engineered Automobile” of operating systems!
http://tinyurl.com/DD-Caveat

Try


cd /usr/src/linux
make oldconfig
make prepare

I see src.rpms and installer inside a tar file on that page. Don’t they work ?

mstflint-1.4mlnx4-1.21.gd948ddd.src.rpm
mlnx_en-1.5.10-1.src.rpm
mellanox-mlnx-en-1.5.10-1.src.rpm

This file is contained in the package “kernel-devel”. Please install that first.

And maybe you would also need “kernel-desktop-devel”. (or the corresponding one if you use a different kernel, e.g. “kernel-default-devel” if you’re using “kernel-default”)

Yes, I have installed the kernel sources (kernel-default, kernel-default-devel, kernel-devel, kernel-source).
And I also installed the patterns. But the problem still exist.

Thanks. But it didn’t help.

The install.sh script installs the sources and compiles the module. But compiling fails with the given message. So the source rpm “work” but compiling not.

Thanks. I am using kernel-default and I have also installed kernel-default-devel. But the given file above is missing.

On 05/02/2013 10:56 AM, uvoigt wrote:
>
> wolfi323;2549147 Wrote:
>> This file is contained in the package “kernel-devel”. Please install
>> that first.
>>
>> And maybe you would also need “kernel-desktop-devel”. (or the
>> corresponding one if you use a different kernel, e.g.
>> “kernel-default-devel” if you’re using “kernel-default”)
>
> Thanks. I am using kernel-default and I have also installed
> kernel-default-devel. But the given file above is missing.

That file, among others, got moved to “include/uapi/asm-generic/types.h” a few
kernel versions ago. Your supplier needs to update their driver to handle the
change.

The missing file asm-generic/types.h is included from the existing /usr/src/linux-3.7.10-1.1/arch/x86/include/asm/types.h.
That makes me think that the problem is in the kernel header file /usr/src/linux-3.7.10-1.1/arch/x86/include/asm/types.h and not in the mellanox sources?

On my system the file is there:

wolfi@amiga:~> rpm -qf /usr/include/asm-generic/types.h
linux-glibc-devel-3.7.1-2.1.3.noarch

So check if you have “linux-glibc-devel” installed…

linux-glibc-devel is installed. The file /usr/include/asm-generic/types.h is available on the system.
I think the asm-generic/types.h is not searched in /usr/include but in /usr/src/linux-3.7.10-1.1/arch/x86/ ?

The mellanox install.sh script create a logfile. (I have removed some output of the tar command so that it is possbile to post it here).
Maybe that helps:


Starting installation at Fri May  3 12:24:19 UTC 2013...
EXEC: /bin/rm -rf /tmp/MLNX_EN
EXEC: /bin/mkdir /tmp/MLNX_EN
EXEC: /bin/mkdir /tmp/MLNX_EN/BUILD
EXEC: /bin/mkdir /tmp/MLNX_EN/SRPMS
EXEC: /bin/mkdir /tmp/MLNX_EN/RPMS
EXEC: /bin/mkdir /tmp/MLNX_EN/SOURCES
EXEC: rpmbuild --rebuild --define '_dist .unsupported' --define '_target_cpu x86_64' --define '_topdir /tmp/MLNX_EN' --define 'sysctl_update 1' --define 'MEMTRACK 0' /home/gdrx/mlx/mlnx_en-1.5.10/SRPMS/mellanox-mlnx-en-1.5.10-1.src.rpm
warning: user eugenia does not exist - using root
warning: group libuuid does not exist - using root
...
warning: user eugenia does not exist - using root
warning: group libuuid does not exist - using root
Installing /home/gdrx/mlx/mlnx_en-1.5.10/SRPMS/mellanox-mlnx-en-1.5.10-1.src.rpm
Executing(%prep): /bin/sh -e /var/tmp/rpm-tmp.QSYyLW
+ umask 022
+ cd /tmp/MLNX_EN/BUILD
+ cd /tmp/MLNX_EN/BUILD
+ rm -rf mellanox-mlnx-en-1.5.10
+ /usr/bin/gzip -dc /tmp/MLNX_EN/SOURCES/mellanox-mlnx-en-1.5.10.tgz
+ /bin/tar -xvvf -
.....
+ STATUS=0
+ '' 0 -ne 0 ']'
+ cd mellanox-mlnx-en-1.5.10
+ /usr/bin/chmod -Rf a+rX,u+w,g-w,o-w .
+ set -- LICENSE MLNX_EN_Linux_README.txt MLNX_EN_Linux_Release_Notes.txt Makefile config.mk drivers include kernel_addons kernel_patches makefile mellanox-mlnx-en.spec ofed_scripts scripts
+ mkdir source
+ mv LICENSE MLNX_EN_Linux_README.txt MLNX_EN_Linux_Release_Notes.txt Makefile config.mk drivers include kernel_addons kernel_patches makefile mellanox-mlnx-en.spec ofed_scripts scripts source/
+ mkdir obj
+ exit 0
Executing(%build): /bin/sh -e /var/tmp/rpm-tmp.OD27gD
+ umask 022
+ cd /tmp/MLNX_EN/BUILD
+ /usr/bin/rm -rf /tmp/MLNX_EN/BUILDROOT/mellanox-mlnx-en-1.5.10-1.x86_64
++ dirname /tmp/MLNX_EN/BUILDROOT/mellanox-mlnx-en-1.5.10-1.x86_64
+ /usr/bin/mkdir -p /tmp/MLNX_EN/BUILDROOT
+ /usr/bin/mkdir /tmp/MLNX_EN/BUILDROOT/mellanox-mlnx-en-1.5.10-1.x86_64
+ cd mellanox-mlnx-en-1.5.10
+ rm -rf /tmp/MLNX_EN/BUILDROOT/mellanox-mlnx-en-1.5.10-1.x86_64
+ export 'EXTRA_CFLAGS=-DVERSION=\"1.5.10\"'
+ EXTRA_CFLAGS='-DVERSION=\"1.5.10\"'
+ for flavor in default
+ rm -rf obj/default
+ cp -r source obj/default
+ cd /tmp/MLNX_EN/BUILD/mellanox-mlnx-en-1.5.10/obj/default
+ export KSRC=/usr/src/linux-obj/x86_64/default
+ KSRC=/usr/src/linux-obj/x86_64/default
++ make -C /usr/src/linux-obj/x86_64/default kernelrelease
++ grep -v make
+ export KVERSION=3.7.10-1.1-default
+ KVERSION=3.7.10-1.1-default
+ ./scripts/mlnx_en_patch.sh
Quilt  does not exist... Going to use patch.
mkdir -p /tmp/MLNX_EN/BUILD/mellanox-mlnx-en-1.5.10/obj/default/patches
touch /tmp/MLNX_EN/BUILD/mellanox-mlnx-en-1.5.10/obj/default/patches/quiltrc
Created config.mk:
KVERSION=3.7.10-1.1-default
ARCH=x86_64
MODULES_DIR:=/lib/modules/3.7.10-1.1-default/updates
KSRC:=/lib/modules/3.7.10-1.1-default/build
CWD=/tmp/MLNX_EN/BUILD/mellanox-mlnx-en-1.5.10/obj/default
BACKPORT_INCLUDES:=
MLNX_EN_EXTRA_CFLAGS:=
CONFIG_MEMTRACK:=
+ make KSRC=/usr/src/linux-obj/x86_64/default V=0
Building kernel modules
Kernel version: 3.7.10-1.1-default
Modules directory: /lib/modules/3.7.10-1.1-default/updates
Kernel sources: /usr/src/linux-obj/x86_64/default
env CWD=/tmp/MLNX_EN/BUILD/mellanox-mlnx-en-1.5.10/obj/default BACKPORT_INCLUDES= \
    make -C /usr/src/linux-obj/x86_64/default SUBDIRS="/tmp/MLNX_EN/BUILD/mellanox-mlnx-en-1.5.10/obj/default" \
    V=0  \
    CONFIG_MEMTRACK= \
    CONFIG_MLX4_CORE=m \
    CONFIG_MLX4_EN=m \
    LINUXINCLUDE=' \
    -include /usr/src/linux-obj/x86_64/default/include/generated/autoconf.h \
    -include /tmp/MLNX_EN/BUILD/mellanox-mlnx-en-1.5.10/obj/default/include/linux/autoconf.h \
     \
     \
     \
     \
     \
    -I/tmp/MLNX_EN/BUILD/mellanox-mlnx-en-1.5.10/obj/default/include \
    $(if $(CONFIG_XEN),-D__XEN_INTERFACE_VERSION__=$(CONFIG_XEN_INTERFACE_VERSION)) \
    $(if $(CONFIG_XEN),-I$(srctree)/arch/x86/include/mach-xen) \
    -I$(srctree)/arch/$(hdr-arch)/include \
    -Iinclude \
    $(if $(KBUILD_SRC),-Iinclude2 -I$(srctree)/include) \
    -I$(srctree)/arch/$(SRCARCH)/include \
    ' \
    modules
make[1]: Entering directory `/usr/src/linux-3.7.10-1.1-obj/x86_64/default'
  CC [M]  /tmp/MLNX_EN/BUILD/mellanox-mlnx-en-1.5.10/obj/default/drivers/infiniband/hw/mlx4/main.o
In file included from /usr/src/linux-3.7.10-1.1/include/uapi/linux/types.h:4:0,
                 from /usr/src/linux-3.7.10-1.1/include/linux/types.h:5,
                 from /usr/src/linux-3.7.10-1.1/include/linux/list.h:4,
                 from /usr/src/linux-3.7.10-1.1/include/linux/module.h:9,
                 from /tmp/MLNX_EN/BUILD/mellanox-mlnx-en-1.5.10/obj/default/drivers/infiniband/hw/mlx4/main.c:33:
/usr/src/linux-3.7.10-1.1/arch/x86/include/asm/types.h:4:31: fatal error: asm-generic/types.h: No such file or directory
compilation terminated.
make[5]: *** [/tmp/MLNX_EN/BUILD/mellanox-mlnx-en-1.5.10/obj/default/drivers/infiniband/hw/mlx4/main.o] Error 1
make[4]: *** [/tmp/MLNX_EN/BUILD/mellanox-mlnx-en-1.5.10/obj/default/drivers/infiniband/hw/mlx4] Error 2
make[3]: *** [_module_/tmp/MLNX_EN/BUILD/mellanox-mlnx-en-1.5.10/obj/default] Error 2
make[2]: *** [sub-make] Error 2
make[1]: *** [all] Error 2
make[1]: Leaving directory `/usr/src/linux-3.7.10-1.1-obj/x86_64/default'
make: *** [kernel] Error 2
error: Bad exit status from /var/tmp/rpm-tmp.OD27gD (%build)


RPM build errors:
    user eugenia does not exist - using root
    group libuuid does not exist - using root
...
    user eugenia does not exist - using root
    group libuuid does not exist - using root
    Bad exit status from /var/tmp/rpm-tmp.OD27gD (%build)

Hm. /usr/src/linux-3.7.10-1.1/arch/x86/include/asm/types.h contains

#include <asm-generic/types.h>

which means asm-generic/types.h is looked for in the standard include path, which /usr/include/ should be part of normally.

Well, I just tried to compile this on my system. Manually adding -I/usr/include to the compiler options in the makefile did fix this error, but I get tons of other ones now… (they don’t even fit in my konsole window buffer)

So I guess your out of luck here, sorry.:expressionless:

From the README:

  1. Supported Platforms, Operating Systems and Firmware
    ======================================================
    o CPU architectures:
    - x86_64
    - x86
    • power-pc
      o Linux Operating Systems:
      • RedHat EL5.8
      • RedHat EL5.9
      • RedHat EL6.2
      • RedHat EL6.3
    • OEL6.2 + 2.6.32-279.19.1
    • OEL6.3 + 2.6.32-279.19.1
      • SLES11 SP1
      • SLES11 SP2

So this seems to be quite old (for kernel 2.6.32/3.0)…

Do you really need this self-compiled driver? Kernel 3.7.10 as shipped with openSUSE 12.3 already includes mlx4_core.ko and mlx4_en.ko, do they not work for you?

Thanks a lot for confirming and your hints!!!

I have some mysterious problems. By default the mlx4_core provides an infiniband adapter.

To get an ethernet adapter I have added a module parameter to /etc/modprobe.d/99-local.conf:

options mlx4_core port_type_array=2,2

The parameter is described in

modinfo mlx4_core

But it does not work and I don’t have any idea why.

After booting the module mlx4_core is loaded with the configured port_type_array parameter.


# cat /sys/module/mlx4_core/parameters/port_type_array
2,2

But anyhow the infiniband adapter is used as default:


# cat /sys/bus/pci/devices/0000\:07\:00.0/mlx4_port1
auto (ib)

The only solution is to configure it manually


# echo eth > /sys/bus/pci/devices/0000\:07\:00.0/mlx4_port1
# modprobe mlx4_en

Seems like I have to contact Mellanox…

Can’t help you there I’m afraid.
Maybe you can somehow set the default to ethernet? (perhaps in BIOS, via a hardware switch or a vendor tool)
Or maybe a newer kernel would help?

Seems like I have to contact Mellanox…

I think this would be the best.