Failure to compile cmdstan 2.18 on Ubuntu

Hi,

When building cmdstan2.18 I received this message:
gcc.compile.c++ bin.v2/libs/python/build/gcc-gnu-5.4.0/release/threadapi-pthread/threading-multi/list.o
In file included from ./boost/python/detail/prefix.hpp:13:0,
from ./boost/python/list.hpp:8,
from libs/python/src/list.cpp:5:
./boost/python/detail/wrap_python.hpp:50:23: fatal error: pyconfig.h: No such file or directory
compilation terminated.
Any suggestions how to build cmdstan?

This morning I cloned cmdstan with
git clone https://github.com/stan-dev/cmdstan.git --recursive
changed make/local file to
STAN_MPI=TRUE
CC=mpicxx
and run
make build

Ubuntu 16.04.5 LTS
gcc version 5.4.0
I am using openmpi.

If you cloned it today, you need to change CC= to CXX=. It’s updated in the CmdStan doc that lives within the repo (you’ll need LaTeX to compile it). There was an overhaul to the makefiles.

It’s also documented at both in Stan and Math in the respective wikis. For the list of all the flags, see: https://github.com/stan-dev/math/wiki/Developer-Doc#building-and-running-tests

Thanks. Still it fails.

Now the last line before ar when building libsundials_idas.a is:

mpicxx … -o stan/lib/stan_math/lib/sundials_3.1.0/src/idas/idas_spils.o

then:

ar -rs stan/lib/stan_math/lib/sundials_3.1.0/lib/libsundials_idas.a …

then boost is built but for some reason it uses:

gcc.compile.c++

and it breaks on:

gcc.compile.c++ bin.v2/libs/python/build/gcc-gnu-5.4.0/release/threadapi-pthread/threading-multi/list.o
In file included from ./boost/python/detail/prefix.hpp:13:0,
from ./boost/python/list.hpp:8,
from libs/python/src/list.cpp:5:
./boost/python/detail/wrap_python.hpp:50:23: fatal error: pyconfig.h: No such file or directory

Can you start over and provide a little more information?

What’s in your make/local? What did you call? Where and how did it fail? What’s the error message?

The last error message you sent doesn’t make sense… I don’t know why we’d need pyconfig.h (which is provided by Python, not anything in Stan).

Oh… and what OS? What’s your default c++ compiler?

My guess problem is with user-config.jam - it doesn’t have the right mpicxx path. mpicxx is in /usr/bin as opposed to /usr/local/bin

cmdstan/make/local contains:

STAN_MPI=TRUE
CXX=mpicxx

uname -v=#161-Ubuntu SMP Mon Aug 27 10:45:01 UTC 2018

g++ -v=gcc version 5.4.0 20160609 (Ubuntu 5.4.0-6ubuntu1~16.04.10)

That makes sense. Are you just using the Boost that’s distributed with CmdStan?

I assume so. Unless it is lurking somewhere. I just clone, vi make/local, and make build.

Just to double check, you started from a clean CmdStan? If not, would you mind typing this (I’m assuming you’re in CmdStan’s home folder and you’ve used git to clone everything):

cd stan/lib/stan_math

git clean -d -x -f

cd …/…/…/

make stan/lib/stan_math/lib/boost_1.66.0/stage/lib/libboost_serialization.dylib

Could you copy what happens (all the output) from the last line there? I want to see if there’s a difference in how mine is set up.

Well, it failed again on:

gcc.compile.c++ bin.v2/libs/python/build/gcc-gnu-5.4.0/release/threadapi-pthread/threadin g-multi/list.o
In file included from ./boost/python/detail/prefix.hpp:13:0,
from ./boost/python/list.hpp:8,
from libs/python/src/list.cpp:5:
./boost/python/detail/wrap_python.hpp:50:23: fatal error: pyconfig.h: No such file or directory
compilation terminated.

although user-config.jam has

using mpi : /usr/bin/mpicxx ;

And… maybe it’s related to this Boost problem (with v1.66, which is the exact verison we use): https://github.com/boostorg/build/issues/289

For example… this is the sort of output I’m looking for:


$ make stan/lib/stan_math/lib/boost_1.66.0/stage/lib/libboost_serialization.dylib

