unable to compile matrixMulDrv in 64bit linux

hello, this maybe a simple question but I just don’t know how to deal with it.

Compiling matrixMulDrv sample project failed under Ubuntu 8.04 64bit:

make[1]: Entering directory /home/yliu/Workspace/CUDA/sdk/projects/matrixMulDrv' In file included from /usr/include/features.h:354, from /home/yliu/Workspace/CUDA/cuda/bin/../include/host_config.h:53, from /home/yliu/Workspace/CUDA/cuda/bin/../include/cuda_runtime.h:45, from <command-line>:0: /usr/include/gnu/stubs.h:7:27: error: gnu/stubs-32.h: No such file or directory make[1]: *** [data/matrixMul_kernel.cubin] Error 255 make[1]: Leaving directory /home/yliu/Workspace/CUDA/sdk/projects/matrixMulDrv’
make: *** [projects/matrixMulDrv/Makefile.ph_build] Error 2

Any help?


Besides the fact that Ubuntu-8.04 isn’t supported, it looks like you’re missing the 32bit compatibility glibc (which is where gnu/stubs-32.h comes from) package.

Looks like you need 32-bit compatibility libraries. The package name is distro dependent, but shouldn’t be hard to find.

you’ll hit problems with gcc 4.3–install gcc 4.2 and use that for CUDA.

Thanks, I have checked /usr/include/gnu/stubs.h:

/* This file selects the right generated file of `__stub_FUNCTION’ macros

based on the architecture being compiled for. */

#include <bits/wordsize.h>

#if __WORDSIZE == 32

include <gnu/stubs-32.h>

#elif __WORDSIZE == 64

include <gnu/stubs-64.h>


error “unexpected value for __WORDSIZE macro”


I guess on 64bit machine the macro __WORDSIZE should have value 64. But when compiling, stubs-32.h is required, which means __WORDSIZE is 32. That’s why I feel confused. I am wondering where can I pass in some parameters to let system know __WORDSIZE should have value 64. I used to do coding under windows and just started working on linux, so please don’t angry with my possible simple/stupid questions. :">

By the way, I am using gcc 4.2.3. And “uname -m” command returns x86_64.


Thanks, by default Ubuntu 8.0.4 installs gcc 4.2.3. Should be OK. :)

sudo apt-get install libc6-dev-i386

It’s building a 32-bit executable, and you need that package for 32-bit development.

also, huh, I could have sworn that 8.04 installed 4.3. guess that was Fedora 9!

Hi, do you mean matrixMulDrv by itself is a 32bit program no matter if we are using 64bit or 32bit CUDA sdk on 64bit or 32bit machine?

Yeah, I did this and all projects compiled. This 64bit-32bit-library thing is kind of confusing…