From 53d18f63ea0815bb7971cc5b15a06c11f7a740ca Mon Sep 17 00:00:00 2001 From: "Yang, Bo" Date: Mon, 26 Sep 2022 11:59:03 -0700 Subject: [PATCH] Use the default C++ runtime when CLANG_FORCE_LIBSTDCXX is not set (#9215) Summary: Previously, libc++ is used when the compiler is clang and `CLANG_FORCE_LIBSTDCXX` is not set. It's a surprising behavior because the user would expect HHVM to be linked with the compiler default C++ runtime when `CLANG_FORCE_LIBSTDCXX` is not set. Especially when the default C++ runtime is libstdc++ for Clang on Linux, the linker will report an error of `cannot find -lc++: No such file or directory` when `CLANG_FORCE_LIBSTDCXX` is not set. See https://github.com/facebook/hhvm/actions/runs/3099973322/jobs/5019734982 for the build log. This PR instead uses the default C++ runtime when CLANG_FORCE_LIBSTDCXX is not set Pull Request resolved: https://github.com/facebook/hhvm/pull/9215 Test Plan: This PR should not change the behavior on gcc, because `CLANG_FORCE_LIBSTDCXX` is ignored when building with gcc. When rebasing https://github.com/facebook/hhvm/issues/9129 onto this PR, the error of `cannot find -lc++: No such file or directory` should be gone. Reviewed By: alexeyt Differential Revision: D39703809 Pulled By: Atry fbshipit-source-id: 9da42f74d86ab7c338b4eedd9c98c8b36006ab79 --- CMake/HPHPCompiler.cmake | 2 -- 1 file changed, 2 deletions(-) diff --git a/CMake/HPHPCompiler.cmake b/CMake/HPHPCompiler.cmake index 062d8b5a254..e737baa7d1f 100644 --- a/CMake/HPHPCompiler.cmake +++ b/CMake/HPHPCompiler.cmake @@ -125,8 +125,6 @@ if (${CMAKE_CXX_COMPILER_ID} STREQUAL "Clang" OR ${CMAKE_CXX_COMPILER_ID} STREQU if(CLANG_FORCE_LIBSTDCXX) list(APPEND GENERAL_CXX_OPTIONS "stdlib=libstdc++") - else() - list(APPEND GENERAL_CXX_OPTIONS "stdlib=libc++") endif() else() # using GCC list(APPEND DISABLED_NAMED_WARNINGS -- 2.11.4.GIT