echo "# In case of a compiler mismatch used by mpicxx and" >> stan/lib/stan_math/lib/boost_1.66.0/user-config.jam

echo "# the compiler used for Stan, consider configuring" >> stan/lib/stan_math/lib/boost_1.66.0/user-config.jam

echo "# the boost toolset here" >> stan/lib/stan_math/lib/boost_1.66.0/user-config.jam

echo "# Moreover, should your mpicxx command live in a" >> stan/lib/stan_math/lib/boost_1.66.0/user-config.jam

echo "# in a non-standard directory, then consider to tell" >> stan/lib/stan_math/lib/boost_1.66.0/user-config.jam

echo "# boost mpi using this syntax:" >> stan/lib/stan_math/lib/boost_1.66.0/user-config.jam

echo "#using mpi : /path/to/mpicxx ;" >> stan/lib/stan_math/lib/boost_1.66.0/user-config.jam

echo "using mpi ;" >> stan/lib/stan_math/lib/boost_1.66.0/user-config.jam

cd stan/lib/stan_math/lib/boost_1.66.0; ./bootstrap.sh

Building Boost.Build engine with toolset darwin... tools/build/src/engine/bin.macosxx86_64/b2

Detecting Python version... 2.7

Detecting Python root... /usr/local/Cellar/python@2/2.7.15_1/Frameworks/Python.framework/Versions/2.7

Unicode/ICU support for Boost.Regex?... not found.

Generating Boost.Build configuration in project-config.jam...

Bootstrapping is done. To build, run:

./b2

To adjust configuration, edit 'project-config.jam'.

Further information:

- Command line help:

./b2 --help

- Getting started guide:

