Include issue with time.h/features.h in debian-7 image

107 views
Skip to first unread message

Chris Whittleston

unread,
May 12, 2014, 1:04:44 PM5/12/14
to gce-dis...@googlegroups.com
Hey compute engine folks, I was hoping I could get some help with an issues I've encountered with the debian-7 image. This is the compilation error itself:

In file included from /usr/include/time.h:28:0,
                 from wallclock.c:12:
/usr/include/features.h:323:26: fatal error: bits/predefs.h: No such file or directory
compilation terminated.

Looking into this - features.h includes predefs.h like this:

/* Define __STDC_IEC_559__ and other similar macros.  */
#include <bits/predefs.h>

The problem is that this path is incorrect - predefs is actually in /usr/include/x86_64-linux-gnu/bits. I'm looking for the best way to solve this issue, but am wondering if I should need to. Surely the image should be set up to not have internal include path issues like this? 

I'm hoping setting C_INCLUDE_PATH and CPLUS_INCLUDE_PATH to include /usr/include/x86_64-linux-gnu the will fix my issue? I'd appreciate some advice from someone who knows more about this sort of stuff :)

Thanks,

Chris

Google Compute Engine Team

unread,
May 12, 2014, 5:13:27 PM5/12/14
to Chris Whittleston, gce-dis...@googlegroups.com
Hi,

GCC should by default include /usr/include/x86_64-linux-gnu on a debian system. Google Compute Engine does not make any changes in this area so this issue is not caused by running on GCE. If you run "gcc -xc -E -v -" you should see the include directories in the output.

Do you have a custom build system that is disabling default includes? Could you include the GCC command that is causing this error?

On a fresh instance based on debian-7-wheezy-v20140415:

dnewgas@dnewgas-test-2:~$ sudo aptitude install gcc
...
dnewgas@dnewgas-test-2:~$ gcc -xc -E -v -
Using built-in specs.
COLLECT_GCC=gcc
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Debian 4.7.2-5' --with-bugurl=file:///usr/share/doc/gcc-4.7/README.Bugs --enable-languages=c,c++,go,fortran,objc,obj-c++ --prefix=/usr --program-suffix=-4.7 --enable-shared --enable-linker-build-id --with-system-zlib --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --with-gxx-include-dir=/usr/include/c++/4.7 --libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --enable-gnu-unique-object --enable-plugin --enable-objc-gc --with-arch-32=i586 --with-tune=generic --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu
Thread model: posix
gcc version 4.7.2 (Debian 4.7.2-5) 
COLLECT_GCC_OPTIONS='-E' '-v' '-mtune=generic' '-march=x86-64'
 /usr/lib/gcc/x86_64-linux-gnu/4.7/cc1 -E -quiet -v -imultiarch x86_64-linux-gnu - -mtune=generic -march=x86-64
ignoring nonexistent directory "/usr/local/include/x86_64-linux-gnu"
ignoring nonexistent directory "/usr/lib/gcc/x86_64-linux-gnu/4.7/../../../../x86_64-linux-gnu/include"
#include "..." search starts here:
#include <...> search starts here:
 /usr/lib/gcc/x86_64-linux-gnu/4.7/include
 /usr/local/include
 /usr/lib/gcc/x86_64-linux-gnu/4.7/include-fixed
 /usr/include/x86_64-linux-gnu
 /usr/include
End of search list.
^C
dnewgas@dnewgas-test-2:~$ cat > test.c
#include <time.h>
int main(){return 0;}
dnewgas@dnewgas-test-2:~$ gcc test.c
dnewgas@dnewgas-test-2:~$ ./a.out 
dnewgas@dnewgas-test-2:~$


--
© 2014 Google Inc. 1600 Amphitheatre Parkway, Mountain View, CA 94043
 
Email preferences: You received this email because you signed up for the Google Compute Engine Discussion Google Group (gce-dis...@googlegroups.com) to participate in discussions with other members of the Google Compute Engine community and the Google Compute Engine Team.
---
You received this message because you are subscribed to the Google Groups "gce-discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email to gce-discussio...@googlegroups.com.
To post to this group, send email to gce-dis...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/gce-discussion/6c5dcec1-8d64-4b5c-9b16-7ef1a44d211a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Chris Whittleston

unread,
May 12, 2014, 6:22:16 PM5/12/14
to gce-dis...@googlegroups.com, Chris Whittleston, gc-...@google.com
Thanks for getting back to me.

I've checked my include paths using the command you suggested and I do indeed have that directory included. Here is some more detail of the build - I'm trying to compile a version of the AMBER molecular mechanics package (http://ambermd.org/) which is a mix of C and Fortran90.

When I initially tried to compile, I got the following error from wallclock.c:

gcc -c -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -O2 -m32  -o wallclock.o wallclock.c
wallclock.c:12:22: fatal error: sys/time.h: No such file or directory
compilation terminated.

I bypassed this by making the following change in wallclock.c:

Old
#include <sys/time.h>
New
#include <time.h>

After this, the error changes to:

gcc -c -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -O2 -m32  -o wallclock.o wallclock.c
In file included from /usr/include/time.h:28:0,
                 from wallclock.c:12:
/usr/include/features.h:323:26: fatal error: bits/predefs.h: No such file or directory
compilation terminated.

This is the original error I posted. Does anything here jump out at you?

Best,

Chris

Google Compute Engine Team

unread,
May 12, 2014, 6:32:05 PM5/12/14
to Chris Whittleston, gce-dis...@googlegroups.com
Hello,

This is somewhat out of scope of Google Compute Engine as I believe you are having an issue with AMBER's build system. I suggest you see if that project has any advice for you.

The only pointer I can give you is that "-m32" is directing gcc to generate 32 bit code. The x86_64-linux-gnu  directory is for 64 bit specific headers.  You may need to install a full 32 bit build system or direct AMBER to build in 64 bit.



Chris Whittleston

unread,
May 13, 2014, 6:34:28 AM5/13/14
to gce-dis...@googlegroups.com, Chris Whittleston, gc-...@google.com
Thanks - the 32/64 bit mismatch seems like a good place to start the debugging. There are a few ex AMBER developers in my building so I might grab one of them tomorrow to pick their brains.

Since my initial post, I've managed to get it compiling and running using cmake, so happily I can continue my benchmarking while I look into the gcc issue.

Thanks again for the responses.

Chris 
Reply all
Reply to author
Forward
0 new messages