4242 latest-factors : |
4343 msvc Optimized-Debug
4444 gcc UBSan Coverage
45- clang UBSan ASan
45+ clang UBSan ASan MSan
4646 apple-clang UBSan ASan
4747 factors : ' '
4848 runs-on : |
6666 clang: git build-essential pkg-config python3 curl openjdk-11-jdk pkg-config libncurses-dev libxml2-utils libxml2-dev g++-14=14.2.0-4ubuntu2~24.04
6767 msvc: ''
6868 extra-values : |
69+ use-libcxx: {{#if (and (ieq compiler 'clang') (or ubsan asan msan)) }}true{{else}}false{{/if}}
70+ libcxx-path: /usr/local/libcxx
6971 llvm-hash: a1b6e7ff393533a5c4f3bdfd4efe5da106e2de2b
7072 llvm-build-preset-prefix: {{#if optimized-debug}}debwithopt{{else}}{{{lowercase build-type}}}{{/if}}
7173 llvm-build-preset-os: {{#if (ieq os 'windows') }}win{{else}}unix{{/if}}
@@ -77,10 +79,13 @@ jobs:
7779 llvm-archive-extension: {{#if (ieq os 'windows') }}7z{{else}}tar.bz2{{/if}}
7880 llvm-archive-filename: {{{ llvm-archive-basename }}}.{{{ llvm-archive-extension }}}
7981 llvm-sanitizer-config: {{#if (and (ne compiler 'clang') (ne compiler 'apple-clang'))}}{{else if ubsan}}Undefined{{else if asan}}Address{{else if msan}}MemoryWithOrigins{{/if}}
80- mrdocs-flags: {{#if (and (eq compiler 'gcc') (not asan)) }}-static{{/if}}{{#if (and (eq compiler 'clang') msan) }}-fsanitize-memory-track-origins{{/if}}
81- mrdocs-ccflags: {{{ ccflags }}} {{{ mrdocs-flags }}}
82- mrdocs-cxxflags: {{{ cxxflags }}} {{{ mrdocs-flags }}}
83- mrdocs-linkflags: {{#if asan }}-fsanitize=address{{/if}}
82+ common-flags: -gz=zstd {{#if msan }}-fsanitize-memory-track-origins {{/if}}
83+ common-ccflags: {{{ ccflags }}} {{{ common-flags }}}
84+ common-cxxflags: {{{ cxxflags }}} {{#if (ieq use-libcxx 'true') }}-nostdinc++ -isystem{{{ libcxx-path }}}/include/c++/v1{{/if}}
85+ common-ldflags: {{{ ldflags }}} {{#if (ieq use-libcxx 'true') }}-nostdlib++ -L{{{ libcxx-path }}}/lib -lc++abi -lc++ -Wl,-rpath,{{{ libcxx-path }}}/lib {{/if}}
86+ mrdocs-flags: {{#if (and (eq compiler 'gcc') (not asan)) }}-static{{/if}}
87+ mrdocs-ccflags: {{{ common-ccflags }}} {{{ mrdocs-flags }}}
88+ mrdocs-cxxflags: {{{ common-cxxflags }}} {{{ mrdocs-flags }}}
8489 mrdocs-package-generators: {{#if (ieq os 'windows') }}7Z ZIP WIX{{else}}TGZ TXZ{{/if}}
8590 mrdocs-release-package-artifact: release-packages-{{{ lowercase os }}}
8691 output-file : matrix.json
@@ -198,6 +203,16 @@ jobs:
198203 with :
199204 apt-get : ${{ matrix.install }}
200205
206+ - name : Install LLVM packages
207+ if : matrix.use-libcxx == 'true'
208+ env :
209+ DEBIAN_FRONTEND : ' noninteractive'
210+ TZ : ' Etc/UTC'
211+ run : |
212+ echo "deb http://apt.llvm.org/noble/ llvm-toolchain-noble-21 main" >> /etc/apt/sources.list
213+ apt-get update
214+ apt-get install -y libclang-21-dev
215+
201216 - name : Resolve LLVM Root
202217 id : resolve-llvm-root
203218 run : |
@@ -224,6 +239,36 @@ jobs:
224239 fi
225240 echo -E "third-party-dir=$third_party_dir" >> $GITHUB_OUTPUT
226241
242+ - name : Install libc++
243+ uses :
alandefreitas/cpp-actions/[email protected] 244+ if : matrix.use-libcxx == 'true'
245+ with :
246+ cmake-version : ' >=3.26'
247+ source-dir : ../third-party/llvm-project/runtimes
248+ git-repository : https://github.com/llvm/llvm-project.git
249+ git-tag : llvmorg-21.1.0
250+ download-dir : ../third-party/llvm-project
251+ build-dir : ${sourceDir}/runtimes/build
252+ build-type : ${{ matrix.build-type }}
253+ extra-args : |
254+ -D LLVM_USE_SANITIZER=${{ matrix.llvm-sanitizer-config }}
255+ -D LLVM_OPTIMIZED_TABLEGEN=ON
256+ -D LLVM_ENABLE_LIBCXX=OFF
257+ -D LLVM_ENABLE_PROJECT=""
258+ -D LLVM_ENABLE_RUNTIMES="libcxx;libcxxabi"
259+ -D LLVM_ENABLE_PIC=ON
260+ -D LIBCXXABI_USE_LLVM_UNWINDER=OFF
261+
262+ cc : ${{ steps.setup-cpp.outputs.cc }}
263+ cxx : ${{ steps.setup-cpp.outputs.cxx }}
264+ ccflags : -gz=zstd
265+ cxxflags : -gz=zstd
266+ generator : Ninja
267+ install : true
268+ install-prefix : ${{ matrix.libcxx-path }}
269+ run-tests : false
270+ trace-commands : true
271+
227272 - name : Cached LLVM Binaries
228273 id : llvm-cache
229274 uses : actions/cache@v4
@@ -277,13 +322,15 @@ jobs:
277322 build-dir : ${sourceDir}/llvm/build
278323 preset : ${{ matrix.llvm-build-preset }}
279324 build-type : ${{ matrix.build-type }}
280- # The LLVM_USE_SANITIZER option doesn't support GCC.
281325 extra-args : |
282- -DLLVM_USE_SANITIZER=${{ matrix.llvm-sanitizer-config }}
326+ -D LLVM_USE_SANITIZER="${{ matrix.llvm-sanitizer-config }}"
327+ -D LLVM_OPTIMIZED_TABLEGEN=ON
328+ -D CMAKE_SHARED_LINKER_FLAGS="${{ matrix.common-ldflags }}"
329+ -D LLVM_COMPILER_CHECKED=ON
283330 cc : ${{ steps.setup-cpp.outputs.cc }}
284331 cxx : ${{ steps.setup-cpp.outputs.cxx }}
285- ccflags : -gz=zstd
286- cxxflags : -gz=zstd
332+ ccflags : ${{ matrix.common-ccflags }}
333+ cxxflags : ${{ matrix.common-cxxflags }}
287334 generator : Ninja
288335 install : true
289336 install-prefix : ${sourceDir}/../install
@@ -306,8 +353,8 @@ jobs:
306353 build-dir : ${sourceDir}/build
307354 cc : ${{ steps.setup-cpp.outputs.cc }}
308355 cxx : ${{ steps.setup-cpp.outputs.cxx }}
309- ccflags : ${{ matrix.ccflags }}
310- cxxflags : ${{ matrix.cxxflags }}
356+ ccflags : ${{ matrix.common- ccflags }}
357+ cxxflags : ${{ matrix.common- cxxflags }}
311358 build-type : ${{ matrix.build-type }}
312359 shared : false
313360 install : true
@@ -325,11 +372,12 @@ jobs:
325372 build-dir : ${sourceDir}/build
326373 cc : ${{ steps.setup-cpp.outputs.cc }}
327374 cxx : ${{ steps.setup-cpp.outputs.cxx }}
328- ccflags : ${{ matrix.ccflags }}
329- cxxflags : ${{ matrix.cxxflags }}
375+ ccflags : ${{ matrix.common- ccflags }}
376+ cxxflags : ${{ matrix.common- cxxflags }}
330377 build-type : Release
331378 shared : false
332379 extra-args : |
380+ -D CMAKE_SHARED_LINKER_FLAGS="${{ matrix.common-ldflags }}"
333381 -D LIBXML2_WITH_PROGRAMS=ON
334382 -D LIBXML2_WITH_FTP=OFF
335383 -D LIBXML2_WITH_HTTP=OFF
@@ -388,11 +436,11 @@ jobs:
388436 install-prefix : .local
389437 extra-args : |
390438 -D MRDOCS_BUILD_DOCS=OFF
391- -D CMAKE_EXE_LINKER_FLAGS=${{ matrix.mrdocs-linkflags }}
392- -D LLVM_ROOT=${{ steps.resolve-third-party-dir.outputs.third-party-dir }}/llvm-project/install
393- -D Clang_ROOT=${{ steps.resolve-third-party-dir.outputs.third-party-dir }}/llvm-project/install
394- -D duktape_ROOT=${{ steps.resolve-third-party-dir.outputs.third-party-dir }}/duktape/install
395- -D Duktape_ROOT=${{ steps.resolve-third-party-dir.outputs.third-party-dir }}/duktape/install
439+ -D CMAKE_EXE_LINKER_FLAGS=" ${{ matrix.common-ldflags }}"
440+ -D LLVM_ROOT=" ${{ steps.resolve-third-party-dir.outputs.third-party-dir }}/llvm-project/install"
441+ -D Clang_ROOT=" ${{ steps.resolve-third-party-dir.outputs.third-party-dir }}/llvm-project/install"
442+ -D duktape_ROOT=" ${{ steps.resolve-third-party-dir.outputs.third-party-dir }}/duktape/install"
443+ -D Duktape_ROOT=" ${{ steps.resolve-third-party-dir.outputs.third-party-dir }}/duktape/install"
396444 ${{ runner.os == 'Windows' && '-D libxml2_ROOT=../third-party/libxml2/install' || '' }}
397445 ${{ runner.os == 'Windows' && '-D LibXml2_ROOT=../third-party/libxml2/install' || '' }}
398446 export-compile-commands : true
0 commit comments