[http://www.boost.org/more/getting_started/unix-variants.html](http://www.boost.org/more/getting_started/unix-variants.html)

- Boost.Build documentation:

[http://www.boost.org/build/doc/html/index.html](http://www.boost.org/build/doc/html/index.html)

cd stan/lib/stan_math/lib/boost_1.66.0; ./b2 --user-config=user-config.jam --layout=system --with-mpi --with-serialization -j1 variant=release link=shared threading=multi runtime-link=shared hardcode-dll-paths=true dll-path="/Users/daniel/stan-dev/cmdstan/stan/lib/stan_math/lib/boost_1.66.0/stage/lib"

Performing configuration checks

- 32-bit                   : no

- 64-bit                   : yes

- arm                      : no

- mips1                    : no

- power                    : no

- sparc                    : no

- x86                      : yes

Building the Boost C++ Libraries.

Component configuration:

- atomic                   : not building

- chrono                   : not building

- date_time                : not building

- exception                : not building

- graph                    : not building

- mpi                      : building

- python                   : not building

- regex                    : not building

- serialization            : building

- system                   : not building

- thread                   : not building

- timer                    : not building

...patience...

I did fresh

git clone https://github.com/stan-dev/cmdstan.git --recursive

cd cmdstan/stan/lib/stan_math

git clean -d -x -f

cd …/…/…/

make stan/lib/stan_math/lib/boost_1.66.0/stage/lib/libboost_serialization.dylib

and got this

g++ -std=c++1y -pthread -Wno-sign-compare -O3 -I src -I stan/src -I stan/lib/stan_math/ -I stan/lib/stan_math/lib/eigen_3.3.3 -I stan/lib/stan_math/lib/boost_1.66.0 -I stan/lib/stan_math/lib/sundials_3.1.0/include -DBOOST_RESULT_OF_USE_TR1 -DBOOST_NO_DECLTYPE -DBOOST_DISABLE_ASSERTS -DBOOST_PHOENIX_NO_VARIADIC_EXPRESSION -c -MT src/cmdstan/stanc.o -MT src/cmdstan/stanc.d -MM -E -MG -MP -MF src/cmdstan/stanc.d src/cmdstan/stanc.cpp
g++ -std=c++1y -pthread -Wno-sign-compare -O3 -I src -I stan/src -I stan/lib/stan_math/ -I stan/lib/stan_math/lib/eigen_3.3.3 -I stan/lib/stan_math/lib/boost_1.66.0 -I stan/lib/stan_math/lib/sundials_3.1.0/include -DBOOST_RESULT_OF_USE_TR1 -DBOOST_NO_DECLTYPE -DBOOST_DISABLE_ASSERTS -DBOOST_PHOENIX_NO_VARIADIC_EXPRESSION -c -MT bin/cmdstan/lang/grammars/semantic_actions_def.o -MT stan/src/stan/lang/grammars/semantic_actions_def.d -MM -E -MG -MP -MF stan/src/stan/lang/grammars/semantic_actions_def.d stan/src/stan/lang/grammars/semantic_actions_def.cpp
g++ -std=c++1y -pthread -Wno-sign-compare -O3 -I src -I stan/src -I stan/lib/stan_math/ -I stan/lib/stan_math/lib/eigen_3.3.3 -I stan/lib/stan_math/lib/boost_1.66.0 -I stan/lib/stan_math/lib/sundials_3.1.0/include -DBOOST_RESULT_OF_USE_TR1 -DBOOST_NO_DECLTYPE -DBOOST_DISABLE_ASSERTS -DBOOST_PHOENIX_NO_VARIADIC_EXPRESSION -c -MT bin/cmdstan/lang/ast_def.o -MT stan/src/stan/lang/ast_def.d -MM -E -MG -MP -MF stan/src/stan/lang/ast_def.d stan/src/stan/lang/ast_def.cpp
g++ -std=c++1y -pthread -Wno-sign-compare -O3 -I src -I stan/src -I stan/lib/stan_math/ -I stan/lib/stan_math/lib/eigen_3.3.3 -I stan/lib/stan_math/lib/boost_1.66.0 -I stan/lib/stan_math/lib/sundials_3.1.0/include -DBOOST_RESULT_OF_USE_TR1 -DBOOST_NO_DECLTYPE -DBOOST_DISABLE_ASSERTS -DBOOST_PHOENIX_NO_VARIADIC_EXPRESSION -c -MT bin/cmdstan/lang/grammars/whitespace_grammar_inst.o -MT stan/src/stan/lang/grammars/whitespace_grammar_inst.d -MM -E -MG -MP -MF stan/src/stan/lang/grammars/whitespace_grammar_inst.d stan/src/stan/lang/grammars/whitespace_grammar_inst.cpp
g++ -std=c++1y -pthread -Wno-sign-compare -O3 -I src -I stan/src -I stan/lib/stan_math/ -I stan/lib/stan_math/lib/eigen_3.3.3 -I stan/lib/stan_math/lib/boost_1.66.0 -I stan/lib/stan_math/lib/sundials_3.1.0/include -DBOOST_RESULT_OF_USE_TR1 -DBOOST_NO_DECLTYPE -DBOOST_DISABLE_ASSERTS -DBOOST_PHOENIX_NO_VARIADIC_EXPRESSION -c -MT bin/cmdstan/lang/grammars/local_var_decls_grammar_inst.o -MT stan/src/stan/lang/grammars/local_var_decls_grammar_inst.d -MM -E -MG -MP -MF stan/src/stan/lang/grammars/local_var_decls_grammar_inst.d stan/src/stan/lang/grammars/local_var_decls_grammar_inst.cpp
g++ -std=c++1y -pthread -Wno-sign-compare -O3 -I src -I stan/src -I stan/lib/stan_math/ -I stan/lib/stan_math/lib/eigen_3.3.3 -I stan/lib/stan_math/lib/boost_1.66.0 -I stan/lib/stan_math/lib/sundials_3.1.0/include -DBOOST_RESULT_OF_USE_TR1 -DBOOST_NO_DECLTYPE -DBOOST_DISABLE_ASSERTS -DBOOST_PHOENIX_NO_VARIADIC_EXPRESSION -c -MT bin/cmdstan/lang/grammars/indexes_grammar_inst.o -MT stan/src/stan/lang/grammars/indexes_grammar_inst.d -MM -E -MG -MP -MF stan/src/stan/lang/grammars/indexes_grammar_inst.d stan/src/stan/lang/grammars/indexes_grammar_inst.cpp
g++ -std=c++1y -pthread -Wno-sign-compare -O3 -I src -I stan/src -I stan/lib/stan_math/ -I stan/lib/stan_math/lib/eigen_3.3.3 -I stan/lib/stan_math/lib/boost_1.66.0 -I stan/lib/stan_math/lib/sundials_3.1.0/include -DBOOST_RESULT_OF_USE_TR1 -DBOOST_NO_DECLTYPE -DBOOST_DISABLE_ASSERTS -DBOOST_PHOENIX_NO_VARIADIC_EXPRESSION -c -MT bin/cmdstan/lang/grammars/statement_2_grammar_inst.o -MT stan/src/stan/lang/grammars/statement_2_grammar_inst.d -MM -E -MG -MP -MF stan/src/stan/lang/grammars/statement_2_grammar_inst.d stan/src/stan/lang/grammars/statement_2_grammar_inst.cpp
g++ -std=c++1y -pthread -Wno-sign-compare -O3 -I src -I stan/src -I stan/lib/stan_math/ -I stan/lib/stan_math/lib/eigen_3.3.3 -I stan/lib/stan_math/lib/boost_1.66.0 -I stan/lib/stan_math/lib/sundials_3.1.0/include -DBOOST_RESULT_OF_USE_TR1 -DBOOST_NO_DECLTYPE -DBOOST_DISABLE_ASSERTS -DBOOST_PHOENIX_NO_VARIADIC_EXPRESSION -c -MT bin/cmdstan/lang/grammars/expression_grammar_inst.o -MT stan/src/stan/lang/grammars/expression_grammar_inst.d -MM -E -MG -MP -MF stan/src/stan/lang/grammars/expression_grammar_inst.d stan/src/stan/lang/grammars/expression_grammar_inst.cpp
g++ -std=c++1y -pthread -Wno-sign-compare -O3 -I src -I stan/src -I stan/lib/stan_math/ -I stan/lib/stan_math/lib/eigen_3.3.3 -I stan/lib/stan_math/lib/boost_1.66.0 -I stan/lib/stan_math/lib/sundials_3.1.0/include -DBOOST_RESULT_OF_USE_TR1 -DBOOST_NO_DECLTYPE -DBOOST_DISABLE_ASSERTS -DBOOST_PHOENIX_NO_VARIADIC_EXPRESSION -c -MT bin/cmdstan/lang/grammars/bare_type_grammar_inst.o -MT stan/src/stan/lang/grammars/bare_type_grammar_inst.d -MM -E -MG -MP -MF stan/src/stan/lang/grammars/bare_type_grammar_inst.d stan/src/stan/lang/grammars/bare_type_grammar_inst.cpp
g++ -std=c++1y -pthread -Wno-sign-compare -O3 -I src -I stan/src -I stan/lib/stan_math/ -I stan/lib/stan_math/lib/eigen_3.3.3 -I stan/lib/stan_math/lib/boost_1.66.0 -I stan/lib/stan_math/lib/sundials_3.1.0/include -DBOOST_RESULT_OF_USE_TR1 -DBOOST_NO_DECLTYPE -DBOOST_DISABLE_ASSERTS -DBOOST_PHOENIX_NO_VARIADIC_EXPRESSION -c -MT bin/cmdstan/lang/grammars/block_var_decls_grammar_inst.o -MT stan/src/stan/lang/grammars/block_var_decls_grammar_inst.d -MM -E -MG -MP -MF stan/src/stan/lang/grammars/block_var_decls_grammar_inst.d stan/src/stan/lang/grammars/block_var_decls_grammar_inst.cpp
g++ -std=c++1y -pthread -Wno-sign-compare -O3 -I src -I stan/src -I stan/lib/stan_math/ -I stan/lib/stan_math/lib/eigen_3.3.3 -I stan/lib/stan_math/lib/boost_1.66.0 -I stan/lib/stan_math/lib/sundials_3.1.0/include -DBOOST_RESULT_OF_USE_TR1 -DBOOST_NO_DECLTYPE -DBOOST_DISABLE_ASSERTS -DBOOST_PHOENIX_NO_VARIADIC_EXPRESSION -c -MT bin/cmdstan/lang/grammars/expression07_grammar_inst.o -MT stan/src/stan/lang/grammars/expression07_grammar_inst.d -MM -E -MG -MP -MF stan/src/stan/lang/grammars/expression07_grammar_inst.d stan/src/stan/lang/grammars/expression07_grammar_inst.cpp
g++ -std=c++1y -pthread -Wno-sign-compare -O3 -I src -I stan/src -I stan/lib/stan_math/ -I stan/lib/stan_math/lib/eigen_3.3.3 -I stan/lib/stan_math/lib/boost_1.66.0 -I stan/lib/stan_math/lib/sundials_3.1.0/include -DBOOST_RESULT_OF_USE_TR1 -DBOOST_NO_DECLTYPE -DBOOST_DISABLE_ASSERTS -DBOOST_PHOENIX_NO_VARIADIC_EXPRESSION -c -MT bin/cmdstan/lang/grammars/functions_grammar_inst.o -MT stan/src/stan/lang/grammars/functions_grammar_inst.d -MM -E -MG -MP -MF stan/src/stan/lang/grammars/functions_grammar_inst.d stan/src/stan/lang/grammars/functions_grammar_inst.cpp
g++ -std=c++1y -pthread -Wno-sign-compare -O3 -I src -I stan/src -I stan/lib/stan_math/ -I stan/lib/stan_math/lib/eigen_3.3.3 -I stan/lib/stan_math/lib/boost_1.66.0 -I stan/lib/stan_math/lib/sundials_3.1.0/include -DBOOST_RESULT_OF_USE_TR1 -DBOOST_NO_DECLTYPE -DBOOST_DISABLE_ASSERTS -DBOOST_PHOENIX_NO_VARIADIC_EXPRESSION -c -MT bin/cmdstan/lang/grammars/program_grammar_inst.o -MT stan/src/stan/lang/grammars/program_grammar_inst.d -MM -E -MG -MP -MF stan/src/stan/lang/grammars/program_grammar_inst.d stan/src/stan/lang/grammars/program_grammar_inst.cpp
g++ -std=c++1y -pthread -Wno-sign-compare -O3 -I src -I stan/src -I stan/lib/stan_math/ -I stan/lib/stan_math/lib/eigen_3.3.3 -I stan/lib/stan_math/lib/boost_1.66.0 -I stan/lib/stan_math/lib/sundials_3.1.0/include -DBOOST_RESULT_OF_USE_TR1 -DBOOST_NO_DECLTYPE -DBOOST_DISABLE_ASSERTS -DBOOST_PHOENIX_NO_VARIADIC_EXPRESSION -c -MT bin/cmdstan/lang/grammars/term_grammar_inst.o -MT stan/src/stan/lang/grammars/term_grammar_inst.d -MM -E -MG -MP -MF stan/src/stan/lang/grammars/term_grammar_inst.d stan/src/stan/lang/grammars/term_grammar_inst.cpp
g++ -std=c++1y -pthread -Wno-sign-compare -O3 -I src -I stan/src -I stan/lib/stan_math/ -I stan/lib/stan_math/lib/eigen_3.3.3 -I stan/lib/stan_math/lib/boost_1.66.0 -I stan/lib/stan_math/lib/sundials_3.1.0/include -DBOOST_RESULT_OF_USE_TR1 -DBOOST_NO_DECLTYPE -DBOOST_DISABLE_ASSERTS -DBOOST_PHOENIX_NO_VARIADIC_EXPRESSION -c -MT bin/cmdstan/lang/grammars/statement_grammar_inst.o -MT stan/src/stan/lang/grammars/statement_grammar_inst.d -MM -E -MG -MP -MF stan/src/stan/lang/grammars/statement_grammar_inst.d stan/src/stan/lang/grammars/statement_grammar_inst.cpp
make: *** No rule to make target ‘stan/lib/stan_math/lib/boost_1.66.0/stage/lib/libboost_serialization.dylib’. Stop.

echo “# In case of a compiler mismatch used by mpicxx and” >> stan/lib/stan_math/lib/boost_1.66.0/user-config.jam
echo “# the compiler used for Stan, consider configuring” >> stan/lib/stan_math/lib/boost_1.66.0/user-config.jam
echo “# the boost toolset here” >> stan/lib/stan_math/lib/boost_1.66.0/user-config.jam
echo “# Moreover, should your mpicxx command live in a” >> stan/lib/stan_math/lib/boost_1.66.0/user-config.jam
echo “# in a non-standard directory, then consider to tell” >> stan/lib/stan_math/lib/boost_1.66.0/user-config.jam
echo “# boost mpi using this syntax:” >> stan/lib/stan_math/lib/boost_1.66.0/user-config.jam
echo “#using mpi : /path/to/mpicxx ;” >> stan/lib/stan_math/lib/boost_1.66.0/user-config.jam
echo “using mpi ;” >> stan/lib/stan_math/lib/boost_1.66.0/user-config.jam
cd stan/lib/stan_math/lib/boost_1.66.0; ./bootstrap.sh
Building Boost.Build engine with toolset gcc… tools/build/src/engine/bin.linuxx86_64/b2
Detecting Python version… 2.7
Detecting Python root… /usr
Unicode/ICU support for Boost.Regex?.. not found.
Generating Boost.Build configuration in project-config.jam…

Bootstrapping is done. To build, run:

./b2

To adjust configuration, edit ‘project-config.jam’.
Further information:

cd stan/lib/stan_math/lib/boost_1.66.0; ./b2 --user-config=user-config.jam --layout=system --with-mpi --with-serialization -j1 variant=release link=shared threading=multi runtime-link=shared hardcode-dll-paths=true dll-path="/home/lmockus/cmdstan/stan/lib/stan_math/lib/boost_1.66.0/stage/lib"
Performing configuration checks

- 32-bit                   : no
- 64-bit                   : yes
- arm                      : no
- mips1                    : no
- power                    : no
- sparc                    : no
- x86                      : yes

Building the Boost C++ Libraries.

Component configuration:

- atomic                   : not building
- chrono                   : not building
- date_time                : not building
- exception                : not building
- graph                    : not building
- mpi                      : building
- python                   : not building
- regex                    : not building
- serialization            : building
- system                   : not building
- thread                   : not building
- timer                    : not building

…patience…
…patience…
…found 5850 targets…
…updating 135 targets…
gcc.compile.c++ bin.v2/libs/serialization/build/gcc-gnu-5.4.0/release/threadapi-pthread/threading-multi/basic_archive.o
gcc.compile.c++ bin.v2/libs/serialization/build/gcc-gnu-5.4.0/release/threadapi-pthread/threading-multi/basic_iarchive.o
gcc.compile.c++ bin.v2/libs/serialization/build/gcc-gnu-5.4.0/release/threadapi-pthread/threading-multi/basic_iserializer.o
gcc.compile.c++ bin.v2/libs/serialization/build/gcc-gnu-5.4.0/release/threadapi-pthread/threading-multi/basic_oarchive.o
gcc.compile.c++ bin.v2/libs/serialization/build/gcc-gnu-5.4.0/release/threadapi-pthread/threading-multi/basic_oserializer.o
gcc.compile.c++ bin.v2/libs/serialization/build/gcc-gnu-5.4.0/release/threadapi-pthread/threading-multi/basic_pointer_iserializer.o
gcc.compile.c++ bin.v2/libs/serialization/build/gcc-gnu-5.4.0/release/threadapi-pthread/threading-multi/basic_pointer_oserializer.o
gcc.compile.c++ bin.v2/libs/serialization/build/gcc-gnu-5.4.0/release/threadapi-pthread/threading-multi/basic_serializer_map.o
gcc.compile.c++ bin.v2/libs/serialization/build/gcc-gnu-5.4.0/release/threadapi-pthread/threading-multi/basic_text_iprimitive.o
gcc.compile.c++ bin.v2/libs/serialization/build/gcc-gnu-5.4.0/release/threadapi-pthread/threading-multi/basic_text_oprimitive.o
gcc.compile.c++ bin.v2/libs/serialization/build/gcc-gnu-5.4.0/release/threadapi-pthread/threading-multi/basic_xml_archive.o
gcc.compile.c++ bin.v2/libs/serialization/build/gcc-gnu-5.4.0/release/threadapi-pthread/threading-multi/binary_iarchive.o
gcc.compile.c++ bin.v2/libs/serialization/build/gcc-gnu-5.4.0/release/threadapi-pthread/threading-multi/binary_oarchive.o
gcc.compile.c++ bin.v2/libs/serialization/build/gcc-gnu-5.4.0/release/threadapi-pthread/threading-multi/extended_type_info.o
gcc.compile.c++ bin.v2/libs/serialization/build/gcc-gnu-5.4.0/release/threadapi-pthread/threading-multi/extended_type_info_typeid.o
gcc.compile.c++ bin.v2/libs/serialization/build/gcc-gnu-5.4.0/release/threadapi-pthread/threading-multi/extended_type_info_no_rtti.o
gcc.compile.c++ bin.v2/libs/serialization/build/gcc-gnu-5.4.0/release/threadapi-pthread/threading-multi/polymorphic_iarchive.o
gcc.compile.c++ bin.v2/libs/serialization/build/gcc-gnu-5.4.0/release/threadapi-pthread/threading-multi/polymorphic_oarchive.o
gcc.compile.c++ bin.v2/libs/serialization/build/gcc-gnu-5.4.0/release/threadapi-pthread/threading-multi/stl_port.o
gcc.compile.c++ bin.v2/libs/serialization/build/gcc-gnu-5.4.0/release/threadapi-pthread/threading-multi/text_iarchive.o
gcc.compile.c++ bin.v2/libs/serialization/build/gcc-gnu-5.4.0/release/threadapi-pthread/threading-multi/text_oarchive.o
gcc.compile.c++ bin.v2/libs/serialization/build/gcc-gnu-5.4.0/release/threadapi-pthread/threading-multi/void_cast.o
gcc.compile.c++ bin.v2/libs/serialization/build/gcc-gnu-5.4.0/release/threadapi-pthread/threading-multi/archive_exception.o
gcc.compile.c++ bin.v2/libs/serialization/build/gcc-gnu-5.4.0/release/threadapi-pthread/threading-multi/xml_grammar.o
gcc.compile.c++ bin.v2/libs/serialization/build/gcc-gnu-5.4.0/release/threadapi-pthread/threading-multi/xml_iarchive.o
gcc.compile.c++ bin.v2/libs/serialization/build/gcc-gnu-5.4.0/release/threadapi-pthread/threading-multi/xml_oarchive.o
gcc.compile.c++ bin.v2/libs/serialization/build/gcc-gnu-5.4.0/release/threadapi-pthread/threading-multi/xml_archive_exception.o
gcc.compile.c++ bin.v2/libs/serialization/build/gcc-gnu-5.4.0/release/threadapi-pthread/threading-multi/codecvt_null.o
gcc.compile.c++ bin.v2/libs/serialization/build/gcc-gnu-5.4.0/release/threadapi-pthread/threading-multi/utf8_codecvt_facet.o
gcc.link.dll bin.v2/libs/serialization/build/gcc-gnu-5.4.0/release/threadapi-pthread/threading-multi/libboost_serialization.so.1.66.0
common.copy stage/lib/libboost_serialization.so.1.66.0
ln-UNIX stage/lib/libboost_serialization.so
gcc.compile.c++ bin.v2/libs/mpi/build/gcc-gnu-5.4.0/release/threadapi-pthread/threading-multi/broadcast.o
gcc.compile.c++ bin.v2/libs/mpi/build/gcc-gnu-5.4.0/release/threadapi-pthread/threading-multi/communicator.o
gcc.compile.c++ bin.v2/libs/mpi/build/gcc-gnu-5.4.0/release/threadapi-pthread/threading-multi/computation_tree.o
gcc.compile.c++ bin.v2/libs/mpi/build/gcc-gnu-5.4.0/release/threadapi-pthread/threading-multi/content_oarchive.o
gcc.compile.c++ bin.v2/libs/mpi/build/gcc-gnu-5.4.0/release/threadapi-pthread/threading-multi/environment.o
gcc.compile.c++ bin.v2/libs/mpi/build/gcc-gnu-5.4.0/release/threadapi-pthread/threading-multi/exception.o
gcc.compile.c++ bin.v2/libs/mpi/build/gcc-gnu-5.4.0/release/threadapi-pthread/threading-multi/graph_communicator.o
gcc.compile.c++ bin.v2/libs/mpi/build/gcc-gnu-5.4.0/release/threadapi-pthread/threading-multi/group.o
gcc.compile.c++ bin.v2/libs/mpi/build/gcc-gnu-5.4.0/release/threadapi-pthread/threading-multi/intercommunicator.o
gcc.compile.c++ bin.v2/libs/mpi/build/gcc-gnu-5.4.0/release/threadapi-pthread/threading-multi/mpi_datatype_cache.o
gcc.compile.c++ bin.v2/libs/mpi/build/gcc-gnu-5.4.0/release/threadapi-pthread/threading-multi/mpi_datatype_oarchive.o
gcc.compile.c++ bin.v2/libs/mpi/build/gcc-gnu-5.4.0/release/threadapi-pthread/threading-multi/packed_iarchive.o
gcc.compile.c++ bin.v2/libs/mpi/build/gcc-gnu-5.4.0/release/threadapi-pthread/threading-multi/packed_oarchive.o
gcc.compile.c++ bin.v2/libs/mpi/build/gcc-gnu-5.4.0/release/threadapi-pthread/threading-multi/packed_skeleton_iarchive.o
gcc.compile.c++ bin.v2/libs/mpi/build/gcc-gnu-5.4.0/release/threadapi-pthread/threading-multi/packed_skeleton_oarchive.o
gcc.compile.c++ bin.v2/libs/mpi/build/gcc-gnu-5.4.0/release/threadapi-pthread/threading-multi/point_to_point.o
gcc.compile.c++ bin.v2/libs/mpi/build/gcc-gnu-5.4.0/release/threadapi-pthread/threading-multi/request.o
gcc.compile.c++ bin.v2/libs/mpi/build/gcc-gnu-5.4.0/release/threadapi-pthread/threading-multi/text_skeleton_oarchive.o
gcc.compile.c++ bin.v2/libs/mpi/build/gcc-gnu-5.4.0/release/threadapi-pthread/threading-multi/timer.o
gcc.link.dll bin.v2/libs/mpi/build/gcc-gnu-5.4.0/release/threadapi-pthread/threading-multi/libboost_mpi.so.1.66.0
common.copy stage/lib/libboost_mpi.so.1.66.0
ln-UNIX stage/lib/libboost_mpi.so
gcc.compile.c++ bin.v2/libs/python/build/gcc-gnu-5.4.0/release/threadapi-pthread/threading-multi/list.o
In file included from ./boost/python/detail/prefix.hpp:13:0,
from ./boost/python/list.hpp:8,
from libs/python/src/list.cpp:5:
./boost/python/detail/wrap_python.hpp:50:23: fatal error: pyconfig.h: No such file or directory
compilation terminated.

"g++"   -O3 -finline-functions -Wno-inline -Wall -pthread -fPIC -m64  -DBOOST_ALL_NO_LIB=1 -DBOOST_PYTHON_SOURCE -DNDEBUG  -I"." -I"/usr/include/python2.7" -c -o "bin.v2/libs/python/build/gcc-gnu-5.4.0/release/threadapi-pthread/threading-multi/list.o" "libs/python/src/list.cpp"

…failed gcc.compile.c++ bin.v2/libs/python/build/gcc-gnu-5.4.0/release/threadapi-pthread/threading-multi/list.o…
gcc.compile.c++ bin.v2/libs/python/build/gcc-gnu-5.4.0/release/threadapi-pthread/threading-multi/long.o
In file included from ./boost/python/detail/prefix.hpp:13:0,
from ./boost/python/long.hpp:8,
from libs/python/src/long.cpp:5:
./boost/python/detail/wrap_python.hpp:50:23: fatal error: pyconfig.h: No such file or directory
compilation terminated.

It seems that python-dev is no installed. I’ll ask to install them and hopefully it will resolve this problem.

I also faced this problem, although my machine had python-devel.
At that time, I used miniconda3-4.3.11(python 3.6.1) with pyenv, so my python commands ran python3.
After I changed python commands so that it ran python2, this error solved.

For someone interests.

Maybe it makes sense to mention in the documentation what development tools have to be installed? While g++ is obvious python may be not. Looks like python is required to compile boost and since it comes packaged with stan one has no clue that python development package is needed. Also, there is a practice to package python and mpi separately from development tools.

I would recommend filing a bug report for CmdStan, because I don’t think that CmdStan’s build of Boost is supposed to depend on Python.