recompiling main.cpp each time

Đang mở
#1,094 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

Đánh giá

Độ khó
3/5
Thời gian dự kiến
1-2 ngày
Mức phù hợp với người mới
45/100
Loại issue
Lỗi
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Đình trệ
Công nghệ
cpp
Lĩnh vực
build-system, cli

Hướng nghiên cứu

Bắt đầu với quy tắc make xây dựng src/cmdstan/main.o và truy tìm lý do nó chạy lại sau khi việc dịch mô hình thất bại. Tái hiện chuỗi này bằng make ~/temp2/abs, bao gồm một mô hình Stan bị lỗi, sau đó là một mô hình đã được sửa. Được xem là hoàn tất khi một lần make sau đó sử dụng lại main.o nếu main.cpp và các phần phụ thuộc của nó không thay đổi, đồng thời xây dựng lại nó khi chúng thay đổi.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

bug makefile
Summary:

When I run the latest develop version of cmdstan, it recompiles the main.cpp every time, but it should only have to be compiled once.

Description:

The main.cpp should only be compiled once, then re-used.

Reproducible Steps & Current Output
Run 1
~/github/stan-dev/cmdstan (develop)$ make ~/temp2/abs
clang++ -std=c++1y -Wno-unknown-warning-option -Wno-tautological-compare -Wno-sign-compare -D_REENTRANT -Wno-ignored-attributes      -I stan/lib/stan_math/lib/tbb_2020.3/include    -O3 -I src -I stan/src -I lib/rapidjson_1.1.0/ -I lib/CLI11-1.9.1/ -I stan/lib/stan_math/ -I stan/lib/stan_math/lib/eigen_3.3.9 -I stan/lib/stan_math/lib/boost_1.75.0 -I stan/lib/stan_math/lib/sundials_6.1.1/include -I stan/lib/stan_math/lib/sundials_6.1.1/src/sundials    -DBOOST_DISABLE_ASSERTS          -c -MT stan/src/stan/model/model_header.hpp.gch -MT stan/src/stan/model/model_header.d -MM -E -MG -MP -MF stan/src/stan/model/model_header.d stan/src/stan/model/model_header.hpp

--- Compiling the main object file. This might take up to a minute. ---
clang++ -std=c++1y -Wno-unknown-warning-option -Wno-tautological-compare -Wno-sign-compare -D_REENTRANT -Wno-ignored-attributes      -I stan/lib/stan_math/lib/tbb_2020.3/include    -O3 -I src -I stan/src -I lib/rapidjson_1.1.0/ -I lib/CLI11-1.9.1/ -I stan/lib/stan_math/ -I stan/lib/stan_math/lib/eigen_3.3.9 -I stan/lib/stan_math/lib/boost_1.75.0 -I stan/lib/stan_math/lib/sundials_6.1.1/include -I stan/lib/stan_math/lib/sundials_6.1.1/src/sundials    -DBOOST_DISABLE_ASSERTS          -c -o src/cmdstan/main.o src/cmdstan/main.cpp

--- Compiling pre-compiled header. This might take a few seconds. ---
clang++ -std=c++1y -Wno-unknown-warning-option -Wno-tautological-compare -Wno-sign-compare -D_REENTRANT -Wno-ignored-attributes      -I stan/lib/stan_math/lib/tbb_2020.3/include    -O3 -I src -I stan/src -I lib/rapidjson_1.1.0/ -I lib/CLI11-1.9.1/ -I stan/lib/stan_math/ -I stan/lib/stan_math/lib/eigen_3.3.9 -I stan/lib/stan_math/lib/boost_1.75.0 -I stan/lib/stan_math/lib/sundials_6.1.1/include -I stan/lib/stan_math/lib/sundials_6.1.1/src/sundials    -DBOOST_DISABLE_ASSERTS          -c stan/src/stan/model/model_header.hpp -o stan/src/stan/model/model_header.hpp.gch

