Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 6 Jul 2000 16:41:14 -0600
From:      "Kenneth D. Merry" <ken@kdm.org>
To:        current@FreeBSD.ORG
Cc:        cg@FreeBSD.ORG
Subject:   module compile problems, partial fix attached
Message-ID:  <20000706164114.A26172@panzer.kdm.org>

next in thread | raw e-mail | index | archive | help

--M9NhX3UHpAaciwkO
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline


I've got a source tree with -current from today, and I'm trying to build a
kernel using that source on a machine running -current from about June
10th.

I'm using a config built from the tree in question, so I know that's up to
date.

Anyway, I'm running into problems building the sound modules modules,
since it seems that the sound modules are one directory level deeper than
any other modules, and the sys directory search process in bsd.kmod.mk
wasn't updated to take that into account.

The result is that the build for the sound modules on my system is looking
in /usr/src (which is symlinked to /a/src) on my machine, which doesn't
contain an up-to-date -current.

This is from the sys/compile/MACHINE/modules/..../sound/drivers/ad1816
directory:

total 19
drwx------   2 ken  wheel   512 Jul  6 15:20 ./
drwx------  17 ken  wheel   512 Jul  6 14:59 ../
-rw-------   1 ken  wheel  1490 Jul  6 15:00 .depend
lrwx------   1 ken  wheel    10 Jul  6 15:00 @@ -> /a/src/sys
-rw-------   1 ken  wheel  7297 Jul  6 15:00 bus_if.h
-rw-------   1 ken  wheel  2069 Jul  6 15:00 device_if.h
-rw-------   1 ken  wheel  1570 Jul  6 15:00 isa_if.h
lrwx------   1 ken  wheel    23 Jul  6 15:00 machine@ -> /a/src/sys/i386/include
-rw-------   1 ken  wheel  1140 Jul  6 15:00 pci_if.h

/a/src isn't the tree that the modules are being compiled from, but rather
another, older -current tree.

This causes the sound modules to blow up:

=============================================================================
===> sound/driver
===> sound/driver/ad1816
cc -O -pipe  -D_KERNEL -Wall -Wredundant-decls -Wnested-externs -Wstrict-prototypes  -Wmissing-prototypes -Wpointer-arith -Winline -Wcast-qual  -fformat-extensions -ansi -DKLD_MODULE -nostdinc -I-  -I. -I@ -I@/../include  -mpreferred-stack-boundary=2 -c /a/ken/perforce/cam/sys/modules/sound/driver/ad1816/../../../../dev/sound/isa/ad1816.c
/a/ken/perforce/cam/sys/modules/sound/driver/ad1816/../../../../dev/sound/isa/ad1816.c:623: `PCM_MINVER' undeclared here (not in a function)
/a/ken/perforce/cam/sys/modules/sound/driver/ad1816/../../../../dev/sound/isa/ad1816.c:623: initializer element is not constant
/a/ken/perforce/cam/sys/modules/sound/driver/ad1816/../../../../dev/sound/isa/ad1816.c:623: (near initialization for `_snd_ad1816_depend_on_snd_pcm.md_ver_minimum')
/a/ken/perforce/cam/sys/modules/sound/driver/ad1816/../../../../dev/sound/isa/ad1816.c:623: `PCM_PREFVER' undeclared here (not in a function)
/a/ken/perforce/cam/sys/modules/sound/driver/ad1816/../../../../dev/sound/isa/ad1816.c:623: initializer element is not constant
/a/ken/perforce/cam/sys/modules/sound/driver/ad1816/../../../../dev/sound/isa/ad1816.c:623: (near initialization for `_snd_ad1816_depend_on_snd_pcm.md_ver_preferred')
/a/ken/perforce/cam/sys/modules/sound/driver/ad1816/../../../../dev/sound/isa/ad1816.c:623: `PCM_MAXVER' undeclared here (not in a function)
/a/ken/perforce/cam/sys/modules/sound/driver/ad1816/../../../../dev/sound/isa/ad1816.c:623: initializer element is not constant
/a/ken/perforce/cam/sys/modules/sound/driver/ad1816/../../../../dev/sound/isa/ad1816.c:623: (near initialization for `_snd_ad1816_depend_on_snd_pcm.md_ver_maximum')
*** Error code 1

