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,42 @@ jobs:
224239 fi
225240 echo -E "third-party-dir=$third_party_dir" >> $GITHUB_OUTPUT
226241
242+ - name : Install libc++
243+ id : install_libcxx
244+ uses :
alandefreitas/cpp-actions/[email protected] 245+ if : matrix.use-libcxx == 'true'
246+ with :
247+ cmake-version : ' >=3.26'
248+ source-dir : ../third-party/llvm-project/runtimes
249+ git-repository : https://github.com/llvm/llvm-project.git
250+ git-tag : llvmorg-21.1.0
251+ download-dir : ../third-party/llvm-project
252+ build-dir : ${sourceDir}/runtimes/build
253+ build-type : ${{ matrix.build-type }}
254+ extra-args : |
255+ -D LLVM_USE_SANITIZER=${{ matrix.llvm-sanitizer-config }}
256+ -D LLVM_OPTIMIZED_TABLEGEN=ON
257+ -D LLVM_ENABLE_LIBCXX=OFF
258+ -D LLVM_ENABLE_PROJECT=""
259+ -D LLVM_ENABLE_RUNTIMES="libcxx;libcxxabi"
260+ -D LLVM_ENABLE_PIC=ON
261+ -D LIBCXXABI_USE_LLVM_UNWINDER=OFF
262+
263+ cc : ${{ steps.setup-cpp.outputs.cc }}
264+ cxx : ${{ steps.setup-cpp.outputs.cxx }}
265+ ccflags : -gz=zstd
266+ cxxflags : -gz=zstd
267+ generator : Ninja
268+ install : true
269+ install-prefix : ${{ matrix.libcxx-path }}
270+ run-tests : false
271+ trace-commands : true
272+
273+ - name : Remove libcxx build-dir
274+ if : steps.install_libcxx.outcome == 'success'
275+ run : |
276+ rm -r ../third-party/llvm-project/runtimes
277+
227278 - name : Cached LLVM Binaries
228279 id : llvm-cache
229280 uses : actions/cache@v4
@@ -277,13 +328,15 @@ jobs:
277328 build-dir : ${sourceDir}/llvm/build
278329 preset : ${{ matrix.llvm-build-preset }}
279330 build-type : ${{ matrix.build-type }}
280- # The LLVM_USE_SANITIZER option doesn't support GCC.
281331 extra-args : |
282- -DLLVM_USE_SANITIZER=${{ matrix.llvm-sanitizer-config }}
332+ -D LLVM_USE_SANITIZER="${{ matrix.llvm-sanitizer-config }}"
333+ -D LLVM_OPTIMIZED_TABLEGEN=ON
334+ -D LLVM_COMPILER_CHECKED=ON
335+ -D CMAKE_C_FLAGS="${{ matrix.common-ccflags }}"
336+ -D CMAKE_CXX_FLAGS="${{ matrix.common-cxxflags }}"
337+ -D CMAKE_SHARED_LINKER_FLAGS="${{ matrix.common-ldflags }}"
283338 cc : ${{ steps.setup-cpp.outputs.cc }}
284339 cxx : ${{ steps.setup-cpp.outputs.cxx }}
285- ccflags : -gz=zstd
286- cxxflags : -gz=zstd
287340 generator : Ninja
288341 install : true
289342 install-prefix : ${sourceDir}/../install
@@ -293,7 +346,7 @@ jobs:
293346 - name : Remove LLVM build-dir
294347 if : steps.install_llvm.outcome == 'success'
295348 run : |
296- rm -r ../third-party/llvm-project/llvm/llvm/build
349+ rm -r ../third-party/llvm-project/llvm
297350
298351 - name : Install Duktape
299352 uses :
alandefreitas/cpp-actions/[email protected] @@ -306,8 +359,8 @@ jobs:
306359 build-dir : ${sourceDir}/build
307360 cc : ${{ steps.setup-cpp.outputs.cc }}
308361 cxx : ${{ steps.setup-cpp.outputs.cxx }}
309- ccflags : ${{ matrix.ccflags }}
310- cxxflags : ${{ matrix.cxxflags }}
362+ ccflags : ${{ matrix.common- ccflags }}
363+ cxxflags : ${{ matrix.common- cxxflags }}
311364 build-type : ${{ matrix.build-type }}
312365 shared : false
313366 install : true
@@ -325,11 +378,12 @@ jobs:
325378 build-dir : ${sourceDir}/build
326379 cc : ${{ steps.setup-cpp.outputs.cc }}
327380 cxx : ${{ steps.setup-cpp.outputs.cxx }}
328- ccflags : ${{ matrix.ccflags }}
329- cxxflags : ${{ matrix.cxxflags }}
381+ ccflags : ${{ matrix.common- ccflags }}
382+ cxxflags : ${{ matrix.common- cxxflags }}
330383 build-type : Release
331384 shared : false
332385 extra-args : |
386+ -D CMAKE_SHARED_LINKER_FLAGS="${{ matrix.common-ldflags }}"
333387 -D LIBXML2_WITH_PROGRAMS=ON
334388 -D LIBXML2_WITH_FTP=OFF
335389 -D LIBXML2_WITH_HTTP=OFF
@@ -388,11 +442,11 @@ jobs:
388442 install-prefix : .local
389443 extra-args : |
390444 -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
445+ -D CMAKE_EXE_LINKER_FLAGS=" ${{ matrix.common-ldflags }}"
446+ -D LLVM_ROOT=" ${{ steps.resolve-third-party-dir.outputs.third-party-dir }}/llvm-project/install"
447+ -D Clang_ROOT=" ${{ steps.resolve-third-party-dir.outputs.third-party-dir }}/llvm-project/install"
448+ -D duktape_ROOT=" ${{ steps.resolve-third-party-dir.outputs.third-party-dir }}/duktape/install"
449+ -D Duktape_ROOT=" ${{ steps.resolve-third-party-dir.outputs.third-party-dir }}/duktape/install"
396450 ${{ runner.os == 'Windows' && '-D libxml2_ROOT=../third-party/libxml2/install' || '' }}
397451 ${{ runner.os == 'Windows' && '-D LibXml2_ROOT=../third-party/libxml2/install' || '' }}
398452 export-compile-commands : true
0 commit comments