Getting something similar, but instead of Rstan, I’m using building the stan math library standalone. I’m trying to add the following flag to one of the make files, to see if this will compile my stan program: CXX14=g++.

This is a centOS server. What I’m doing is looking for the string to detect $OS within a makefile, by using echo $OS, and nothings coming up.

How do I check the value of this string?

I’ve also just added CXX14=g++ immediately after the block that starts with the comment ## Set default compiler, with no luck.

In file included from /u/anzapi/playpen_stanmath/math-4.4.0/lib/eigen_3.3.9/Eigen/src/Core/MatrixBase.h:130:0,
from /u/anzapi/playpen_stanmath/math-4.4.0/lib/eigen_3.3.9/Eigen/Core:441,
from /u/anzapi/playpen_stanmath/math-4.4.0/lib/eigen_3.3.9/Eigen/Dense:1,
from /u/anzapi/playpen_stanmath/math-4.4.0/stan/math/prim/fun/Eigen.hpp:22,
from /u/anzapi/playpen_stanmath/math-4.4.0/stan/math/rev.hpp:4,
from /u/anzapi/playpen_stanmath/math-4.4.0/stan/math.hpp:19,
from bar.cpp:1:
/u/anzapi/playpen_stanmath/math-4.4.0/stan/math/prim/eigen_plugins.h:18:25: error: expected type-specifier
using double_return_t = std::conditional_t<std::is_const<std::remove_reference_t<T>>::value,
^
/u/anzapi/playpen_stanmath/math-4.4.0/stan/math/prim/eigen_plugins.h:22:26: error: expected type-specifier
using reverse_return_t = std::conditional_t<std::is_const<std::remove_reference_t<T>>::value,

The file extension can be added afterward (or you can write a custom make rule for this in the standalone file). If you’d like to enforce this on every build you can add CXXFLAGS=-shared -fPIC to make/local

yeah I had tried this, without the quotes, and both with/without -fPIC flag on different compiler versions and it would sometimes compile fine, but no .so file.

This exact thing, with compiler version 7.4.0 gives me:

g++: error: unrecognized command line option ‘-shared -fPIC’; did you mean ‘-shared’?

So now I’m trying just -shared, and I’m getting

/bin/ld: /tmp/ccpmF4Nm.o: relocation R_X86_64_32 against .rodata.str1.8’ can not be used when making a shared object; recompile with -fPIC
/bin/ld: final link failed: Nonrepresentable section on output
collect2: error: ld returned 1 exit status
`

and this error was what had let me to add the -fPIC flag initially.