--- Translating Stan model to C++ code ---
bin/stanc  --o=/Users/bcarpenter/temp2/abs.hpp /Users/bcarpenter/temp2/abs.stan
Semantic error in '/Users/bcarpenter/temp2/abs.stan', line 4, column 20 to column 35:
   -------------------------------------------------
     2:    int a = abs(2);
     3:    real b = abs(2.9);
     4:    array[2] real c = abs({1.9, 2.8});
                             ^
     5:    array[2] int d = abs({1, 2});
     6:    vector[2] e = abs([1.2, 3.9]');
   -------------------------------------------------

Ill-typed arguments supplied to function 'abs':
(array[] real)
Available signatures:
(int) => int
  The first argument must be int but got array[] real
(real) => real
  The first argument must be real but got array[] realmake: *** [/Users/bcarpenter/temp2/abs.hpp] Error 1

So this fails to compile the model, but what happens to the make.cpp compilation?

Run 2

It just happens again. And remember "This might take up to a minute."

~/github/stan-dev/cmdstan (develop)$ make ~/temp2/abs

--- Compiling the main object file. This might take up to a minute. ---
clang++ -std=c++1y -Wno-unknown-warning-option -Wno-tautological-compare -Wno-sign-compare -D_REENTRANT -Wno-ignored-attributes      -I stan/lib/stan_math/lib/tbb_2020.3/include    -O3 -I src -I stan/src -I lib/rapidjson_1.1.0/ -I lib/CLI11-1.9.1/ -I stan/lib/stan_math/ -I stan/lib/stan_math/lib/eigen_3.3.9 -I stan/lib/stan_math/lib/boost_1.75.0 -I stan/lib/stan_math/lib/sundials_6.1.1/include -I stan/lib/stan_math/lib/sundials_6.1.1/src/sundials    -DBOOST_DISABLE_ASSERTS          -c -o src/cmdstan/main.o src/cmdstan/main.cpp

--- Translating Stan model to C++ code ---
bin/stanc  --o=/Users/bcarpenter/temp2/abs.hpp /Users/bcarpenter/temp2/abs.stan
Semantic error in '/Users/bcarpenter/temp2/abs.stan', line 5, column 2 to column 32:
   -------------------------------------------------
     3:    real b = abs(2.9);
     4:    array[2] real c = fabs({1.9, 2.8});
     5:    array[2] int d = fabs({1, 2});
           ^
     6:    vector[2] e = fabs([1.2, 3.9]');
     7:    row_vector[2] f = fabs([1.2, 3.9]);
   -------------------------------------------------

Ill-typed arguments supplied to assignment operator =: lhs has type array[] int and rhs has type array[] realmake: *** [/Users/bcarpenter/temp2/abs.hpp] Error 1
Run 3

Here we go again.

~/github/stan-dev/cmdstan (develop)$ make ~/temp2/abs

--- Compiling the main object file. This might take up to a minute. ---
clang++ -std=c++1y -Wno-unknown-warning-option -Wno-tautological-compare -Wno-sign-compare -D_REENTRANT -Wno-ignored-attributes      -I stan/lib/stan_math/lib/tbb_2020.3/include    -O3 -I src -I stan/src -I lib/rapidjson_1.1.0/ -I lib/CLI11-1.9.1/ -I stan/lib/stan_math/ -I stan/lib/stan_math/lib/eigen_3.3.9 -I stan/lib/stan_math/lib/boost_1.75.0 -I stan/lib/stan_math/lib/sundials_6.1.1/include -I stan/lib/stan_math/lib/sundials_6.1.1/src/sundials    -DBOOST_DISABLE_ASSERTS          -c -o src/cmdstan/main.o src/cmdstan/main.cpp

--- Translating Stan model to C++ code ---
bin/stanc  --o=/Users/bcarpenter/temp2/abs.hpp /Users/bcarpenter/temp2/abs.stan
Syntax error in '/Users/bcarpenter/temp2/abs.stan', line 5, column 11 to column 17, parsing error:
   -------------------------------------------------
     3:    real b = abs(2.9);
     4:    array[2] real c = fabs({1.9, 2.8});
     5:    array[2] double d = fabs({1, 2});
                    ^
     6:    vector[2] e = fabs([1.2, 3.9]');
     7:    row_vector[2] f = fabs([1.2, 3.9]);
   -------------------------------------------------

Ill-formed phrase. Found L-value. This can be completed in many ways.
make: *** [/Users/bcarpenter/temp2/abs.hpp] Error 1
Run 4

One more time, with feeling.

~/github/stan-dev/cmdstan (develop)$ make ~/temp2/abs

--- Compiling the main object file. This might take up to a minute. ---
clang++ -std=c++1y -Wno-unknown-warning-option -Wno-tautological-compare -Wno-sign-compare -D_REENTRANT -Wno-ignored-attributes      -I stan/lib/stan_math/lib/tbb_2020.3/include    -O3 -I src -I stan/src -I lib/rapidjson_1.1.0/ -I lib/CLI11-1.9.1/ -I stan/lib/stan_math/ -I stan/lib/stan_math/lib/eigen_3.3.9 -I stan/lib/stan_math/lib/boost_1.75.0 -I stan/lib/stan_math/lib/sundials_6.1.1/include -I stan/lib/stan_math/lib/sundials_6.1.1/src/sundials    -DBOOST_DISABLE_ASSERTS          -c -o src/cmdstan/main.o src/cmdstan/main.cpp

--- Translating Stan model to C++ code ---
bin/stanc  --o=/Users/bcarpenter/temp2/abs.hpp /Users/bcarpenter/temp2/abs.stan
Warning in '/Users/bcarpenter/temp2/abs.stan', line 3, column 11: Use of the `abs` function with real-valued arguments is deprecated; use functions `fabs` instead.
--- Compiling, linking C++ code ---
clang++ -std=c++1y -Wno-unknown-warning-option -Wno-tautological-compare -Wno-sign-compare -D_REENTRANT -Wno-ignored-attributes      -I stan/lib/stan_math/lib/tbb_2020.3/include    -O3 -I src -I stan/src -I lib/rapidjson_1.1.0/ -I lib/CLI11-1.9.1/ -I stan/lib/stan_math/ -I stan/lib/stan_math/lib/eigen_3.3.9 -I stan/lib/stan_math/lib/boost_1.75.0 -I stan/lib/stan_math/lib/sundials_6.1.1/include -I stan/lib/stan_math/lib/sundials_6.1.1/src/sundials    -DBOOST_DISABLE_ASSERTS          -c -include-pch stan/src/stan/model/model_header.hpp.gch -x c++ -o /Users/bcarpenter/temp2/abs.o /Users/bcarpenter/temp2/abs.hpp
clang++ -std=c++1y -Wno-unknown-warning-option -Wno-tautological-compare -Wno-sign-compare -D_REENTRANT -Wno-ignored-attributes      -I stan/lib/stan_math/lib/tbb_2020.3/include    -O3 -I src -I stan/src -I lib/rapidjson_1.1.0/ -I lib/CLI11-1.9.1/ -I stan/lib/stan_math/ -I stan/lib/stan_math/lib/eigen_3.3.9 -I stan/lib/stan_math/lib/boost_1.75.0 -I stan/lib/stan_math/lib/sundials_6.1.1/include -I stan/lib/stan_math/lib/sundials_6.1.1/src/sundials    -DBOOST_DISABLE_ASSERTS                -Wl,-L,"/Users/bcarpenter/github/stan-dev/cmdstan/stan/lib/stan_math/lib/tbb" -Wl,-rpath,"/Users/bcarpenter/github/stan-dev/cmdstan/stan/lib/stan_math/lib/tbb"      /Users/bcarpenter/temp2/abs.o src/cmdstan/main.o        -Wl,-L,"/Users/bcarpenter/github/stan-dev/cmdstan/stan/lib/stan_math/lib/tbb" -Wl,-rpath,"/Users/bcarpenter/github/stan-dev/cmdstan/stan/lib/stan_math/lib/tbb"   stan/lib/stan_math/lib/sundials_6.1.1/lib/libsundials_nvecserial.a stan/lib/stan_math/lib/sundials_6.1.1/lib/libsundials_cvodes.a stan/lib/stan_math/lib/sundials_6.1.1/lib/libsundials_idas.a stan/lib/stan_math/lib/sundials_6.1.1/lib/libsundials_kinsol.a  stan/lib/stan_math/lib/tbb/libtbb.dylib stan/lib/stan_math/lib/tbb/libtbbmalloc.dylib stan/lib/stan_math/lib/tbb/libtbbmalloc_proxy.dylib -o /Users/bcarpenter/temp2/abs
rm -f /Users/bcarpenter/temp2/abs.o
~/github/stan-dev/cmdstan (develop)$ make ~/temp2/abs

--- Translating Stan model to C++ code ---
bin/stanc  --o=/Users/bcarpenter/temp2/abs.hpp /Users/bcarpenter/temp2/abs.stan
Warning in '/Users/bcarpenter/temp2/abs.stan', line 3, column 11: Use of the `abs` function with real-valued arguments is deprecated; use functions `fabs` instead.
--- Compiling the main object file. This might take up to a minute. ---
clang++ -std=c++1y -Wno-unknown-warning-option -Wno-tautological-compare -Wno-sign-compare -D_REENTRANT -Wno-ignored-attributes      -I stan/lib/stan_math/lib/tbb_2020.3/include    -O3 -I src -I stan/src -I lib/rapidjson_1.1.0/ -I lib/CLI11-1.9.1/ -I stan/lib/stan_math/ -I stan/lib/stan_math/lib/eigen_3.3.9 -I stan/lib/stan_math/lib/boost_1.75.0 -I stan/lib/stan_math/lib/sundials_6.1.1/include -I stan/lib/stan_math/lib/sundials_6.1.1/src/sundials    -DBOOST_DISABLE_ASSERTS          -c -o src/cmdstan/main.o src/cmdstan/main.cpp

--- Compiling, linking C++ code ---
clang++ -std=c++1y -Wno-unknown-warning-option -Wno-tautological-compare -Wno-sign-compare -D_REENTRANT -Wno-ignored-attributes      -I stan/lib/stan_math/lib/tbb_2020.3/include    -O3 -I src -I stan/src -I lib/rapidjson_1.1.0/ -I lib/CLI11-1.9.1/ -I stan/lib/stan_math/ -I stan/lib/stan_math/lib/eigen_3.3.9 -I stan/lib/stan_math/lib/boost_1.75.0 -I stan/lib/stan_math/lib/sundials_6.1.1/include -I stan/lib/stan_math/lib/sundials_6.1.1/src/sundials    -DBOOST_DISABLE_ASSERTS          -c -include-pch stan/src/stan/model/model_header.hpp.gch -x c++ -o /Users/bcarpenter/temp2/abs.o /Users/bcarpenter/temp2/abs.hpp
clang++ -std=c++1y -Wno-unknown-warning-option -Wno-tautological-compare -Wno-sign-compare -D_REENTRANT -Wno-ignored-attributes      -I stan/lib/stan_math/lib/tbb_2020.3/include    -O3 -I src -I stan/src -I lib/rapidjson_1.1.0/ -I lib/CLI11-1.9.1/ -I stan/lib/stan_math/ -I stan/lib/stan_math/lib/eigen_3.3.9 -I stan/lib/stan_math/lib/boost_1.75.0 -I stan/lib/stan_math/lib/sundials_6.1.1/include -I stan/lib/stan_math/lib/sundials_6.1.1/src/sundials    -DBOOST_DISABLE_ASSERTS                -Wl,-L,"/Users/bcarpenter/github/stan-dev/cmdstan/stan/lib/stan_math/lib/tbb" -Wl,-rpath,"/Users/bcarpenter/github/stan-dev/cmdstan/stan/lib/stan_math/lib/tbb"      /Users/bcarpenter/temp2/abs.o src/cmdstan/main.o        -Wl,-L,"/Users/bcarpenter/github/stan-dev/cmdstan/stan/lib/stan_math/lib/tbb" -Wl,-rpath,"/Users/bcarpenter/github/stan-dev/cmdstan/stan/lib/stan_math/lib/tbb"   stan/lib/stan_math/lib/sundials_6.1.1/lib/libsundials_nvecserial.a stan/lib/stan_math/lib/sundials_6.1.1/lib/libsundials_cvodes.a stan/lib/stan_math/lib/sundials_6.1.1/lib/libsundials_idas.a stan/lib/stan_math/lib/sundials_6.1.1/lib/libsundials_kinsol.a  stan/lib/stan_math/lib/tbb/libtbb.dylib stan/lib/stan_math/lib/tbb/libtbbmalloc.dylib stan/lib/stan_math/lib/tbb/libtbbmalloc_proxy.dylib -o /Users/bcarpenter/temp2/abs
rm -f /Users/bcarpenter/temp2/abs.o
Run 5

OK, this time it succeeded. Now let me change my program for abs and see what happens.

It still recompiles main.cpp.

~/github/stan-dev/cmdstan (develop)$ make ~/temp2/abs

--- Translating Stan model to C++ code ---
bin/stanc  --o=/Users/bcarpenter/temp2/abs.hpp /Users/bcarpenter/temp2/abs.stan
Warning in '/Users/bcarpenter/temp2/abs.stan', line 3, column 11: Use of the `abs` function with real-valued arguments is deprecated; use functions `fabs` instead.
--- Compiling the main object file. This might take up to a minute. ---
clang++ -std=c++1y -Wno-unknown-warning-option -Wno-tautological-compare -Wno-sign-compare -D_REENTRANT -Wno-ignored-attributes      -I stan/lib/stan_math/lib/tbb_2020.3/include    -O3 -I src -I stan/src -I lib/rapidjson_1.1.0/ -I lib/CLI11-1.9.1/ -I stan/lib/stan_math/ -I stan/lib/stan_math/lib/eigen_3.3.9 -I stan/lib/stan_math/lib/boost_1.75.0 -I stan/lib/stan_math/lib/sundials_6.1.1/include -I stan/lib/stan_math/lib/sundials_6.1.1/src/sundials    -DBOOST_DISABLE_ASSERTS          -c -o src/cmdstan/main.o src/cmdstan/main.cpp

--- Compiling, linking C++ code ---
clang++ -std=c++1y -Wno-unknown-warning-option -Wno-tautological-compare -Wno-sign-compare -D_REENTRANT -Wno-ignored-attributes      -I stan/lib/stan_math/lib/tbb_2020.3/include    -O3 -I src -I stan/src -I lib/rapidjson_1.1.0/ -I lib/CLI11-1.9.1/ -I stan/lib/stan_math/ -I stan/lib/stan_math/lib/eigen_3.3.9 -I stan/lib/stan_math/lib/boost_1.75.0 -I stan/lib/stan_math/lib/sundials_6.1.1/include -I stan/lib/stan_math/lib/sundials_6.1.1/src/sundials    -DBOOST_DISABLE_ASSERTS          -c -include-pch stan/src/stan/model/model_header.hpp.gch -x c++ -o /Users/bcarpenter/temp2/abs.o /Users/bcarpenter/temp2/abs.hpp
clang++ -std=c++1y -Wno-unknown-warning-option -Wno-tautological-compare -Wno-sign-compare -D_REENTRANT -Wno-ignored-attributes      -I stan/lib/stan_math/lib/tbb_2020.3/include    -O3 -I src -I stan/src -I lib/rapidjson_1.1.0/ -I lib/CLI11-1.9.1/ -I stan/lib/stan_math/ -I stan/lib/stan_math/lib/eigen_3.3.9 -I stan/lib/stan_math/lib/boost_1.75.0 -I stan/lib/stan_math/lib/sundials_6.1.1/include -I stan/lib/stan_math/lib/sundials_6.1.1/src/sundials    -DBOOST_DISABLE_ASSERTS                -Wl,-L,"/Users/bcarpenter/github/stan-dev/cmdstan/stan/lib/stan_math/lib/tbb" -Wl,-rpath,"/Users/bcarpenter/github/stan-dev/cmdstan/stan/lib/stan_math/lib/tbb"      /Users/bcarpenter/temp2/abs.o src/cmdstan/main.o        -Wl,-L,"/Users/bcarpenter/github/stan-dev/cmdstan/stan/lib/stan_math/lib/tbb" -Wl,-rpath,"/Users/bcarpenter/github/stan-dev/cmdstan/stan/lib/stan_math/lib/tbb"   stan/lib/stan_math/lib/sundials_6.1.1/lib/libsundials_nvecserial.a stan/lib/stan_math/lib/sundials_6.1.1/lib/libsundials_cvodes.a stan/lib/stan_math/lib/sundials_6.1.1/lib/libsundials_idas.a stan/lib/stan_math/lib/sundials_6.1.1/lib/libsundials_kinsol.a  stan/lib/stan_math/lib/tbb/libtbb.dylib stan/lib/stan_math/lib/tbb/libtbbmalloc.dylib stan/lib/stan_math/lib/tbb/libtbbmalloc_proxy.dylib -o /Users/bcarpenter/temp2/abs
rm -f /Users/bcarpenter/temp2/abs.o
Expected Output:

Only see recompilation of main.cpp once.

Additional Information:

This is on Mac OS X.

~/github/stan-dev/cmdstan (develop)$ clang++ --version
Apple clang version 13.1.6 (clang-1316.0.21.2.3)
Target: x86_64-apple-darwin21.4.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin
~/github/stan-dev/cmdstan (develop)$ make --version
GNU Make 3.81
Copyright (C) 2006  Free Software Foundation, Inc.
This is free software; see the source for copying conditions.
There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A
PARTICULAR PURPOSE.

This program built for i386-apple-darwin11.3.0
Current Version:

v2.29.2

Ngôn ngữ chính
C++
Star
240
Fork
105
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của stan-dev/cmdstan

Tất cả issue của stan-dev/cmdstan

Issue tương tự

Thêm issue về C++

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.