more helpful "PCH file built from a different branch" message

Đang mở
#1,117 3 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
35/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 lệnh gọi make và lệnh biên dịch được nêu trong báo cáo, đặc biệt là đối số -include-pch tham chiếu đến stan/src/stan/model/model_header.hpp.gch. Tái hiện lỗi do compiler không tương thích, sau đó truy vết nơi lỗi này được hiển thị. Được xem là hoàn tất khi đầu ra xác định vị trí của PCH hoặc tự động xây dựng lại nó, và hành vi khi xảy ra lỗi được bao phủ bằng một test.

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

Mô tả

enhancement good first issue
Summary:

The PCH file built from a different branch error does not provide a hint on how to fix it. Add such a hint.

Description:

When I try to build with the wrong precompiled header (PCH), I get this:

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

--- Translating Stan model to C++ code ---
bin/stanc  --o=/Users/bcarpenter/temp2/simple.hpp /Users/bcarpenter/temp2/simple.stan

--- 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.78.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/simple.o /Users/bcarpenter/temp2/simple.hpp
error: PCH file built from a different branch ((clang-1316.0.21.2.5)) than the compiler ((clang-1400.0.29.102))
1 error generated.
make: *** [/Users/bcarpenter/temp2/simple] Error 1

This is great that it says what's wrong, but it would be even better if it suggested how to fix the problem. I'm pretty sure I need to just delete a .pch file, but I don't know where it's at. A recursive search didn't work:

~/github/stan-dev/cmdstan (develop)$ ls -R -l | grep pch
-rw-r--r--   1 bcarpenter  1595  3773 Aug 10 12:07 pchip.hpp
-rw-r--r--  1 bcarpenter  1595   340 Aug 10 12:07 pch.hpp
-rwxr-xr-x  1 bcarpenter  1595  1175 Aug 10 12:07 cppcheck.sh
-rw-r--r--   1 bcarpenter  1595    537 Aug 10 12:07 pch.hpp
-rw-r--r--   1 bcarpenter  1595   2717 Aug 10 12:07 pch.jam
-rw-r--r--   1 bcarpenter  1595   2848 Aug 10 12:07 pch.py
~/github/stan-dev/cmdstan (develop)$ 
Reproducible Steps:

See above, but to reproduce it, you need to have two compilers, one of which built the pch file and a different one to tickle this error.

Current Output:

See above.

Expected Output:

Some hint as to where the pch file is that I need to delete. Even better, just automatically delete and rebuild after detecting this error.

Additional Information:

There are a lot of pages where people brought up this problem on our forums or in issues. The advice in the first hit on the forums didn't work, which suggested just running make clean. Here's what I get:

~/github/stan-dev/cmdstan (develop)$ make clean
rm -f -r test
rm -f 
rm -f 
rm -f 
rm -f 
~/github/stan-dev/cmdstan (develop)$ make ~/temp2/simple

--- 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.78.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/simple.o /Users/bcarpenter/temp2/simple.hpp
error: PCH file built from a different branch ((clang-1316.0.21.2.5)) than the compiler ((clang-1400.0.29.102))
1 error generated.
make: *** [/Users/bcarpenter/temp2/simple] Error 1
Current Version:

v2.30.1

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.