-
Notifications
You must be signed in to change notification settings - Fork 224
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
[SLES 15.x][RHEL 8.x] Build failure 'filesystem' file not found after #2657 #2687
Comments
I would like to explain how this error can possibly occur. Clang++ has two possibilities to be provided with std:: support.
That is, ROCm's clang++ uses Therefore, the error is caused by the fact that ROCm goes for host's gcc compiler, and it's too old to provide std::filesystem support. This build mode of clang++ is the default, libc++ needs to be added separately. However, in Windows things could be different, build team may choose to provide libc++, as there is no other alternative. IMO, each toolchain is better be made self-containing to avoid distro-specific headaches. One reason why nvcc compiler is not self-containing is that host-device source code separation is made to use host compiler (gcc, msvc) for the host code, and use cicc (LLVM) for device code only. BUT for ROCm I believe it does not have to be so: both host and device code could be handled by ROCm clang++ entirely. To my best knowledge, ROCm clang++ can be made into a self-containing distro-independent compiler. Why it is not done so (as the error indicates) is a big question to the ROCm compiler devops team. I'd double-check with them what is their reasoning and do they understand the impact of their choice not to use libc++.
The best solution would be to use https://github.com/gulrak/filesystem . It's a unification package used to provide std::filesystem on top of uneven compiler support. I used it few years ago and not anymore, but it still should solve this problem very well. |
And a side not about RHEL. RHEL chooses to keep a very old gcc compiler as the system default. RHEL uses what they call toolsets to optionally provide newer compilers, but they are installed into On Rocky Linux 8.8 the default GCC is 8.5.0, which is 5 years old, but it already supports C++17. So another way to avoid the problem is to raise RHEL OS version requirement. |
@junliume , since the error in RHEL only occurs for you during linking, I believe it could be fixed. Please try to add iff --git a/addkernels/CMakeLists.txt b/addkernels/CMakeLists.txt
index f904146ae..55a1d8c85 100644
--- a/addkernels/CMakeLists.txt
+++ b/addkernels/CMakeLists.txt
@@ -27,5 +27,6 @@
set(ADD_KERNELS_SOURCE include_inliner.cpp addkernels.cpp)
add_executable(addkernels EXCLUDE_FROM_ALL ${ADD_KERNELS_SOURCE})
+target_link_libraries(addkernels stdc++fs)
clang_tidy_check(addkernels)
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 8feef9375..8743edec8 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -683,7 +683,7 @@ endif()
target_include_directories(MIOpen SYSTEM PUBLIC $<BUILD_INTERFACE:${HALF_INCLUDE_DIR}>)
target_include_directories(MIOpen SYSTEM PRIVATE ${BZIP2_INCLUDE_DIR})
-target_link_libraries(MIOpen PRIVATE ${CMAKE_THREAD_LIBS_INIT} ${BZIP2_LIBRARIES} ${MIOPEN_CK_LINK_FLAGS})
+target_link_libraries(MIOpen PRIVATE ${CMAKE_THREAD_LIBS_INIT} ${BZIP2_LIBRARIES} ${MIOPEN_CK_LINK_FLAGS} stdc++fs)
generate_export_header(MIOpen
EXPORT_FILE_NAME ${PROJECT_BINARY_DIR}/include/miopen/export.h
) This library should be automatically added to linker by CMake, but only if CMake is new enough. |
Clang++ for providing STL uses the GNU standard library on Linux and the MSFT standard library on Windows. For SLES 15, the |
The same is true for RHEL. |
PR #2690 submitted |
The PR looks great! Still what's about SLES? Does a missing filesystem header mean that some package needs to be added into the build environment? |
No, all required packages are there. It is just a matter of using |
OK, likely means SLES has an older compiler version. Oldest among all target Linux distros. Therefore, it should be our first target to check when introducing new C++ features. |
[Observation]
SLES Error:
RHEL Error:
The issue is likely introduced by #2657
[Proposal]:
Within #2657:
Likely we would need the other way around, replace
std::filesystem
withboost
?The text was updated successfully, but these errors were encountered: