Skip to content
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

Initial support for wasmtime package #6083

Merged
merged 25 commits into from
Sep 6, 2021

Conversation

redradist
Copy link
Contributor

@redradist redradist commented Jun 29, 2021

Specify library name and version: wasmtime/0.29.0


  • I've read the guidelines for contributing.
  • I've followed the PEP8 style guides for Python code in the recipes.
  • I've used the latest Conan client version.
  • I've tried at least one configuration locally with the
    conan-center hook activated.

@redradist redradist changed the title Initial support for wasmtime package [WIP] Initial support for wasmtime package Jun 29, 2021
@redradist redradist changed the title [WIP] Initial support for wasmtime package Initial support for wasmtime package Jun 29, 2021
@conan-center-bot

This comment has been minimized.

@conan-center-bot

This comment has been minimized.

@conan-center-bot

This comment has been minimized.

@redradist redradist force-pushed the add-wasmtime branch 2 times, most recently from 50fbaa9 to 7663797 Compare July 1, 2021 18:57
@conan-center-bot

This comment has been minimized.

@conan-center-bot

This comment has been minimized.

@conan-center-bot

This comment has been minimized.

@conan-center-bot

This comment has been minimized.

@conan-center-bot

This comment has been minimized.

Copy link
Contributor

@prince-chrismc prince-chrismc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

recipes/wasmtime/all/conanfile.py Outdated Show resolved Hide resolved
recipes/wasmtime/all/conanfile.py Outdated Show resolved Hide resolved
self.cpp_info.libs = ["wasmtime"]
else:
if self.settings.os == "Windows":
self.cpp_info.defines= ["/DWASM_API_EXTERN=", "/DWASI_API_EXTERN="]
Copy link
Contributor

@prince-chrismc prince-chrismc Jul 3, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

conan should handle the rest

Suggested change
self.cpp_info.defines= ["/DWASM_API_EXTERN=", "/DWASI_API_EXTERN="]
self.cpp_info.defines.extend(["WASM_API_EXTERN", "WASI_API_EXTERN"])

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Without /D conan generates some strange defines and test_package does not work:

set(CONAN_DEFINES_WASMTIME "-DWASM_API_EXTERN"
			"-DWASI_API_EXTERN")
set(CONAN_BUILD_MODULES_PATHS_WASMTIME )
# COMPILE_DEFINITIONS are equal to CONAN_DEFINES without -D, for targets
set(CONAN_COMPILE_DEFINITIONS_WASMTIME "WASM_API_EXTERN"
			"WASI_API_EXTERN")

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This works for a lot of other recipes. https://github.com/conan-io/conan-center-index/search?p=2&q=cpp_info+defines

You need to use it in tandem with the other comment https://github.com/conan-io/conan-center-index/pull/6083/files#r663361146

I update the suggestion with a better syntax

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is better syntax, but it is not working ...
Please, check it locally in Windows machine

recipes/wasmtime/all/conanfile.py Outdated Show resolved Hide resolved

add_executable(example example.cpp)
target_link_libraries(example PRIVATE wasmtime::wasmtime)
target_compile_options(example PRIVATE ${CONAN_COMPILE_DEFINITIONS_WASMTIME})
Copy link
Contributor

@prince-chrismc prince-chrismc Jul 3, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should be included with the targets

Suggested change
target_compile_options(example PRIVATE ${CONAN_COMPILE_DEFINITIONS_WASMTIME})

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I cannot do this, because wasmtime::wasmtime do not have compile definitions for this target ...
By some reason conan do not add target_compile_definitions(...) for this target

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also very strange behavior:

set(CONAN_DEFINES_WASMTIME "-D/DWASM_API_EXTERN="
			"-D/DWASI_API_EXTERN=")
set(CONAN_BUILD_MODULES_PATHS_WASMTIME )
# COMPILE_DEFINITIONS are equal to CONAN_DEFINES without -D, for targets
set(CONAN_COMPILE_DEFINITIONS_WASMTIME "/DWASM_API_EXTERN="
			"/DWASI_API_EXTERN=")

CONAN_COMPILE_DEFINITIONS_WASMTIME generated properly, but CONAN_DEFINES_WASMTIME is incorrect

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No it is not, see comment above for it

recipes/wasmtime/all/conanfile.py Outdated Show resolved Hide resolved
recipes/wasmtime/all/conanfile.py Outdated Show resolved Hide resolved

