Build failure on GCC/MinGW (MXE): std::ifstream constructor mismatch with Platform::filenameToUTF()
Maintainer thường phản hồi trong vòng 1 ngày
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 2/5
- Thời gian dự kiến
- 1-3 giờ
- Mức phù hợp với người mới
- 78/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Đặc tả rõ ràng
- Mức độ hoạt động
- Ít trao đổi
- Công nghệ
- cpp
- Lĩnh vực
- build-system
Hướng nghiên cứu
Bắt đầu trong src/OpenColorIO/transforms/FileTransform.cpp và kiểm tra việc khởi tạo std::ifstream bằng Platform::filenameToUTF(filepath). Xây dựng OpenColorIO bằng GCC/MinGW-w64 hoặc MXE để tái hiện lỗi overload std::wstring, sau đó xác minh rằng việc xử lý đường dẫn biên dịch và hoạt động trên các cấu hình bị ảnh hưởng.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Description
OpenColorIO 2.5.1 fails to compile under GCC / MinGW-w64 (including MXE cross builds) due to inconsistent file path type handling in Platform::filenameToUTF() when used with std::ifstream in FileTransform.cpp.
The failure occurs when constructing a std::ifstream from the result of Platform::filenameToUTF(filepath), where the returned type may vary between std::string and std::wstring depending on build configuration (_WIN32 && UNICODE).
This leads to template overload resolution failures under GCC/libstdc++ when a std::wstring is involved in std::ifstream construction.
Error observed (GCC / libstdc++)
error: no matching function for call to
std::basic_ifstream<char>::basic_ifstream(const std::wstring, std::ios_base::openmode)
Affected code src/OpenColorIO/transforms/FileTransform.cpp:
std::ifstream(Platform::filenameToUTF(filepath), mode)
Root cause
Platform::filenameToUTF()is conditionally typed:std::wstringon _WIN32 && UNICODEstd::stringotherwisestd::ifstreamconstruction fromstd::wstringis not consistently supported across standard library implementations- GCC/libstdc++ rejects this usage, while MSVC may accept it depending on STL implementation details
- This creates a portability issue in file I/O path handling
Impact
- Breaks MXE / MinGW-w64 cross compilation
- Causes divergence between MSVC and GCC builds
- Introduces non-portable file path handling in core I/O utilities
Suggested fix
Avoid passing platform-dependent string types directly into std::ifstream construction.
This is the C++17-compatible solution that worked:
auto path = Platform::filenameToUTF(filepath);
return std::make_unique<std::ifstream>(path.c_str(), mode);
- Ngôn ngữ chính
- C++
- Star
- 2.1k
- Fork
- 502
- Merge trung bình
- 6 ngày 3 giờ
- Pull request đã merge (30 ngày)
- 6
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Không có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- 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.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của AcademySoftwareFoundation/OpenColorIO
-
Inconsistent run-time library usage for locale handling breaks GPU code generation on some systems.Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 86/100
AcademySoftwareFoundation/OpenColorIO#2351 · 2 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 84/100
AcademySoftwareFoundation/OpenColorIO#2340 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
AcademySoftwareFoundation/OpenColorIO#2329 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
ReadTheDocs - OS DeprecationĐang mởDocumentation
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 72/100
AcademySoftwareFoundation/OpenColorIO#2280 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
AcademySoftwareFoundation/OpenColorIO#2277 ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của AcademySoftwareFoundation/OpenColorIO
Issue tương tự
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 74/100
Maintainer thường phản hồi trong vòng 1 ngày
-
`IO.FS.realPath` reports every failure as `noFileOrDirectory` instead of classifying by `errno`Đang mởbug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 66/100
leanprover/lean4#15683 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
[Bug] [geo] Haversine distance calculation can return NaN for antipodal coordinatesCó thể đã có người làm @516665061 đã nhận hôm nay. Đang mởstatus:needs-triage
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
PX4/PX4-Autopilot#29211 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
llvm.memcpy with destination align but no source align asserts "Missed Source alignment!"Có thể đã có người làm @pvelesko đã nhận hôm nay. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
KhronosGroup/SPIRV-LLVM-Translator#4093 ·
Maintainer thường phản hồi trong vòng 2 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 66/100
Maintainer thường phản hồi trong vòng 1 ngày