Skip to content

Instantly share code, notes, and snippets.

@jblachly
Last active March 14, 2023 17:33
Show Gist options
  • Star 11 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save jblachly/f8dc0f328d66659d9ee005548a5a2d2e to your computer and use it in GitHub Desktop.
Save jblachly/f8dc0f328d66659d9ee005548a5a2d2e to your computer and use it in GitHub Desktop.
How to build bcl2fastq2 on Ubuntu 16 LTS

1. Make sure configure can find sys/stat.h:

Modify bcl2fastq/src/cmake/macros.cmake

Find the last block:

#
# 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)

And change the find_file function to include /usr/include/x86_64-linux-gnu/ (the location of sys/ in Ubuntu on amd64) thusly:

find_file(${variable} ${file} HINTS ENV C_INCLUDE_PATH ENV CPATH ENV CPLUS_INCLUDE_PATH PATHS /usr/include/x86_64-linux-gnu/)

2. Fix the source code to work with newer Boost versions

bcl2fastq/src/cxx/lib/io/Xml.cpp modify lines 172 and 180 to include the correct template:

boost::property_tree::write_xml(os, treeWithIndexAttributes, boost::property_tree::xml_writer_make_settings(' ' , 2));

to

boost::property_tree::write_xml(os, treeWithIndexAttributes, boost::property_tree::xml_writer_make_settings<ptree::key_type>(' ' , 2));

and likewise again on line 180

Explanation: Boost versions >= 1.56 changed the definition of the xml_writer_make_settings function template: http://www.boost.org/doc/libs/1_44_0/boost/property_tree/detail/xml_parser_writer_settings.hpp http://www.boost.org/doc/libs/1_58_0/boost/property_tree/detail/xml_parser_writer_settings.hpp

@SamStudio8
Copy link

SamStudio8 commented Sep 25, 2018

@jblachly Thanks for this, I still needed @najoshi's export on Ubuntu 18 LTS. The source fix wasn't needed, though I think this was because I let configure download its own boost distribution, as their source files don't seem to have been updated.

@pmenzel
Copy link

pmenzel commented Jun 22, 2020

Thanks for this. I just went through it on Ubuntu 20.04 and I only had to apply the fix in bcl2fastq/src/cmake/macros.cmake.
There was also a problem with zlib, which was resolved by
sudo apt-get install zlib1g-dev.

@aallahyar
Copy link

aallahyar commented Aug 5, 2020

Thanks for this. I only needed the first fix as well in Ubuntu 16 LTS!

Correction: the "make" command failed. So I had to apply the second fix as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment