[openib-general] how to specify compiler during modules build

Brian J. Murrell brian at clusterfs.com
Fri Jan 5 07:57:26 PST 2007


Hi All,

I have successfully integrated the building of the openib RPMs into our
kernel build process with one exception... specification of which
compiler to use to build the modules in kernel-ib.

For many reasons, we cannot simply use the default "gcc" compiler on
many O/Ses as we have our own kernel patches that prevent the use of
gcc4 (for example), so we must force the building of our kernel with
gcc32 (for example).

There does not seem to be any provision though to specify which kernel
the openib build process uses.  I had to hack it into the build process
with a patch in the RPM:

--- Makefile.orig       2007-01-05 15:01:26.000000000 +0000
+++ Makefile    2007-01-05 14:54:29.000000000 +0000
@@ -47,7 +47,7 @@
        env EXTRA_CFLAGS="$(OPENIB_KERNEL_EXTRA_CFLAGS) $(KERNEL_MEMTRACK_CFLAGS) -I$(CWD)/include -I$(CWD)/drivers/infiniband/include \
                -I$(CWD)/drivers/infiniband/ulp/ipoib \
                -I$(CWD)/drivers/infiniband/debug" \
-       $(MAKE) -C $(KSRC) SUBDIRS="$(CWD)/drivers/infiniband" KERNELRELEASE=$(KVERSION) \
+       $(MAKE) -C $(KSRC) CC=gcc32 SUBDIRS="$(CWD)/drivers/infiniband" KERNELRELEASE=$(KVERSION) \
                EXTRAVERSION=$(EXTRAVERSION) V=1 $(WITH_MAKE_PARAMS) \
                CONFIG_INFINIBAND=$(CONFIG_INFINIBAND) \
                CONFIG_INFINIBAND_IPOIB=$(CONFIG_INFINIBAND_IPOIB) \

Of course, I have hardcoded in my gcc32, but a more elegant, complete
solution would allow that to be specified by the caller.

In fact it seems like a good idea for the linux kernel in general, to
cache the value of the CC that was used to build a tree when it has
targets built in the tree -- that way any other module building process
external to the tree would use the same compiler.  Probably this cache
would be cleared with either a clean or distclean (mrclean still?).  But
this is a topic for another ML.  :-)

What are your thoughts on devising some way of passing the CC to build
the kernel modules in through the RPM spec file?

Cheers,
b.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
URL: <http://lists.openfabrics.org/pipermail/general/attachments/20070105/abf647f1/attachment.sig>


More information about the general mailing list