Skip to content

Conversation

perseoGI
Copy link
Contributor

@perseoGI perseoGI commented Jun 13, 2025

Summary

Original PR conan-io/conan-center-index#27213

@perseoGI perseoGI assigned jcar87 and unassigned jcar87 Jun 16, 2025
@AbrilRBS AbrilRBS self-requested a review June 16, 2025 09:43
@CLAassistant
Copy link

CLAassistant commented Jun 16, 2025

CLA assistant check
All committers have signed the CLA.

@perseoGI perseoGI marked this pull request as ready for review June 17, 2025 09:37
@skhaz
Copy link

skhaz commented Jun 30, 2025

Thank you so much, I will give a try.

@skhaz
Copy link

skhaz commented Jul 1, 2025

Apologies for my ignorance, but how would the migration of my profile to WebAssembly work, as shown below?

$ cat ~/.conan2/profiles/webassembly
include(default)

[settings]
arch=wasm
os=Emscripten

[tool_requires]
*: emsdk/4.0.10

@perseoGI
Copy link
Contributor Author

perseoGI commented Jul 2, 2025

@skhaz no problem at all!

This would be a great wasm 32-bit profile:

[settings]
arch=wasm
build_type=Release
compiler=emcc
compiler.cppstd=17
compiler.libcxx=libc++
# Choose between both types of multithreading support (or none)
# compiler.threads=<posix|wasm_workers>
compiler.version=4.0.10
os=Emscripten

[tool_requires]
ninja/[*]
emsdk/4.0.10

[conf]
# Set Ninja as default generator as it is faster and will avoid Windows issues
tools.cmake.cmaketoolchain:generator=Ninja

Notice the usage of Ninja (if you are in windows, its crucial to avoid some compilation issues, and in general, Ninja is a better opcion over Makefile).

And the usage of compiler=emcc which is the new built-in native support compiler in conan.

In the docs you could find more information about other architectures such the experimental wasm64.
Or the explanation of why it is very important to declare the compirel.version. Remember in conan v2, the compiler.version setting is kind of syntactic sugar. It does not do anything but allowing conan to set some specific flags and what is most important, create different package IDs which will act as a result in incompatible binaries if merging two packages with different compiler version. This is crucial as emcc (the emscripten compiler) does not guarantee ANY ABI compatibility across versions!

I hope it helps!

---
## 🧰 Built-in Profiles

This repository includes several **pre-configured Conan profiles** designed to make toolchain setup effortless:
Copy link
Contributor

Choose a reason for hiding this comment

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

Each "toolchain" should have a readme with tailored instructions - as I would expect this grow in the future.
I would refer to them as "reference" profiles - the ones we test, leaving it up to users to customise before installing. e.g. the "native" one still requires manual configuration, so I'm not sure that's effortless, there's still some use intervention needed in some instances.

we may consider having the profile .zip files as releases - so that a user can do conan config install https://github.com/xxxx/emsdk_profiles_1.0.zip or something like that - so that they get only what they need

@@ -0,0 +1,15 @@
[platform_tool_requires]
emsdk/4.0.10

Copy link
Contributor

Choose a reason for hiding this comment

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

The name "native" can be confusing because "native" usually means the "local cpu architecture".
I would probably go for another name.

This profile seems to assume that all these tools are discoverable in PATH, otherwise they won't work, other than perhaps in CMake.

Is there a case for adding a PATH in the [buildenv] section to point to the installation directory, in case it is not in the system PATH?

once again ,a README for this profiles may clarify these questions

generators = "CMakeToolchain", "VirtualBuildEnv"

def build_requirements(self):
self.tool_requires(self.tested_reference_str)
Copy link
Contributor

Choose a reason for hiding this comment

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

I would probably have a test_package that is a regular requires and tests the post-conditions (e.g. checking emcc is called, etc)

and a separate, standalone "sample" project that is tested with the profiles in the profiles/emsdk folder instead. That way we test all the profiles

