stan-dev / cmdstan

CmdStan, the command line interface to Stan
https://mc-stan.org/users/interfaces/cmdstan
BSD 3-Clause "New" or "Revised" License
212 stars 93 forks source link

Make build on develop fails #1300

Closed GertjanBrouwer closed 17 hours ago

GertjanBrouwer commented 18 hours ago

Description:

For the repository stan-dev/stan I want to make some changes to the source. To test this, I want to use cmdstan, which I cloned recursively. When building with make build or make examples/bernoulli/bernoulli I get numerous linking(?) errors with the message "undefined reference to" to even the most basic things.

Reproducible Steps:

Install Ubuntu 22.04 lts Clone cmdstan: git clone --recursive https://github.com/stan-dev/cmdstan.git run make build or make examples/bernoulli/bernoulli

Current Output:

output.txt

Additional Information:

Compiler: GCC 11.4.0 Make: GNU Make 4.3.0

Current Version:

Develop

WardBrian commented 18 hours ago

I recently upgraded to 24.04, but this looks like what can happen if your environment changes between builds sometimes, especially if you use a tool like Conda.

Do you get the same error on a completely fresh build? The output you provide looks like build has been run previously

GertjanBrouwer commented 17 hours ago

The cmdstan was cloned a couple of hours ago, I tried a couple of make with different settings and also added CXX=gcc to make/local in cmdstan. This is the output after running make clean and then make examples/bernoulli/bernoulli: output.txt I did not realize the output would (did not look different to me with or without make clean)

I do not use Conda btw, is that necessary? I followed the wiki on github.

WardBrian commented 17 hours ago

Conda is not necessary, I only mentioned it because it is common and sometimes produces similar-ish errors.

I think your issue is CXX=gcc. The name of the GNU C++ compiler is g++, so you'd need CC=gcc and CXX=g++

After this I would try to make clean-all before building again

GertjanBrouwer commented 17 hours ago

Thank you. This solved the issue for me.

WardBrian commented 17 hours ago

Great!