-
Notifications
You must be signed in to change notification settings - Fork 16
Libcpp compilation integration #976
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
Open
123R3N321
wants to merge
51
commits into
main
Choose a base branch
from
libcpp-ren
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 49 commits
Commits
Show all changes
51 commits
Select commit
Hold shift + click to select a range
b79fe5b
Add libcpp header modifications doc file in .md
123R3N321 10d26e7
Create test file for cpp compilation
123R3N321 68c5f23
Modify lind_compile script for cpp compilation
123R3N321 7501bac
Update cpp_compile.md
123R3N321 e583137
Update .gitignore
123R3N321 b3ab4d6
Add .cmake for wasi compilation
123R3N321 412310a
Add build-llvm.sh
123R3N321 1433aad
Add build script for llvm archives
123R3N321 ec1f9f5
Update cpp_compile.md
123R3N321 a2dc3dd
Restore scripts/lind_compile to pass CI
123R3N321 a176bfb
Fix Makefile test command syntax error
123R3N321 bd589ee
Revert Makefile changes, rework all other ci additions.
123R3N321 0af8aa0
Update Dockerfile.e2e
123R3N321 93b87ab
Modify Dockerfile.e2e
123R3N321 a7fddc4
Update Dockerfile.e2e
123R3N321 da99835
Fix Dockerfile.e2e syntax error.
123R3N321 7f951dc
Modify Dockerfile.e2e
123R3N321 aba21c8
Modify Dockerfile.e2e
123R3N321 e01bcc7
Update Dockerfile.e2e
123R3N321 62027e3
Modify Dokcerfile.e2e
123R3N321 b7c73a3
Modify Dockerfile.e2e
123R3N321 c017038
Modify Dockerfile.e2e
123R3N321 29897a7
Refactor cpp test file dir
123R3N321 8c95fc1
Modify e2e.yml
123R3N321 ed29ed2
Modify e2e.yml report upload behavior
123R3N321 709d1a9
Modify e2e.yml
123R3N321 8933f91
Modify e2e.yml
123R3N321 fcdbc7f
Remove standalone libcpp header CI flow.
123R3N321 2d7fb9c
Modify e2e.yml
123R3N321 45f5b4b
Merge branch 'main' into libcpp-ren
123R3N321 25ea9a8
Modify e2e.yml permission to read
123R3N321 65de0d3
Restore e2e.yml permission to write
123R3N321 28ae252
Modify e2e.yml
123R3N321 dc3e692
Fix e2e.yml privilege syntax
123R3N321 6c7cf75
Add harness py script for libcpp to be reflected in report gen.
123R3N321 834d05e
Add libcpp json existence check to make test command.
123R3N321 89cc301
Add steps to make report generation call.
123R3N321 8ddf1f4
Adjust e2e.yml \n Remove secondary libcpp header testing job.
123R3N321 af40e41
Add command to migrate compiled llvm artifacts to sysroot for cpp com…
123R3N321 ff78a29
remove stale sysroot from glibc
123R3N321 00fb2b3
Modify libcpp harness.
123R3N321 7454c05
Adjust html rendering text.
123R3N321 5f0c9a0
Add .wasm execution with scripts/lind_run call on artifact compiled f…
123R3N321 bbbf807
Modify cpp unit test case behavior.
123R3N321 fca0425
Remove deprecated trial/ dir used for .cpp testing; change reflected …
123R3N321 4a0f278
Move libcpp header integration documentation into docs; edits needed.
123R3N321 a77bab2
Modify libcpp harness file; add cwasm cleansing after build and run.
123R3N321 6315d0c
Modify cpp test main func signature; fix to avoid argv count mismatch…
123R3N321 4ae9098
Move libcpp header doc; Remove old doc.
123R3N321 52bb73a
Remove artifact build scripts.
123R3N321 a0ac0bb
Modify lind_compile_cpp script; clean stale lind_compile content.
123R3N321 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,22 @@ | ||
| # Reuse the same base/build logic style as Dockerfile.e2e | ||
|
|
||
| FROM base AS build-libcpp | ||
|
|
||
| COPY . . | ||
|
|
||
| RUN make sysroot | ||
|
|
||
| RUN cp -r artifacts/include/wasm32-wasi/. build/sysroot/include/wasm32-wasi/ \ | ||
| && cp -r artifacts/lib/wasm32-wasi/. build/sysroot/lib/wasm32-wasi/ | ||
|
|
||
| RUN chmod +x scripts/lind_compile_cpp \ | ||
| && rm -f tests/unit-tests/cpp/*.wasm \ | ||
| && scripts/lind_compile_cpp tests/unit-tests/cpp/hello.cpp \ | ||
| && test -n "$(find tests/unit-tests/cpp -maxdepth 1 -type f -name '*.wasm' | head -n 1)" | ||
|
|
||
| RUN mkdir -p /out \ | ||
| && cp "$(find tests/unit-tests/cpp -maxdepth 1 -type f -name '*.wasm' | head -n 1)" /out/hello.cpp.wasm \ | ||
| && printf '%s\n' 'LIBCPP_STATUS=pass' > /out/libcpp_status | ||
|
|
||
| FROM scratch | ||
| COPY --from=build-libcpp /out/ / |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
|
123R3N321 marked this conversation as resolved.
Outdated
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,27 @@ | ||
| # Toolchain-WASI.cmake | ||
| set(CMAKE_SYSTEM_NAME Linux) | ||
| set(CMAKE_SYSTEM_PROCESSOR wasm32) | ||
|
|
||
| set(CLANG_BIN "/home/lind/lind-wasm/clang+llvm-18.1.8-x86_64-linux-gnu-ubuntu-18.04/bin") | ||
| set(CMAKE_C_COMPILER "${CLANG_BIN}/clang") | ||
| set(CMAKE_CXX_COMPILER "${CLANG_BIN}/clang++") | ||
| set(CMAKE_LINKER "${CLANG_BIN}/bin/wasm-ld") | ||
| set(CMAKE_SYSROOT "/home/lind/lind-wasm/build/sysroot") | ||
|
|
||
| set(CMAKE_C_COMPILER_TARGET wasm32-unknown-wasi) | ||
| set(CMAKE_CXX_COMPILER_TARGET wasm32-unknown-wasi) | ||
|
|
||
| set(CMAKE_C_FLAGS_INIT "-pthread -matomics -mbulk-memory -static -nostdlib -nodefaultlibs -fno-exceptions -fno-unwind-tables") | ||
| set(CMAKE_CXX_FLAGS_INIT "-frtti -pthread -matomics -mbulk-memory -static -nostdlib -nodefaultlibs -fno-exceptions -stdlib=libc++ -fno-unwind-tables") | ||
| set(CMAKE_EXE_LINKER_FLAGS_INIT "-static -nostdlib -nodefaultlibs") | ||
|
|
||
| # Optional: disable rpath injection | ||
| set(CMAKE_SKIP_RPATH ON) | ||
|
|
||
| # These fix platform error | ||
| set(LLVM_HOST_TRIPLE "wasm32-wasip1") | ||
| set(LLVM_DEFAULT_TARGET_TRIPLE "wasm32-wasip1") | ||
|
|
||
| set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) | ||
| set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) | ||
| set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) |
58 changes: 58 additions & 0 deletions
58
artifacts/include/wasm32-wasi/c++/v1/__algorithm/adjacent_find.h
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,58 @@ | ||
| // -*- C++ -*- | ||
| //===----------------------------------------------------------------------===// | ||
| // | ||
| // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. | ||
| // See https://llvm.org/LICENSE.txt for license information. | ||
| // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
| // | ||
| //===----------------------------------------------------------------------===// | ||
|
|
||
| #ifndef _LIBCPP___ALGORITHM_ADJACENT_FIND_H | ||
| #define _LIBCPP___ALGORITHM_ADJACENT_FIND_H | ||
|
|
||
| #include <__algorithm/comp.h> | ||
| #include <__algorithm/iterator_operations.h> | ||
| #include <__config> | ||
| #include <__iterator/iterator_traits.h> | ||
| #include <__utility/move.h> | ||
|
|
||
| #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) | ||
| # pragma GCC system_header | ||
| #endif | ||
|
|
||
| _LIBCPP_PUSH_MACROS | ||
| #include <__undef_macros> | ||
|
|
||
| _LIBCPP_BEGIN_NAMESPACE_STD | ||
|
|
||
| template <class _Iter, class _Sent, class _BinaryPredicate> | ||
| _LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _Iter | ||
| __adjacent_find(_Iter __first, _Sent __last, _BinaryPredicate&& __pred) { | ||
| if (__first == __last) | ||
| return __first; | ||
| _Iter __i = __first; | ||
| while (++__i != __last) { | ||
| if (__pred(*__first, *__i)) | ||
| return __first; | ||
| __first = __i; | ||
| } | ||
| return __i; | ||
| } | ||
|
|
||
| template <class _ForwardIterator, class _BinaryPredicate> | ||
| _LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _ForwardIterator | ||
| adjacent_find(_ForwardIterator __first, _ForwardIterator __last, _BinaryPredicate __pred) { | ||
| return std::__adjacent_find(std::move(__first), std::move(__last), __pred); | ||
| } | ||
|
|
||
| template <class _ForwardIterator> | ||
| _LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _ForwardIterator | ||
| adjacent_find(_ForwardIterator __first, _ForwardIterator __last) { | ||
| return std::adjacent_find(std::move(__first), std::move(__last), __equal_to()); | ||
| } | ||
|
|
||
| _LIBCPP_END_NAMESPACE_STD | ||
|
|
||
| _LIBCPP_POP_MACROS | ||
|
|
||
| #endif // _LIBCPP___ALGORITHM_ADJACENT_FIND_H |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.