class WasmtimeConan(ConanFile):
name = 'wasmtime'
homepage = 'https://github.com/bytecodealliance/wasmtime'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
homepage = 'https://github.com/bytecodealliance/wasmtime'
homepage = 'https://wasmtime.dev/'

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Disagree, because later I will add package for wasmtime-cpp and it would be weird to have two projects with the same home directory

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Those should be the same recipe.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would be separate receipts wasmtime (only C API) and wasmtime-cpp (C++ API)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also https://wasmtime.dev/ is not descriptive enough for understanding how to use this package

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, you will still need this package
As I mentioned previously I will create support with dependency on this package when I will create wasmtime-cpp
See the issue:
bytecodealliance/wasmtime-cpp#1

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's okay to have two recipes share the same homepage.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Home page should be meaningful
https://wasmtime.dev/ does not

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perhaps you're right.
The c api lives in the main/crates/c-api subfolder.

How does this project relate to wasm-c-api at https://github.com/WebAssembly/wasm-c-api/?

Copy link
Contributor Author

@redradist redradist Jul 26, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@madebr It is unrelated project

recipes/wasmtime/all/conanfile.py Outdated Show resolved Hide resolved
recipes/wasmtime/all/CMakeLists.txt Outdated Show resolved Hide resolved
@redradist
Copy link
Contributor Author

redradist commented Jul 3, 2021

@prince-chrismc

Typically we a hesitant about adding binary downloads https://github.com/conan-io/conan-center-index/blob/41d4fbb8c218f9d938ccb8b9d888bff52002e62e/docs/packaging_policy.md

https://github.com/conan-io/conan-center-index/blob/10d383fc84cf69517484605eb4316a10ce9ffaf6/docs/faqs.md#what-is-the-policy-on-creating-packages-from-pre-compiled-binaries

You'll need to wait for the CCI teams to move this forward of not

This policy that you mentioned looks bad ... Because there are lots of ways to signal that package has vulnerabilities, for example to mark it with some flag, also source code could be analyzed by homepage

Official support will be provided by me bytecodealliance/wasmtime-cpp#1

Biulding from sources is not available, because this package is build by cargo for Rust language

@prince-chrismc
Copy link
Contributor

You can build the rust compiler https://github.com/rust-lang/rust#installing-from-source add it as a build requirements and compile this project from source

@redradist
Copy link
Contributor Author

@prince-chrismc

You can build the rust compiler https://github.com/rust-lang/rust#installing-from-source add it as a build requirements and compile this project from source

What is the point of doing this ? Why conan have binary package ?
Is not it enough to have sha256 for a package ?

@prince-chrismc
Copy link
Contributor

Conan produces binary packages from source code to be consumed... by downloading from other services theres a risk of incompatiblity with ABI and platform variations. Not all binaries are permitted to be distrusted which has also been an issue in the past.

The last PR of this nature is stalled so I just wanted to warn you this topic has not been resolved. Packaging pre compiled binaries is possible it's just an on going issue in CCI

@conan-center-bot

This comment has been minimized.

@conan-center-bot

This comment has been minimized.

except KeyError:
raise ConanInvalidConfiguration("Binaries for this combination of architecture/version/os not available")

if (self.settings.compiler, self.settings.os) == ("gcc", "Windows") and self.options.shared:
# FIXME: https://github.com/bytecodealliance/wasmtime/issues/3168
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was merged in

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Indeed, but we will need to wait for the next release to have shared mingw avaialble.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ahh I did not look, but thats for checking!

@conan-center-bot

This comment has been minimized.

madebr
madebr previously approved these changes Aug 30, 2021
@redradist
Copy link
Contributor Author

@Croydon @prince-chrismc @SSE4 @uilianries @jgsogo
Can you review this PR again ?
Most of the comments answered again :)

@conan-center-bot

This comment has been minimized.

@conan-center-bot

This comment has been minimized.

@conan-center-bot
Copy link
Collaborator

All green in build 33 (3012cca0c38c32b1e064e9ea178d8cd0c111f6c0):

  • wasmtime/0.29.0@:
    All packages built successfully! (All logs)

Copy link
Contributor

@jgsogo jgsogo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm worried about the issue with self.cpp_info.defines, but it's probably more related to a Conan client missing/incomplete feature. Now with the new toolchains effort, it's the time to try and fix these errors.

Anyway, I see value having this recipe available to build on top of it. As always, details and improvements will arrive in following PRs 💪

@prince-chrismc
Copy link
Contributor

this is blocked by an old review

PR By Opened Recipe Reviews Last 🛑 Blockers 🌟 Approvers
#6083 redradist Jun 29 🆕 wasmtime 139 Aug 31 @uilianries madebr, jgsogo, prince-chrismc

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants