mirror of
https://github.com/XRPLF/rippled.git
synced 2025-11-28 15:05:53 +00:00
Switch to rust docker (#6061)
* fix clang-format * Switch to rust docker * fix wasmi conan package * Add TODO * Add patch description * Switch to latest prepare-runner
This commit is contained in:
1
.github/actions/build-deps/action.yml
vendored
1
.github/actions/build-deps/action.yml
vendored
@@ -35,6 +35,7 @@ runs:
|
||||
LOG_VERBOSITY: ${{ inputs.log_verbosity }}
|
||||
run: |
|
||||
echo 'Installing dependencies.'
|
||||
conan export --version 0.42.1 external/wasmi #TODO Switch to conan package
|
||||
mkdir -p "${BUILD_DIR}"
|
||||
cd "${BUILD_DIR}"
|
||||
conan install \
|
||||
|
||||
56
.github/scripts/strategy-matrix/linux.json
vendored
56
.github/scripts/strategy-matrix/linux.json
vendored
@@ -15,196 +15,196 @@
|
||||
"distro_version": "bookworm",
|
||||
"compiler_name": "gcc",
|
||||
"compiler_version": "12",
|
||||
"image_sha": "0525eae"
|
||||
"image_sha": "ca4517d"
|
||||
},
|
||||
{
|
||||
"distro_name": "debian",
|
||||
"distro_version": "bookworm",
|
||||
"compiler_name": "gcc",
|
||||
"compiler_version": "13",
|
||||
"image_sha": "0525eae"
|
||||
"image_sha": "ca4517d"
|
||||
},
|
||||
{
|
||||
"distro_name": "debian",
|
||||
"distro_version": "bookworm",
|
||||
"compiler_name": "gcc",
|
||||
"compiler_version": "14",
|
||||
"image_sha": "0525eae"
|
||||
"image_sha": "ca4517d"
|
||||
},
|
||||
{
|
||||
"distro_name": "debian",
|
||||
"distro_version": "bookworm",
|
||||
"compiler_name": "gcc",
|
||||
"compiler_version": "15",
|
||||
"image_sha": "0525eae"
|
||||
"image_sha": "ca4517d"
|
||||
},
|
||||
{
|
||||
"distro_name": "debian",
|
||||
"distro_version": "bookworm",
|
||||
"compiler_name": "clang",
|
||||
"compiler_version": "16",
|
||||
"image_sha": "0525eae"
|
||||
"image_sha": "ca4517d"
|
||||
},
|
||||
{
|
||||
"distro_name": "debian",
|
||||
"distro_version": "bookworm",
|
||||
"compiler_name": "clang",
|
||||
"compiler_version": "17",
|
||||
"image_sha": "0525eae"
|
||||
"image_sha": "ca4517d"
|
||||
},
|
||||
{
|
||||
"distro_name": "debian",
|
||||
"distro_version": "bookworm",
|
||||
"compiler_name": "clang",
|
||||
"compiler_version": "18",
|
||||
"image_sha": "0525eae"
|
||||
"image_sha": "ca4517d"
|
||||
},
|
||||
{
|
||||
"distro_name": "debian",
|
||||
"distro_version": "bookworm",
|
||||
"compiler_name": "clang",
|
||||
"compiler_version": "19",
|
||||
"image_sha": "0525eae"
|
||||
"image_sha": "ca4517d"
|
||||
},
|
||||
{
|
||||
"distro_name": "debian",
|
||||
"distro_version": "bookworm",
|
||||
"compiler_name": "clang",
|
||||
"compiler_version": "20",
|
||||
"image_sha": "0525eae"
|
||||
"image_sha": "ca4517d"
|
||||
},
|
||||
{
|
||||
"distro_name": "debian",
|
||||
"distro_version": "trixie",
|
||||
"compiler_name": "gcc",
|
||||
"compiler_version": "14",
|
||||
"image_sha": "0525eae"
|
||||
"image_sha": "ca4517d"
|
||||
},
|
||||
{
|
||||
"distro_name": "debian",
|
||||
"distro_version": "trixie",
|
||||
"compiler_name": "gcc",
|
||||
"compiler_version": "15",
|
||||
"image_sha": "0525eae"
|
||||
"image_sha": "ca4517d"
|
||||
},
|
||||
{
|
||||
"distro_name": "debian",
|
||||
"distro_version": "trixie",
|
||||
"compiler_name": "clang",
|
||||
"compiler_version": "20",
|
||||
"image_sha": "0525eae"
|
||||
"image_sha": "ca4517d"
|
||||
},
|
||||
{
|
||||
"distro_name": "debian",
|
||||
"distro_version": "trixie",
|
||||
"compiler_name": "clang",
|
||||
"compiler_version": "21",
|
||||
"image_sha": "0525eae"
|
||||
"image_sha": "ca4517d"
|
||||
},
|
||||
{
|
||||
"distro_name": "rhel",
|
||||
"distro_version": "8",
|
||||
"compiler_name": "gcc",
|
||||
"compiler_version": "14",
|
||||
"image_sha": "e1782cd"
|
||||
"image_sha": "ca4517d"
|
||||
},
|
||||
{
|
||||
"distro_name": "rhel",
|
||||
"distro_version": "8",
|
||||
"compiler_name": "clang",
|
||||
"compiler_version": "any",
|
||||
"image_sha": "e1782cd"
|
||||
"image_sha": "ca4517d"
|
||||
},
|
||||
{
|
||||
"distro_name": "rhel",
|
||||
"distro_version": "9",
|
||||
"compiler_name": "gcc",
|
||||
"compiler_version": "12",
|
||||
"image_sha": "e1782cd"
|
||||
"image_sha": "ca4517d"
|
||||
},
|
||||
{
|
||||
"distro_name": "rhel",
|
||||
"distro_version": "9",
|
||||
"compiler_name": "gcc",
|
||||
"compiler_version": "13",
|
||||
"image_sha": "e1782cd"
|
||||
"image_sha": "ca4517d"
|
||||
},
|
||||
{
|
||||
"distro_name": "rhel",
|
||||
"distro_version": "9",
|
||||
"compiler_name": "gcc",
|
||||
"compiler_version": "14",
|
||||
"image_sha": "e1782cd"
|
||||
"image_sha": "ca4517d"
|
||||
},
|
||||
{
|
||||
"distro_name": "rhel",
|
||||
"distro_version": "9",
|
||||
"compiler_name": "clang",
|
||||
"compiler_version": "any",
|
||||
"image_sha": "e1782cd"
|
||||
"image_sha": "ca4517d"
|
||||
},
|
||||
{
|
||||
"distro_name": "rhel",
|
||||
"distro_version": "10",
|
||||
"compiler_name": "gcc",
|
||||
"compiler_version": "14",
|
||||
"image_sha": "e1782cd"
|
||||
"image_sha": "ca4517d"
|
||||
},
|
||||
{
|
||||
"distro_name": "rhel",
|
||||
"distro_version": "10",
|
||||
"compiler_name": "clang",
|
||||
"compiler_version": "any",
|
||||
"image_sha": "e1782cd"
|
||||
"image_sha": "ca4517d"
|
||||
},
|
||||
{
|
||||
"distro_name": "ubuntu",
|
||||
"distro_version": "jammy",
|
||||
"compiler_name": "gcc",
|
||||
"compiler_version": "12",
|
||||
"image_sha": "e1782cd"
|
||||
"image_sha": "ca4517d"
|
||||
},
|
||||
{
|
||||
"distro_name": "ubuntu",
|
||||
"distro_version": "noble",
|
||||
"compiler_name": "gcc",
|
||||
"compiler_version": "13",
|
||||
"image_sha": "e1782cd"
|
||||
"image_sha": "ca4517d"
|
||||
},
|
||||
{
|
||||
"distro_name": "ubuntu",
|
||||
"distro_version": "noble",
|
||||
"compiler_name": "gcc",
|
||||
"compiler_version": "14",
|
||||
"image_sha": "e1782cd"
|
||||
"image_sha": "ca4517d"
|
||||
},
|
||||
{
|
||||
"distro_name": "ubuntu",
|
||||
"distro_version": "noble",
|
||||
"compiler_name": "clang",
|
||||
"compiler_version": "16",
|
||||
"image_sha": "e1782cd"
|
||||
"image_sha": "ca4517d"
|
||||
},
|
||||
{
|
||||
"distro_name": "ubuntu",
|
||||
"distro_version": "noble",
|
||||
"compiler_name": "clang",
|
||||
"compiler_version": "17",
|
||||
"image_sha": "e1782cd"
|
||||
"image_sha": "ca4517d"
|
||||
},
|
||||
{
|
||||
"distro_name": "ubuntu",
|
||||
"distro_version": "noble",
|
||||
"compiler_name": "clang",
|
||||
"compiler_version": "18",
|
||||
"image_sha": "e1782cd"
|
||||
"image_sha": "ca4517d"
|
||||
},
|
||||
{
|
||||
"distro_name": "ubuntu",
|
||||
"distro_version": "noble",
|
||||
"compiler_name": "clang",
|
||||
"compiler_version": "19",
|
||||
"image_sha": "e1782cd"
|
||||
"image_sha": "ca4517d"
|
||||
}
|
||||
],
|
||||
"build_type": ["Debug", "Release"],
|
||||
|
||||
@@ -77,7 +77,7 @@ jobs:
|
||||
uses: actions/checkout@08eba0b27e820071cde6df949e0beb9ba4906955 # v4.3.0
|
||||
|
||||
- name: Prepare runner
|
||||
uses: XRPLF/actions/.github/actions/prepare-runner@99685816bb60a95a66852f212f382580e180df3a
|
||||
uses: XRPLF/actions/.github/actions/prepare-runner@ff9f8f649df5855ffe1a1ae715df43e51807f2e0
|
||||
with:
|
||||
disable_ccache: false
|
||||
|
||||
|
||||
2
.github/workflows/upload-conan-deps.yml
vendored
2
.github/workflows/upload-conan-deps.yml
vendored
@@ -70,7 +70,7 @@ jobs:
|
||||
uses: actions/checkout@08eba0b27e820071cde6df949e0beb9ba4906955 # v4.3.0
|
||||
|
||||
- name: Prepare runner
|
||||
uses: XRPLF/actions/.github/actions/prepare-runner@99685816bb60a95a66852f212f382580e180df3a
|
||||
uses: XRPLF/actions/.github/actions/prepare-runner@ff9f8f649df5855ffe1a1ae715df43e51807f2e0
|
||||
with:
|
||||
disable_ccache: false
|
||||
|
||||
|
||||
14
external/wasmi/conandata.yml
vendored
14
external/wasmi/conandata.yml
vendored
@@ -1,5 +1,11 @@
|
||||
# Do not update. Maintained by programmability team.
|
||||
|
||||
sources:
|
||||
"0.42.1":
|
||||
sha256: 2a5697be33c7afce8f671af4a5a3621d9e93ce55d253d31bd8201458e465fbb8
|
||||
url: https://github.com/wasmi-labs/wasmi/archive/refs/tags/v0.42.1.tar.gz
|
||||
patches:
|
||||
0.42.1:
|
||||
- patch_description: install only static lib (to prevent conflict with shared)
|
||||
patch_file: patches/wasmi.patch
|
||||
patch_type: conan
|
||||
"0.42.1":
|
||||
- patch_file: "patches/0001-xrplf-0.42.1.patch"
|
||||
patch_type: conan
|
||||
patch_description: Integration patch. Make wasmi lib to be able to build with existing smart-escrow branch.
|
||||
|
||||
56
external/wasmi/conanfile.py
vendored
56
external/wasmi/conanfile.py
vendored
@@ -1,16 +1,9 @@
|
||||
from conan import ConanFile, tools
|
||||
from conan.tools.cmake import CMake, CMakeToolchain, CMakeDeps, cmake_layout
|
||||
from conan.tools.files import (
|
||||
apply_conandata_patches,
|
||||
export_conandata_patches,
|
||||
# get,
|
||||
)
|
||||
from conan.tools.scm import Git
|
||||
|
||||
from conan.tools.files import apply_conandata_patches, export_conandata_patches, get
|
||||
import os
|
||||
# import json
|
||||
|
||||
required_conan_version = ">=1.55.0"
|
||||
required_conan_version = ">=2.0.0"
|
||||
|
||||
class WasmiConan(ConanFile):
|
||||
name = "wasmi"
|
||||
@@ -18,73 +11,38 @@ class WasmiConan(ConanFile):
|
||||
url = "https://github.com/wasmi-labs/wasmi.git"
|
||||
description = "WebAssembly (Wasm) interpreter"
|
||||
package_type = "library"
|
||||
settings = "os", "compiler", "build_type", "arch"
|
||||
options = {"shared": [True, False]}
|
||||
settings = "os", "arch", "compiler", "build_type"
|
||||
options = {"shared": [False]}
|
||||
default_options = {"shared": False}
|
||||
# generators = "CMakeToolchain", "CMakeDeps"
|
||||
#requires = [("llvm/20.1.1@")]
|
||||
|
||||
def export_sources(self):
|
||||
export_conandata_patches(self)
|
||||
pass
|
||||
|
||||
# def build_requirements(self):
|
||||
# self.tool_requires("llvm/20.1.1")
|
||||
|
||||
|
||||
def config_options(self):
|
||||
#if self.settings.os == "Windows":
|
||||
# del self.options.fPIC
|
||||
pass
|
||||
|
||||
|
||||
def layout(self):
|
||||
cmake_layout(self, src_folder="src")
|
||||
|
||||
|
||||
def source(self):
|
||||
git = Git(self)
|
||||
git.fetch_commit(
|
||||
url="https://github.com/wasmi-labs/wasmi.git",
|
||||
commit="f628a7a86c9715f2c306f6ef9aea1cc2bdca5fa7",
|
||||
)
|
||||
#get(self, **self.conan_data["sources"][self.version], strip_root=True)
|
||||
|
||||
get(self, **self.conan_data["sources"][self.version], strip_root=True)
|
||||
apply_conandata_patches(self)
|
||||
|
||||
def generate(self):
|
||||
tc = CMakeToolchain(self)
|
||||
|
||||
tc.variables["CMAKE_CXX_STANDARD"] = 20
|
||||
tc.variables["BUILD_SHARED_LIBS"] = 0
|
||||
|
||||
tc.variables["BUILD_SHARED_LIBS"] = self.options.shared
|
||||
tc.generate()
|
||||
|
||||
# This generates "foo-config.cmake" and "bar-config.cmake" in self.generators_folder
|
||||
deps = CMakeDeps(self)
|
||||
deps.generate()
|
||||
|
||||
|
||||
def build(self):
|
||||
apply_conandata_patches(self)
|
||||
cmake = CMake(self)
|
||||
cmake.verbose = True
|
||||
cmake.configure(build_script_folder=os.path.join(self.source_folder, "crates", "c_api"))
|
||||
cmake.build()
|
||||
#self.run(f'echo {self.source_folder}')
|
||||
|
||||
# Explicit way:
|
||||
# self.run('cmake %s/hello %s' % (self.source_folder, cmake.command_line))
|
||||
# self.run("cmake --build . %s" % cmake.build_config)
|
||||
|
||||
|
||||
def package(self):
|
||||
cmake = CMake(self)
|
||||
cmake.verbose = True
|
||||
cmake.install()
|
||||
|
||||
|
||||
def package_info(self):
|
||||
self.cpp_info.libs = ["wasmi"]
|
||||
self.cpp_info.names["cmake_find_package"] = "wasmi"
|
||||
self.cpp_info.names["cmake_find_package_multi"] = "wasmi"
|
||||
|
||||
|
||||
@@ -1,61 +1,54 @@
|
||||
diff --git a/crates/c_api/CMakeLists.txt b/crates/c_api/CMakeLists.txt
|
||||
index b15c787a..2420bea2 100644
|
||||
index b15c787a..4e6de690 100644
|
||||
--- a/crates/c_api/CMakeLists.txt
|
||||
+++ b/crates/c_api/CMakeLists.txt
|
||||
@@ -43,6 +43,11 @@ endif()
|
||||
@@ -43,6 +43,10 @@ endif()
|
||||
list(TRANSFORM WASMI_SHARED_FILES PREPEND ${WASMI_TARGET_DIR}/)
|
||||
list(TRANSFORM WASMI_STATIC_FILES PREPEND ${WASMI_TARGET_DIR}/)
|
||||
|
||||
+if(NOT BUILD_SHARED_LIBS)
|
||||
+ set(WASMI_SHARED_FILES )
|
||||
+ set(WASMI_SHARED_FILES)
|
||||
+endif()
|
||||
+
|
||||
+
|
||||
# Instructions on how to build and install the Wasmi Rust crate.
|
||||
find_program(WASMI_CARGO_BINARY cargo REQUIRED)
|
||||
include(ExternalProject)
|
||||
@@ -112,23 +117,25 @@ install(
|
||||
@@ -112,6 +116,7 @@ install(
|
||||
DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
||||
)
|
||||
|
||||
-if(WASMI_TARGET MATCHES "darwin")
|
||||
- set(INSTALLED_LIB "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}/libwasmi.dylib")
|
||||
- install(
|
||||
- FILES "${INSTALLED_LIB}"
|
||||
- DESTINATION "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}"
|
||||
- COMPONENT Runtime
|
||||
- )
|
||||
- if(NOT CMAKE_INSTALL_NAME_TOOL)
|
||||
- message(WARNING "CMAKE_INSTALL_NAME_TOOL is not set. LC_ID_DYLIB for libwasmi.dylib will not be set.")
|
||||
- else()
|
||||
- set(install_name_tool_cmd
|
||||
- "${CMAKE_INSTALL_NAME_TOOL}"
|
||||
- "-id"
|
||||
- "@rpath/libwasmi.dylib"
|
||||
- "${INSTALLED_LIB}"
|
||||
+if(BUILD_SHARED_LIBS)
|
||||
+ if(WASMI_TARGET MATCHES "darwin")
|
||||
+ set(INSTALLED_LIB "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}/libwasmi.dylib")
|
||||
+ install(
|
||||
+ FILES "${INSTALLED_LIB}"
|
||||
+ DESTINATION "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}"
|
||||
+ COMPONENT Runtime
|
||||
)
|
||||
- install(CODE "execute_process(COMMAND ${install_name_tool_cmd})")
|
||||
+ if(NOT CMAKE_INSTALL_NAME_TOOL)
|
||||
+ message(WARNING "CMAKE_INSTALL_NAME_TOOL is not set. LC_ID_DYLIB for libwasmi.dylib will not be set.")
|
||||
+ else()
|
||||
+ set(install_name_tool_cmd
|
||||
+ "${CMAKE_INSTALL_NAME_TOOL}"
|
||||
+ "-id"
|
||||
+ "@rpath/libwasmi.dylib"
|
||||
+ "${INSTALLED_LIB}"
|
||||
+ )
|
||||
+ install(CODE "execute_process(COMMAND ${install_name_tool_cmd})")
|
||||
+ endif()
|
||||
if(WASMI_TARGET MATCHES "darwin")
|
||||
set(INSTALLED_LIB "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}/libwasmi.dylib")
|
||||
install(
|
||||
@@ -131,6 +136,7 @@ if(WASMI_TARGET MATCHES "darwin")
|
||||
install(CODE "execute_process(COMMAND ${install_name_tool_cmd})")
|
||||
endif()
|
||||
endif()
|
||||
+endif()
|
||||
|
||||
# Documentation Generation via Doxygen:
|
||||
set(DOXYGEN_CONF_IN ${CMAKE_CURRENT_SOURCE_DIR}/doxygen.conf.in)
|
||||
@@ -141,19 +147,3 @@ add_custom_target(doc
|
||||
DEPENDS ${WASMI_GENERATED_CONF_H} ${DOXYGEN_CONF_OUT}
|
||||
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
|
||||
)
|
||||
-
|
||||
-# C-Header Formatting via clang-format:
|
||||
-find_program(CLANG_FORMAT clang-format REQUIRED)
|
||||
-file(GLOB_RECURSE HEADER_FILES
|
||||
- ${CMAKE_CURRENT_SOURCE_DIR}/include/wasmi.h
|
||||
- ${CMAKE_CURRENT_SOURCE_DIR}/include/wasmi/*.h
|
||||
- ${CMAKE_CURRENT_SOURCE_DIR}/include/wasmi/*.hh
|
||||
-)
|
||||
-add_custom_target(check-format
|
||||
- COMMAND ${CLANG_FORMAT} -style=llvm -Werror --dry-run ${HEADER_FILES}
|
||||
- COMMENT "clang-format: Check formatting for Wasmi C-API header files"
|
||||
-)
|
||||
-add_custom_target(format
|
||||
- COMMAND ${CLANG_FORMAT} -style=llvm -i ${HEADER_FILES}
|
||||
- COMMENT "clang-format: Apply formatting rules for Wasmi C-API header files"
|
||||
-)
|
||||
diff --git a/crates/c_api/include/wasm.h b/crates/c_api/include/wasm.h
|
||||
index 5ee617ff..0199192d 100644
|
||||
--- a/crates/c_api/include/wasm.h
|
||||
@@ -5,7 +5,6 @@
|
||||
#include <xrpld/app/tx/detail/NFTokenUtils.h>
|
||||
#include <xrpld/app/wasm/HostFunc.h>
|
||||
#include <xrpld/app/wasm/WasmVM.h>
|
||||
#include <xrpl/protocol/digest.h>
|
||||
|
||||
#include <xrpl/ledger/detail/ApplyViewBase.h>
|
||||
#include <xrpl/protocol/digest.h>
|
||||
|
||||
@@ -1,22 +1,3 @@
|
||||
//------------------------------------------------------------------------------
|
||||
/*
|
||||
This file is part of rippled: https://github.com/ripple/rippled
|
||||
Copyright (c) 2020 Ripple Labs Inc.
|
||||
|
||||
Permission to use, copy, modify, and/or distribute this software for any
|
||||
purpose with or without fee is hereby granted, provided that the above
|
||||
copyright notice and this permission notice appear in all copies.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
ANY SPECIAL , DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
//==============================================================================
|
||||
|
||||
#include <xrpld/app/wasm/WasmiVM.h>
|
||||
|
||||
#include <xrpl/basics/Log.h>
|
||||
@@ -135,8 +116,7 @@ InstanceWrapper::operator=(InstanceWrapper&& o)
|
||||
return *this;
|
||||
}
|
||||
|
||||
InstanceWrapper::
|
||||
operator bool() const
|
||||
InstanceWrapper::operator bool() const
|
||||
{
|
||||
return static_cast<bool>(instance_);
|
||||
}
|
||||
@@ -277,8 +257,7 @@ ModuleWrapper::operator=(ModuleWrapper&& o)
|
||||
return *this;
|
||||
}
|
||||
|
||||
ModuleWrapper::
|
||||
operator bool() const
|
||||
ModuleWrapper::operator bool() const
|
||||
{
|
||||
return instanceWrap_;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user