[libcxx-commits] [libcxx] [openmp] [libc++] basic_ios<wchar_t> cannot store fill character WCHAR_MAX (PR #89305)

via libcxx-commits libcxx-commits at lists.llvm.org
Fri Jul 19 09:30:31 PDT 2024


zeroomega wrote:

> @zeroomega we’ve taken a look at the buildbot config and outputs.
> 
> From what we can see your bots stage 1 use a clang with a custom v2 libc++ from cpid:
> 
> ```
>  ‘-DCMAKE_C_COMPILER=/Volumes/Work/s/w/ir/x/w/cipd/bin/clang’,
>  ‘-DCMAKE_CXX_COMPILER=/Volumes/Work/s/w/ir/x/w/cipd/bin/clang++‘,
>  ‘-DCMAKE_ASM_COMPILER=/Volumes/Work/s/w/ir/x/w/cipd/bin/clang’,
>>  ‘-DCMAKE_SHARED_LINKER_FLAGS=-nostdlib++ /Volumes/Work/s/w/ir/x/w/cipd/lib/libc++.a’,
>  ‘-DCMAKE_MODULE_LINKER_FLAGS=-nostdlib++ /Volumes/Work/s/w/ir/x/w/cipd/lib/libc++.a’,
>  ‘-DCMAKE_EXE_LINKER_FLAGS=-nostdlib++ /Volumes/Work/s/w/ir/x/w/cipd/lib/libc++.a’,
> ```
> 
> https://logs.chromium.org/logs/fuchsia/buildbucket/cr-buildbucket/8742128214337927377/+/u/clang/configure/execution_details
> 
> And then we have some more cmake flags for stage2 which seem to be set to link the cpid library, not the just built one in the build tree:
> 
> ```
>  ‘-DSTAGE2_CROSS_TOOLCHAIN_FLAGS_NATIVE=-DCMAKE_C_COMPILER=/Volumes/Work/s/w/ir/x/w/cipd/bin/clang;-DCMAKE_CXX_COMPILER=/Volumes/Work/s/w/ir/x/w/cipd/bin/clang++;-DCMAKE_OSX_SYSROOT=/Volumes/Work/s/w/ir/cache/macos_sdk/XCode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.3.sdk;-DCMAKE_SHARED_LINKER_FLAGS=-nostdlib++ /Volumes/Work/s/w/ir/x/w/cipd/lib/libc++.a;-DCMAKE_MODULE_LINKER_FLAGS=-nostdlib++ /Volumes/Work/s/w/ir/x/w/cipd/lib/libc++.a;-DCMAKE_EXE_LINKER_FLAGS=-nostdlib++ /Volumes/Work/s/w/ir/x/w/cipd/lib/libc++.a’,
> ```
> 
> Our current theory based on this is your stage2 built clang is loading the cpid shipped libc++ instead of the just-built libc++ from stage 1.
> 
> That could explain the problems your are seeing, since we changed the offset of the fill character in the layout of basic_ios in the unstable v2 ABI with this patch.
> 
> Are you able to try running the tests with a custom `DYLD_LIBRARY_PATH` pointed at the builds `lib` directory (the one containing the just-built libc++) to verify if that resolves the test failure? It would be good to check the rpath, etc on the stage2 built clang as well to confirm what version of libc++ is actually being loaded.
> 
> (You can reach me as `daltenty` on LLVM discord if you’d like to discuss further. I've been trying to replicate the full bot config locally on an x64 mac but there's a lot of moving parts in that bot.)

I don't think your theory is correct, as the CROSS_NATIVE flag is only going to be effective when doing cross compilation. We do have a cross compile mac-arm64 builder that why those flags were there (we should clean them up when doing native host build). In addition, when I was bisecting locally, I omit the CROSS_NATIVE flags. The flag set i used are:

```
/Users/haowei/SRC/llvm-prebuilts/cmake/mac-amd64/bin/cmake \
  -S \
  /Users/haowei/SRC/llvm-project/llvm \
  -GNinja \
  -DCMAKE_MAKE_PROGRAM=/Users/haowei/SRC/llvm-prebuilts/ninja/mac-amd64/ninja \
  -DCMAKE_INSTALL_PREFIX= \
  -DCMAKE_C_COMPILER=/Users/haowei/SRC/llvm-prebuilts/clang/mac-amd64/bin/clang \
  -DCMAKE_CXX_COMPILER=/Users/haowei/SRC/llvm-prebuilts/clang/mac-amd64/bin/clang++ \
  -DCMAKE_ASM_COMPILER=/Users/haowei/SRC/llvm-prebuilts/clang/mac-amd64/bin/clang \
  -DCLANG_REPOSITORY_STRING=https://llvm.googlesource.com/llvm-project \
  -DCMAKE_LIBTOOL=/Users/haowei/SRC/llvm-prebuilts/clang/mac-amd64/bin/llvm-libtool-darwin \
  -DCMAKE_LIPO=/Users/haowei/SRC/llvm-prebuilts/clang/mac-amd64/bin/llvm-lipo \
  -DCMAKE_SYSROOT=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.4.sdk \
  -DLLVM_ENABLE_ZLIB=FORCE_ON \
  -DZLIB_INCLUDE_DIR=/Users/haowei/SRC/llvm-prebuilts/reproduce/zlib_install_target/include \
  -DZLIB_LIBRARY=/Users/haowei/SRC/llvm-prebuilts/reproduce/zlib_install_target/lib/libz.a \
  -DLLVM_ENABLE_ZSTD=FORCE_ON \
  -Dzstd_DIR=/Users/haowei/SRC/llvm-prebuilts/reproduce/zstd_install/lib/cmake/zstd \
  -DLLVM_ENABLE_LIBXML2=FORCE_ON \
  -DLibXml2_ROOT=/Users/haowei/SRC/llvm-prebuilts/reproduce/libxml2_install_target/lib/cmake/libxml2-2.9.10 \
  -DLLVM_ENABLE_CURL=FORCE_ON \
  -DCURL_ROOT=/Users/haowei/SRC/llvm-prebuilts/reproduce/curl_install/lib/cmake/CURL \
  -DOpenSSL_ROOT=/Users/haowei/SRC/llvm-prebuilts/reproduce/boringssl_install/lib/cmake/OpenSSL \
  -DLLVM_ENABLE_HTTPLIB=FORCE_ON \
  -Dhttplib_ROOT=/Users/haowei/SRC/llvm-prebuilts/reproduce/cpp_httplib_install/lib/cmake/httplib \
  -DCMAKE_FIND_PACKAGE_PREFER_CONFIG=ON \
  "-DCMAKE_SHARED_LINKER_FLAGS=-nostdlib++ /Users/haowei/SRC/llvm-prebuilts/clang/mac-amd64/lib/libc++.a" \
  "-DCMAKE_MODULE_LINKER_FLAGS=-nostdlib++ /Users/haowei/SRC/llvm-prebuilts/clang/mac-amd64/lib/libc++.a" \
  "-DCMAKE_EXE_LINKER_FLAGS=-nostdlib++ /Users/haowei/SRC/llvm-prebuilts/clang/mac-amd64/lib/libc++.a" \
  -DSTAGE2_CMAKE_LINKER=/usr/bin/ld \
  -DSTAGE2_LINUX_aarch64-unknown-linux-gnu_SYSROOT=/Users/haowei/SRC/llvm-prebuilts/sysroot/linux \
  -DSTAGE2_LINUX_armv7-unknown-linux-gnueabihf_SYSROOT=/Users/haowei/SRC/llvm-prebuilts/sysroot/linux \
  -DSTAGE2_LINUX_i386-unknown-linux-gnu_SYSROOT=/Users/haowei/SRC/llvm-prebuilts/sysroot/linux \
  -DSTAGE2_LINUX_riscv64-unknown-linux-gnu_SYSROOT=/Users/haowei/SRC/llvm-prebuilts/sysroot/focal \
  -DSTAGE2_LINUX_x86_64-unknown-linux-gnu_SYSROOT=/Users/haowei/SRC/llvm-prebuilts/sysroot/linux \
  -DSTAGE2_FUCHSIA_SDK=/Users/haowei/SRC/llvm-prebuilts/sdk \
  "-DSTAGE2_LLVM_LIT_ARGS=--resultdb-output=r.j -v" \
  -DSTAGE2_LLVM_ENABLE_LTO=OFF \
  -DSTAGE2_LLVM_RAEVICT_MODEL_PATH=none \
  -DCURSES_INCLUDE_DIRS=/Users/haowei/SRC/llvm-prebuilts/reproduce/ncurses_install/include\;/Users/haowei/SRC/llvm-prebuilts/reproduce/ncurses_install/include/ncurses \
  -DCURSES_LIBRARIES=/Users/haowei/SRC/llvm-prebuilts/reproduce/ncurses_install/lib/libncurses.a \
  -DPANEL_LIBRARIES=/Users/haowei/SRC/llvm-prebuilts/reproduce/ncurses_install/lib/libpanel.a \
  -DLLVM_ENABLE_TERMINFO=FORCE_ON \
  -DTerminfo_LIBRARIES=/Users/haowei/SRC/llvm-prebuilts/reproduce/ncurses_install/lib/libncurses.a \
  -DLLVM_ENABLE_LIBEDIT=FORCE_ON \
  -DLibEdit_INCLUDE_DIRS=/Users/haowei/SRC/llvm-prebuilts/reproduce/libedit_install/include \
  -DLibEdit_LIBRARIES=/Users/haowei/SRC/llvm-prebuilts/reproduce/libedit_install/lib/libedit.a\;/Users/haowei/SRC/llvm-prebuilts/reproduce/ncurses_install/lib/libncurses.a \
  -C ../clang/cmake/caches/Fuchsia.cmake
```

So I don't think the issue is stage2 clang is loading stage1 libcxx. In addition, we always do static linking, I am not sure if `DYLD_LIBRARY_PATH` is going to be effective in this case but I will have a try when I am back to my workstation.

https://github.com/llvm/llvm-project/pull/89305


More information about the libcxx-commits mailing list