I am trying to configure the bcl2fastq program that uses CMake. I found the line that triggers this error message
file:bcl2fastq/src/cmake/cxxConfigure.cmake
############## content ####################
..... # ignoring many lines
bcl2fastq_find_header_or_die(HAVE_SYS_STAT_H sys/stat.h)
......# more lines following
error message:
-- time.h found as /usr/include/time.h
-- unistd.h found as /usr/include/unistd.h
CMake Error at cmake/macros.cmake:80 (message):
Required header sys/stat.h not found.
Call Stack (most recent call first):
cmake/cxxConfigure.cmake:41 (bcl2fastq_find_header_or_die)
cxx/CMakeLists.txt:34 (include)
On my system, the sys/stat.h
is located in
/usr/include/x86_64-linux-gnu
In the past, I add a symbolic link in /usr/include
to the sys/stat.h
, which patched the problem. Can someone suggest a better method by modifying the CMake files?
Digging deeper, I found the macros.cmake
file in the same directory as cxxConfigure.cmake
contains the macro definition:
#
# Macro to find libraries, with support for static-only search
#
macro(bcl2fastq_find_header_or_die variable file)
find_file(${variable} ${file} HINTS ENV C_INCLUDE_PATH ENV CPATH ENV CPLUS_INCLUDE_PATH)
if (${variable})
message(STATUS "${file} found as ${${variable}}")
else (${variable})
message(FATAL_ERROR "Required header ${file} not found.")
endif (${variable})
endmacro(bcl2fastq_find_header_or_die)
Then I did the following:
export C_INCLUDE_PATH=/usr/include/x86_64-linux-gnu
After that, CMake seems to be happy. Not sure this is the proper way to handle this problem.
Exporting the environment variable like
export C_INCLUDE_PATH=/usr/include/x86_64-linux-gnu
is one use.
Moreover, according to the doc on the find_path
command, PATHS
should be used over HINTS
for hard-coded guesses, which means modifying macros.cmake
like this
find_file([...] PATHS /usr/include/x86_64-linux-gnu)
is more appropriate. For more flexibility, this could be combined with a PATHS ENV
variable, too. The use of PATHS
vs HINTS
has also been asked in the CMake mailing list here, but the explanation didn't offer much more than the documentation entry.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With