site  contact  subhomenews

The 'scsi.h' problem

April 26, 2011 — BarryK
I have agonized over this for a long time. The header files in /usr/include/scsi and /usr/src/linux*/include/scsi are not compatible.

If you compile the Linux kernel, like this:

# make
# make install_modules
# make install_headers


The last step creates /usr/src/linux*/usr/include, which is used to create the linux-headers package. When a Linux distro is built, these Linux headers get installed in /usr/include.

Glibc also has headers in /usr/include. The problem is that both glibc and linux-headers have /usr/include/scsi/ -- and the 'scsi.h' file of each are not compatible!

So, when a distro is built, what ends up as /usr/include/scsi/scsi.h depends on which order glibc and linux-headers is added to the build.

It seems that the scsi.h in glibc does match very old kernels, but at some point the Linux developers changed scsi.h -- there is a structure in that file with different fields.

This causes trouble, for example the 'udev' package must have the kernel's /usr/include/scsi/scsi.h (I don't know if it can be configured to look in /usr/src/linux*/include instead), whereas most packages want the glib's scsi.h.

Will these different scsi.h files cause a problem in a running system, if one executable is compiled against one of them, another executable against the other? I don't know. I was wondering if the mismatch could be causing CD/DVD access problems. This issue is not explained anywhere, but the glibc docs does state this:

Note that `/usr/include/net' and `/usr/include/scsi' should *not* be
symlinks into the kernel sources. GNU libc provides its own versions
of these files.


To me, it would seem more reasonable if glibc used the kernel's scsi.h, <cynical>but then that would be too simple wouldn't it?</cynical>. Maybe I'm worrying unnecessarily.

Comments

Re the 'scsi.h' problem
Username: BarryK
Quote from LFS: [i]The header ../glibc-2.11.1/sysdeps/unix/sysv/linux/scsi/scsi.h already exists in /usr/include/scsi and is owned by linux-headers. The install script tries to replace it with a glibc version. The glibc version has to be installed. Otherwise corresponding binaries will not be installed and compilation of util-linux package will fail later. Hence remove as root rm -v /usr/include/scsi/scsi.h[/i] I was reminded of this old problem just now, as I am doing a compile in T2, and glibc failed with report that 'linux-headers' had already installed a file /usr/include/scsi/scsi.h. So, I renamed the scsi.h file, also in build/..../var/adm/logs/linux-header The glibc headers must have preference.

LFS link
Username: BarryK
"The LFS link: http://permalink.gmane.org/gmane.linux.lfs.devel/10357


Tags: puppy