Skip to content

Instantly share code, notes, and snippets.

@jblachly
Last active March 14, 2023 17:33
Show Gist options
  • 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

@najoshi
Copy link

najoshi commented Dec 9, 2017

I've been banging my head against this for days now... and this worked! Thanks!
Also, instead of changing the source in the macros.cmake file, I just used the environment variable:
export CPLUS_INCLUDE_PATH=/usr/include/x86_64-linux-gnu

@jeremycfd
Copy link

Thanks so much for this. It's nuts to me that Illumina would push source code that explicitly fails on Ubuntu when one of the primary reasons for getting the source code at all is that they only have RPMs for CentOS/RedHat distros... This fix worked for me, so thanks again.

@popucui
Copy link

popucui commented Mar 16, 2018

Thank you so much, really appreciate it.

@simon-anders
Copy link

Thanks! You probably just saved me several hours of work.

@qingpeng
Copy link

I was trying to install the bcl2fastq v2.20.0.422 and it seems that I don't need to fix the 2nd part about boost version.

could this be fixed in the new version of bcl2fastq?

@jblachly
Copy link
Author

@qingpeng This may have been fixed recently -- I haven't built it lately. I will give a try, and also in Ubuntu 18 LTS and report back.

@simon-anders Glad to be able to repay the favor -- HTseq likewise saved me an incalculable amount of time and was indispensable in the creation of Mucor

@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