Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve missing submodule logic #1217

Merged
merged 3 commits into from
Dec 1, 2023

Conversation

WardBrian
Copy link
Member

Submisison Checklist

  • Run tests: ./runCmdStanTests.py src/test
  • Declare copyright holder and open-source license: see below

Summary:

Implements the suggestions in #1216 to improve the error users see if they are missing the math submodule

Intended Effect:

The error goes from:

$ make examples/bernoulli/bernoulli

--- Compiling the main object file. This might take up to a minute. ---
g++    -c -o src/cmdstan/main.o src/cmdstan/main.cpp
src/cmdstan/main.cpp:1:10: fatal error: cmdstan/command.hpp: No such file or directory
    1 | #include <cmdstan/command.hpp>
      |          ^~~~~~~~~~~~~~~~~~~~~
compilation terminated.
make: *** [make/program:14: src/cmdstan/main.o] Error 1

to

$ make examples/bernoulli/bernoulli
ERROR: Missing Stan submodules.
We tried to find the Stan Math submodule at:
  stan/lib/stan_math/

The most likely source of the problem is CmdStan was cloned without
the --recursive flag.  To fix this, run the following command:
  git submodule update --init --recursive

And try building again
makefile:31: stan/lib/stan_math/make/libraries: No such file or directory
make: *** [makefile:361: stan/lib/stan_math/make/libraries] Error 1

How to Verify:

Check out without the submodules

Side Effects:

By making these hard-includes, some debugging gets a bit harder (e.g., the make print-* commands fail). I tried to mitigate this by including the MATH path in the error that gets shown

Documentation:

Copyright and Licensing

Please list the copyright holder for the work you are submitting (this will be you or your assignee, such as a university or company):

Simons Foundation

By submitting this pull request, the copyright holder is agreeing to license the submitted work under the following licenses:

@WardBrian WardBrian merged commit 7ff95a4 into develop Dec 1, 2023
1 check passed
@WardBrian WardBrian deleted the makefile/missing-submodules-cleanup branch December 1, 2023 19:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

makefile: consider using include rather than -include for Math makefiles
2 participants