mateidavid / fast5

A C++ header-only library for reading Oxford Nanopore Fast5 files
MIT License
53 stars 16 forks source link

gcc-6.3.0: fatal error: stdlib.h: No such file or directory #18

Open mmokrejs opened 6 years ago

mmokrejs commented 6 years ago

Hi David, I am trying to stitch together a fast5 package for Gentoo Linux but it fails to compile with 6.3.0 here:

>>> Emerging (2 of 3) sci-libs/fast5-9999::science
>>> Unpacking source...
 * Fetching https://github.com/mateidavid/fast5.git ...
git fetch https://github.com/mateidavid/fast5.git +HEAD:refs/git-r3/HEAD
git symbolic-ref refs/git-r3/sci-libs/fast5/0/__main__ refs/git-r3/HEAD
 * Checking out https://github.com/mateidavid/fast5.git to /apps/gentoo/var/tmp/portage/sci-libs/fast5-9999/work/fast5-9999 ...
git checkout --quiet refs/git-r3/HEAD
GIT update -->
   repository:               https://github.com/mateidavid/fast5.git
   at the commit:            8a48fd7d70d64225ac349135dcf5734b9f452125
>>> Source unpacked in /apps/gentoo/var/tmp/portage/sci-libs/fast5-9999/work
>>> Preparing source in /apps/gentoo/var/tmp/portage/sci-libs/fast5-9999/work/fast5-9999 ...
>>> Source prepared.
>>> Configuring source in /apps/gentoo/var/tmp/portage/sci-libs/fast5-9999/work/fast5-9999 ...
>>> Source configured.
>>> Compiling source in /apps/gentoo/var/tmp/portage/sci-libs/fast5-9999/work/fast5-9999 ...
make -j25 -C python develop-user HDF5_DIR=/apps/gentoo/usr HDF5_LIB_DIR=/apps/gentoo/usr/lib64 
make: Entering directory '/apps/gentoo/var/tmp/portage/sci-libs/fast5-9999/work/fast5-9999/python'
/apps/gentoo/usr/bin/python setup.py develop --user
Compiling fast5/fast5.pyx because it changed.
[1/1] Cythonizing fast5/fast5.pyx
running develop
running egg_info
creating fast5.egg-info
writing fast5.egg-info/PKG-INFO
writing top-level names to fast5.egg-info/top_level.txt
writing dependency_links to fast5.egg-info/dependency_links.txt
writing manifest file 'fast5.egg-info/SOURCES.txt'
reading manifest file 'fast5.egg-info/SOURCES.txt'
writing manifest file 'fast5.egg-info/SOURCES.txt'
running build_ext
building 'fast5' extension
creating build
creating build/temp.linux-x86_64-2.7
creating build/temp.linux-x86_64-2.7/fast5
x86_64-pc-linux-gnu-g++ -pthread -O2 -pipe -O2 -pipe -march=native -ftree-vectorize -fPIC -I../include -I../src -I/apps/gentoo/usr/include/python2.7 -c fast5/fast5.cpp -o build/temp.linux-x86_64-2.7/fast5/fast5.o -std=c++11 -Wall -Wextra -Wpedantic -isystem /apps/gentoo/usr/include
In file included from /apps/gentoo/usr/lib/gcc/x86_64-pc-linux-gnu/6.3.0/include/g++-v6/ext/string_conversions.h:41:0,
                 from /apps/gentoo/usr/lib/gcc/x86_64-pc-linux-gnu/6.3.0/include/g++-v6/bits/basic_string.h:5402,
                 from /apps/gentoo/usr/lib/gcc/x86_64-pc-linux-gnu/6.3.0/include/g++-v6/string:52,
                 from /apps/gentoo/usr/lib/gcc/x86_64-pc-linux-gnu/6.3.0/include/g++-v6/bits/locale_classes.h:40,
                 from /apps/gentoo/usr/lib/gcc/x86_64-pc-linux-gnu/6.3.0/include/g++-v6/bits/ios_base.h:41,
                 from /apps/gentoo/usr/lib/gcc/x86_64-pc-linux-gnu/6.3.0/include/g++-v6/ios:42,
                 from fast5/fast5.cpp:536:
/apps/gentoo/usr/lib/gcc/x86_64-pc-linux-gnu/6.3.0/include/g++-v6/cstdlib:75:25: fatal error: stdlib.h: No such file or directory
 #include_next <stdlib.h>
                         ^
compilation terminated.
error: command 'x86_64-pc-linux-gnu-g++' failed with exit status 1
make: *** [Makefile:41: develop-user] Error 1
make: Leaving directory '/apps/gentoo/var/tmp/portage/sci-libs/fast5-9999/work/fast5-9999/python'

It works with gcc-5.4.0.

ebioman commented 6 years ago

Hi Just encountered the same problem. I found some information on that problem here

Essentially in your gcc it jumps from your defined include path to the next in the list which in my case was -I ../include . Obviously it did not find anything there (have a look at what the make command produces).

In the setup.py there is actually a fix included:

# don't indiscriminately add /usr/include to work around bug:
# https://lists.fedoraproject.org/archives/list/devel@lists.fedoraproject.org/thread/Q5SWCUUMWQ4EMS7CU2CBOZHV3WZYOOTT/
for d in [hdf5_include_dir]:
    if d != '/usr/include':
        extra_compile_args += ['-isystem', d]
#extra_compile_args += ['-O0', '-g3', '-ggdb', '-fno-eliminate-unused-debug-types', '-v']

which did not work in our case as we had an unusual include path which was not /usr/include and therefore the patch did not do its job. Adapting it worked fine for us.