@skhaz
Copy link

skhaz commented Jul 2, 2025

Thank you so much @perseoGI.

Sorry bugging you again, I am just trying to help.

Do you know if do I need some extra setup?

ERROR: Package 'emsdk/4.0.10' not resolved: Unable to find 'emsdk/4.0.10' in remotes.

Ot it is not published yet?

cat ~/.conan2/profiles/default
[settings]
arch=armv8
build_type=Release
compiler=apple-clang
compiler.cppstd=gnu17
compiler.libcxx=libc++
compiler.version=17
os=Macos

[replace_tool_requires]
meson/*: meson/[*]
pkgconf/*: pkgconf/[*]

[tool_requires]
!cmake/*: cmake/[>=3 <4]

[conf]
tools.cmake.cmaketoolchain:generator=Ninja
cat ~/.conan2/profiles/webassembly
include(default)

[tool_requires]
ninja/[*]
emsdk/4.0.10

[settings]
arch=wasm
build_type=Release
compiler=emcc
compiler.cppstd=17
compiler.libcxx=libc++
compiler.version=4.0.10
os=Emscripten

@jcar87
Copy link
Contributor

jcar87 commented Jul 2, 2025

Thank you so much @perseoGI.

Sorry bugging you again, I am just trying to help.

Do you know if do I need some extra setup?

ERROR: Package 'emsdk/4.0.10' not resolved: Unable to find 'emsdk/4.0.10' in remotes.

Ot it is not published yet?

cat ~/.conan2/profiles/default
[settings]
arch=armv8
build_type=Release
compiler=apple-clang
compiler.cppstd=gnu17
compiler.libcxx=libc++
compiler.version=17
os=Macos

[replace_tool_requires]
meson/*: meson/[*]
pkgconf/*: pkgconf/[*]

[tool_requires]
!cmake/*: cmake/[>=3 <4]

[conf]
tools.cmake.cmaketoolchain:generator=Ninja
cat ~/.conan2/profiles/webassembly
include(default)

[tool_requires]
ninja/[*]
emsdk/4.0.10

[settings]
arch=wasm
build_type=Release
compiler=emcc
compiler.cppstd=17
compiler.libcxx=libc++
compiler.version=4.0.10
os=Emscripten

Hi @skhaz

For the time being - this new repo will be available as a local recipes index and not published to Conan Center - we want the focus of Conan Center to remain on libraries, and treat these (there will be more!) as a separate case - eventually we may make the recipes available in a remote.

You'd have to follow these instructions: https://github.com/perseoGI/conan-toolchains/tree/pgi/new/emsdk, however since it has not been merged, you have to do the following:

git clone https://github.com/perseoGI/conan-toolchains.git -b pgi/new/emsdk
conan remote add conan-toolchains ./conan-toolchains

For the recipe to be available.

@skhaz
Copy link

skhaz commented Jul 2, 2025

My bad, thank you so much.

@paulocoutinhox
Copy link

+1

Copy link
Member

@memsharded memsharded left a comment

Choose a reason for hiding this comment

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

I have reviewed the emsdk recipe part mostly, and there are a couple of comments to check, but overall looks good.

For the CI part, I haven't seen any important issues, so looking good to me too. Not sure if some of the comments of @jcar87 are pending to check.

env.define_path("EMSCRIPTEN", self._emscripten)
env.define_path("EM_CONFIG", self._em_config)
env.define_path("EM_CACHE", self._em_cache)
env.vars(self, scope="emsdk").save_script("emsdk_env_file")
Copy link
Member

Choose a reason for hiding this comment

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

It is not very clear who is using this file in this scope.

Copy link
Member

Choose a reason for hiding this comment

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

It is also confusing that the PATHs of this file are pointing to the package_folder/something paths, that doesn't really exist when the build() method runs, and it might even not be defined with package_folder=None for local conan build or conan install operations.

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