Stop in /a/ken/perforce/cam/sys/modules/sound/driver/ad1816.
*** Error code 1

Stop in /a/ken/perforce/cam/sys/modules/sound/driver.
*** Error code 1

Stop in /a/ken/perforce/cam/sys/modules/sound.
*** Error code 1

Stop in /a/ken/perforce/cam/sys/modules.
*** Error code 1

Stop in /a/ken/perforce/cam/sys/compile/sphere.
=============================================================================

I suspect that the problem is the depth of the sound driver module tree and
the method that bsd.kmod.mk uses to determine where the sys directory is.

sys/modules/sound/driver/ad1816/Makefile includes bsd.kmod.mk, which does
the following to find the "sys" directory:

# Search for kernel source tree in standard places.
.for _dir in ${.CURDIR}/../.. ${.CURDIR}/../../.. /sys /usr/src/sys
.if !defined(SYSDIR) && exists(${_dir}/kern/) && exists(${_dir}/conf/)
SYSDIR= ${_dir}
.endif
.endfor
.if !defined(SYSDIR) || !exists(${SYSDIR}/kern/) || !exists(${SYSDIR}/conf/)
.error "can't find kernel source tree"
.endif

.include "${SYSDIR}/conf/kmod.mk"

Note that it checks two directories up, and three directories up from the
current directory for a sys directory, but the ad1816 module is actually
four directories down from the top level sys directory.

So the 'kern' and 'conf' directories are not found, and the search then
looks in /sys and /usr/src/sys, which is the wrong thing to do on this
system.

The fix for this is to include the directory four levels higher than the
current directory in the search path in bsd.kmod.mk, above.

The problem with this fix is that it only works after you've done an
installworld or manually installed bsd.kmod.mk, because the module build
uses the system's bsd.kmod.mk from /usr/share/mk instead of attempting to
pull in bsd.kmod.mk from the source tree that is being used to build the
kernel.  (If it is available.)

So the attached patch is a fix, but it isn't a complete fix.

For the complete fix, we need to attempt to pull in mk files from the share
directory in the source tree that is being used to build the kernel.

Ken
-- 
Kenneth Merry
ken@kdm.org

--M9NhX3UHpAaciwkO
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename="bsd.kmod.mk.20000706"

==== //depot/cam/share/mk/bsd.kmod.mk#19 - /a/ken/perforce/cam/share/mk/bsd.kmod.mk ====
*** /tmp/tmp.42230.0	Thu Jul  6 16:36:52 2000
--- /a/ken/perforce/cam/share/mk/bsd.kmod.mk	Thu Jul  6 16:18:04 2000
***************
*** 1,7 ****
  # $FreeBSD: src/share/mk/bsd.kmod.mk,v 1.84 2000/05/27 01:11:17 peter Exp $
  
  # Search for kernel source tree in standard places.
! .for _dir in ${.CURDIR}/../.. ${.CURDIR}/../../.. /sys /usr/src/sys
  .if !defined(SYSDIR) && exists(${_dir}/kern/) && exists(${_dir}/conf/)
  SYSDIR=	${_dir}
  .endif
--- 1,7 ----
  # $FreeBSD: src/share/mk/bsd.kmod.mk,v 1.84 2000/05/27 01:11:17 peter Exp $
  
  # Search for kernel source tree in standard places.
! .for _dir in ${.CURDIR}/../.. ${.CURDIR}/../../.. ${.CURDIR}/../../../.. /sys /usr/src/sys
  .if !defined(SYSDIR) && exists(${_dir}/kern/) && exists(${_dir}/conf/)
  SYSDIR=	${_dir}
  .endif

--M9NhX3UHpAaciwkO--


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-current" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20000706164114.A26172>