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

Update _meson_cpu_family_map to support arm64ec #15812

Merged
merged 2 commits into from
Mar 12, 2024
Merged

Update _meson_cpu_family_map to support arm64ec #15812

merged 2 commits into from
Mar 12, 2024

Conversation

crstzh
Copy link
Contributor

@crstzh crstzh commented Mar 5, 2024

Changelog: Feature: Update _meson_cpu_family_map to support arm64ec.
Docs: Omit

Close #15809

  • Refer to the issue that supports this Pull Request.
  • If the issue has missing info, explain the purpose/use case/pain/need that covers this Pull Request.
  • I've read the Contributing guide.
  • I've followed the PEP8 style guides for Python code.
  • I've opened another PR in the Conan docs repo to the develop branch, documenting this one.

building lcms/2.16 with below command:

conan create all --version=2.16 -pr:b windows-build-x86_64 -pr windows-msvc17.6.0-arm64ec -s build_type=Debug --build=missing

It always get below error:

fatal error LNK1392: Incompatible object type found. Did you mean /machine:arm64x or /machine:arm64ec?

@CLAassistant
Copy link

CLAassistant commented Mar 5, 2024

CLA assistant check
All committers have signed the CLA.

Copy link
Contributor

@franramirez688 franramirez688 left a comment

Choose a reason for hiding this comment

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

LGTM

@franramirez688 franramirez688 added this to the 2.2.0 milestone Mar 5, 2024
@franramirez688 franramirez688 self-assigned this Mar 5, 2024
@franramirez688
Copy link
Contributor

Hi @crstzh

Thanks a lot for the PR. Only one question. Have you checked that you're not getting errors after adding that line?
It's only to be sure that we don't need to add anything else.

@crstzh
Copy link
Contributor Author

crstzh commented Mar 5, 2024

Thank you, I will not merge this to the base branch until I verify it locally.
How can I test it locally quickly? Do need to reinstall Conan?

@memsharded
Copy link
Member

The easiest is to install the project as editable, check the README in: https://github.com/conan-io/conan

pip install -e .

With that you can run the conan application from code

Then, to run the tests:

$ python -m pip install -r conans/requirements_server.txt
$ python -m pip install -r conans/requirements_dev.txt

@crstzh
Copy link
Contributor Author

crstzh commented Mar 6, 2024

The easiest is to install the project as editable, check the README in: https://github.com/conan-io/conan

pip install -e .

With that you can run the conan application from code

Then, to run the tests:

$ python -m pip install -r conans/requirements_server.txt
$ python -m pip install -r conans/requirements_dev.txt

Thanks for your help, I followed this and found it does not work.
My command is
C:\gitrepo\conan-center-index\recipes\lcms>conan create all --version=2.16 -pr windows-msvc17.6.0-arm64ec -s build_type=Debug --build=missing

With the change, the conan_meson_cross.ini turns into and it seems good as expected.

[build_machine]
system = 'windows'
cpu_family = 'x86_64'
cpu = 'x86_64'
endian = 'little'

[host_machine]
system = 'windows'
cpu_family = 'aarch64'
cpu = 'arm64ec'
endian = 'little'

But it still reports an error:

[30/31] Linking static target src/liblcms2.a
FAILED: src/liblcms2.a
"C:\Users\zhanghui\.conan2\p\msvc_4797cca96b068\p\win\VS\2022\BuildTools\VC\Tools\MSVC\14.36.32532\bin\Hostx64\arm64\lib.exe" "/NOLOGO" /MACHINE:ARM64 /OUT:src/liblcms2.a src/liblcms2.a.p/cmsalpha.c.obj src/liblcms2.a.p/cmscam02.c.obj src/liblcms2.a.p/cmscgats.c.obj src/liblcms2.a.p/cmscnvrt.c.obj src/liblcms2.a.p/cmserr.c.obj src/liblcms2.a.p/cmsgamma.c.obj src/liblcms2.a.p/cmsgmt.c.obj src/liblcms2.a.p/cmshalf.c.obj src/liblcms2.a.p/cmsintrp.c.obj src/liblcms2.a.p/cmsio0.c.obj src/liblcms2.a.p/cmsio1.c.obj src/liblcms2.a.p/cmslut.c.obj src/liblcms2.a.p/cmsmd5.c.obj src/liblcms2.a.p/cmsmtrx.c.obj src/liblcms2.a.p/cmsnamed.c.obj src/liblcms2.a.p/cmsopt.c.obj src/liblcms2.a.p/cmspack.c.obj src/liblcms2.a.p/cmspcs.c.obj src/liblcms2.a.p/cmsplugin.c.obj src/liblcms2.a.p/cmsps2.c.obj src/liblcms2.a.p/cmssamp.c.obj src/liblcms2.a.p/cmssm.c.obj src/liblcms2.a.p/cmstypes.c.obj src/liblcms2.a.p/cmsvirt.c.obj src/liblcms2.a.p/cmswtpnt.c.obj src/liblcms2.a.p/cmsxform.c.obj
src\liblcms2.a.p\cmsalpha.c.obj : fatal error LNK1392: Incompatible object type found. Did you mean /machine:arm64x or /machine:arm64ec?
ninja: build stopped: subcommand failed.

lcms/2.16: ERROR:
Package '28050cf5d002e3b3bd18a04f122a0df463827477' build failed
lcms/2.16: WARN: Build folder C:\Users\zhanghui\.conan2\p\b\lcmsd0cea8315799e\b\build-debug
ERROR: lcms/2.16: Error in build() method, line 71
        meson.build()
        ConanException: Error 1 while executing

Is there any way to make the lib.exe get the option /machine:arm64ec rather than /MACHINE:ARM64 ? I tried like this in my conanfile but it did not take effect.

        tc = MesonToolchain(self)
        if self.settings.arch == "arm64ec":
            tc.cpp_link_args +=[ "/machine", "arm64ec"]
            tc.c_link_args +=[ "/machine", "arm64ec"]

Thanks for your help.

@franramirez688
Copy link
Contributor

Hi @crstzh

Thanks for your feedback.

Could you please provide the profiles used for the host context windows-msvc17.6.0-arm64ec and the build one windows-build-x86_64? I think the error could be related to our VCVars generator but I'm not completely sure.
It'd be great to see what your recipe looks like. At least, a simplified version.

@memsharded
Copy link
Member

It would actually be great to reproduce it with the conan new meson_lib template. We just added a section in the docs in https://docs.conan.io/2/examples/tools/meson/create_your_first_package.html, that shows it.

Because it might be something very specific to the lcms recipe to fix in the recipe and not in Conan. So we need first to make sure where is the issue.

@crstzh
Copy link
Contributor Author

crstzh commented Mar 6, 2024

Could you please provide the profiles used for the host context windows-msvc17.6.0-arm64ec and the build one windows-build-x86_64? I think the error could be related to our VCVars generator but I'm not completely sure.
It'd be great to see what your recipe looks like. At least, a simplified version.

@memsharded,
Thanks for your great help. Is this info enough?

======== Input profiles ========
Profile host:
[settings]
arch=arm64ec
build_type=Debug
compiler=msvc
compiler.cppstd=20
compiler.runtime=dynamic
compiler.runtime_type=Debug
compiler.version=193
os=Windows
[tool_requires]
!msvc_desktop|msvc_redists|windows_redists|toolchain|windows_toolchain: msvc_desktop/17.6.0-sdk22h2.755, msvc_redists/17.6.0, windows_redists/17.6.0-sdk22h2.755
!msvc_desktop|msvc_redists|windows_redists|toolchain|windows_toolchain|cmake|ninja: cmake/3.27.1, ninja/1.11.1
[conf]
tools.build:cflags=['-EHsc', '-Zi', '-Qspectre', '-guard:cf']
tools.build:cxxflags=['-EHsc', '-Zi', '-Qspectre', '-guard:cf']
tools.build:defines=['NTDDI_VERSION=0x06010000', 'WIN32_WINNT=0x0601']
tools.build:exelinkflags=['-DEBUG', '-guard:cf']
tools.build:sharedlinkflags=['-DEBUG', '-guard:cf']
tools.info.package_id:confs=['user.windows_msvc:flags_version']
user.windows_msvc:flags_version=3

Profile build:
[settings]
arch=x86_64
build_type=Release
compiler=msvc
compiler.cppstd=14
compiler.runtime=dynamic
compiler.runtime_type=Release
compiler.version=193
os=Windows

@memsharded
Copy link
Member

Quick feedback. The syntax with "ors" like |:

!msvc_desktop|msvc_redists|windows_redists|toolchain|windows_toolchain

Are you sure it works? I don't think that is supported at all, so it probably won't do what you intend

@crstzh
Copy link
Contributor Author

crstzh commented Mar 6, 2024

Quick feedback. The syntax with "ors" like |:

!msvc_desktop|msvc_redists|windows_redists|toolchain|windows_toolchain

Are you sure it works? I don't think that is supported at all, so it probably won't do what you intend

You can ignore that. I am sure it works.

@crstzh
Copy link
Contributor Author

crstzh commented Mar 6, 2024

More update, the error happens in the package().
...
lcms/2.16: Calling package()
lcms/2.16: RUN: meson install -C "C:/Users/xxx/.conan2/p/b/lcmsde984793d0afd/b/build-debug" --destdir "C:/Users/xxx/.conan2/p/b/lcmsde984793d0afd/p"
ninja: Entering directory `C:\Users\xxx.conan2\p\b\lcmsde984793d0afd\b\build-debug'
[30/31] Linking static target src/liblcms2.a
FAILED: src/liblcms2.a
"C:\Users\xxxxx.conan2\p\msvc_4797cca96b068\p\win\VS\2022\BuildTools\VC\Tools\MSVC\14.36.32532\bin\Hostx64\arm64\lib.exe" "/NOLOGO" /MACHINE:ARM64 /OUT:src/liblcms2.a src/liblcms2.a.p/cmsalpha.c.obj src/liblcms2.a.p/cmscam02.c.obj src/liblcms2.a.p/cmscgats.c.obj src/liblcms2.a.p/cmscnvrt.c.obj src/liblcms2.a.p/cmserr.c.obj src/liblcms2.a.p/cmsgamma.c.obj src/liblcms2.a.p/cmsgmt.c.obj src/liblcms2.a.p/cmshalf.c.obj src/liblcms2.a.p/cmsintrp.c.obj src/liblcms2.a.p/cmsio0.c.obj src/liblcms2.a.p/cmsio1.c.obj src/liblcms2.a.p/cmslut.c.obj src/liblcms2.a.p/cmsmd5.c.obj src/liblcms2.a.p/cmsmtrx.c.obj src/liblcms2.a.p/cmsnamed.c.obj src/liblcms2.a.p/cmsopt.c.obj src/liblcms2.a.p/cmspack.c.obj src/liblcms2.a.p/cmspcs.c.obj src/liblcms2.a.p/cmsplugin.c.obj src/liblcms2.a.p/cmsps2.c.obj src/liblcms2.a.p/cmssamp.c.obj src/liblcms2.a.p/cmssm.c.obj src/liblcms2.a.p/cmstypes.c.obj src/liblcms2.a.p/cmsvirt.c.obj src/liblcms2.a.p/cmswtpnt.c.obj src/liblcms2.a.p/cmsxform.c.obj
src\liblcms2.a.p\cmsalpha.c.obj : fatal error LNK1392: Incompatible object type found. Did you mean /machine:arm64x or /machine:arm64ec?
ninja: build stopped: subcommand failed.
Could not rebuild C:\Users\xxx.conan2\p\b\lcmsde984793d0afd\b\build-debug

ERROR: lcms/2.16: Error in package() method, line 102
meson.install()
ConanException: Error 4294967295 while executing

@memsharded
Copy link
Member

You can ignore that. I am sure it works.

If that is kind of a logical "OR" of package names, I'd say it doesn't work. At least Conan doesn't have any management of it, and up to my knowledge fnmatch doesn't manage it either. But sure, I will ignore that.

More update, the error happens in the package().

Can you please try with the conan new meson_lib template?

@crstzh
Copy link
Contributor Author

crstzh commented Mar 6, 2024

You can ignore that. I am sure it works.

If that is kind of a logical "OR" of package names, I'd say it doesn't work. At least Conan doesn't have any management of it, and up to my knowledge fnmatch doesn't manage it either. But sure, I will ignore that.

More update, the error happens in the package().

Can you please try with the conan new meson_lib template?

Yes, I can try that, but it might need some time. Could you just try with the existing package lcms, it's already in cci.
the command line is:
conan create all --version=2.16 -pr windows-msvc17.6.0-arm64ec -s build_type=Debug --build=missing

For the [tool_requires] section,
!msvc_desktop|msvc_redists|windows_redists|toolchain|windows_toolchain is a conditional expression used to specify under what conditions the subsequent action should be executed. !msvc_desktop|msvc_redists|windows_redists|toolchain|windows_toolchain, it means "execute the subsequent action if the context is not in msvc_desktop, msvc_redists, windows_redists, toolchain, or windows_toolchain".

======== Input profiles ========
Profile host:

[settings]
arch=arm64ec
build_type=Debug
compiler=msvc
compiler.cppstd=20
compiler.runtime=dynamic
compiler.runtime_type=Debug
compiler.version=193
os=Windows
[tool_requires]
!msvc_desktop|msvc_redists|windows_redists|toolchain|windows_toolchain: msvc_desktop/17.6.0-sdk22h2.755
!msvc_desktop|msvc_redists|windows_redists|toolchain|windows_toolchain: msvc_redists/17.6.0
!msvc_desktop|msvc_redists|windows_redists|toolchain|windows_toolchain: windows_redists/17.6.0-sdk22h2.755
!msvc_desktop|msvc_redists|windows_redists|toolchain|windows_toolchain|cmake|ninja: cmake/3.27.1
!msvc_desktop|msvc_redists|windows_redists|toolchain|windows_toolchain|cmake|ninja: ninja/1.11.1
ninja/1.11.1
[conf]
tools.build:cflags=['-EHsc', '-Zi', '-Qspectre', '-guard:cf']
tools.build:cxxflags=['-EHsc', '-Zi', '-Qspectre', '-guard:cf']
tools.build:defines=['NTDDI_VERSION=0x06010000', 'WIN32_WINNT=0x0601']
tools.build:exelinkflags=['-DEBUG', '-guard:cf']
tools.build:sharedlinkflags=['-DEBUG', '-guard:cf']
tools.info.package_id:confs=['user.windows_msvc:flags_version']
user.windows_msvc:flags_version=3

@crstzh
Copy link
Contributor Author

crstzh commented Mar 6, 2024

More update:
I tried to do this command manually like below and it works well. Please pay attention to the /MACHINE:ARM64EC, That's the only difference. But I don't know how to pass this to the lib.exe command.

C:\Users\xxx\.conan2\p\b\lcmsdce22c7af588a\b\build-debug>"C:\Users\xxx\.conan2\p\msvc_4797cca96b068\p\win\VS\2022\BuildTools\VC\Tools\MSVC\14.36.32532\bin\Hostx64\arm64\lib.exe" "/NOLOGO" **/MACHINE:ARM64EC** /OUT:src/liblcms2.a src/liblcms2.a.p/cmsalpha.c.obj src/liblcms2.a.p/cmscam02.c.obj src/liblcms2.a.p/cmscgats.c.obj src/liblcms2.a.p/cmscnvrt.c.obj src/liblcms2.a.p/cmserr.c.obj src/liblcms2.a.p/cmsgamma.c.obj src/liblcms2.a.p/cmsgmt.c.obj src/liblcms2.a.p/cmshalf.c.obj src/liblcms2.a.p/cmsintrp.c.obj src/liblcms2.a.p/cmsio0.c.obj src/liblcms2.a.p/cmsio1.c.obj src/liblcms2.a.p/cmslut.c.obj src/liblcms2.a.p/cmsmd5.c.obj src/liblcms2.a.p/cmsmtrx.c.obj src/liblcms2.a.p/cmsnamed.c.obj src/liblcms2.a.p/cmsopt.c.obj src/liblcms2.a.p/cmspack.c.obj src/liblcms2.a.p/cmspcs.c.obj src/liblcms2.a.p/cmsplugin.c.obj src/liblcms2.a.p/cmsps2.c.obj src/liblcms2.a.p/cmssamp.c.obj src/liblcms2.a.p/cmssm.c.obj src/liblcms2.a.p/cmstypes.c.obj src/liblcms2.a.p/cmsvirt.c.obj src/liblcms2.a.p/cmswtpnt.c.obj src/liblcms2.a.p/cmsxform.c.obj

@franramirez688
Copy link
Contributor

franramirez688 commented Mar 6, 2024

@crstzh Could we check that it's not an error introduced by the 2.1.0 version? Please, let's check a previous version of Conan:

$ git checkout 2.0.17
# Check that your changes in the _meson_cpu_family_map are still there
$ conan create all --version=2.16   -pr windows-msvc17.6.0-arm64ec -s build_type=Debug --build=missing

This is only to discard that this could be happening due to some changes introduced in Conan 2.1.0.

@memsharded
Copy link
Member

I am trying to reproduce this with the lcms recipe, with conan create . --version=2.16 -pr=profile_msvc --build=missing but I am getting an error much earlier than that:

ERROR: lcms/2.16: Error in generate() method, line 58
        tc.generate()
        ConanException: vcvars unsupported architectures x86_64-arm64ec

And it makes sense, the vcvars integration doesn't recognize this architecture either.

I keep having a look.

@memsharded
Copy link
Member

ConanException: vcvars unsupported architectures x86_64-arm64ec

This was expected, vcvars do not have that mapping.
But I have no idea why this doesn't fail in this same way on your side.

I am using this profile:

[settings]
arch=arm64ec
build_type=Debug
compiler=msvc
compiler.cppstd=20
compiler.runtime=dynamic
compiler.runtime_type=Debug
compiler.version=193
os=Windows

I think we still need a minimal reproducible example, with full details, like an exact profile we can use to reproduce.

Once I forced the VCvars Conan integration to map x86_64-arm64ec to amd64_arm64, I was able to move that point, but then Meson failed with sanitycheck.exe not being valid for the current architecture, still after closing the Dialog window that popped up with it, it manage to finish the build of the package, then failed in the test_package with No CMAKE_C_COMPILER could be found., which might be related to the CMake version I am using not ready to understand arm64ec

@crstzh
Copy link
Contributor Author

crstzh commented Mar 7, 2024

I cleaned p all local cache and try again:

In lcms, I am using meson1.3.1

    def build_requirements(self):
        self.tool_requires("meson/1.3.1")

and error is:

lcms/2.16: ERROR:
Package '28050cf5d002e3b3bd18a04f122a0df463827477' build failed
lcms/2.16: WARN: Build folder C:\Users\zhanghui\.conan2\p\b\lcms419fcddf81ff0\b\build-debug
ERROR: lcms/2.16: Error in build() method, line 71
        meson.build()
        ConanException: Error 1 while executing

Then I made some changes in conan-io:

  1. 'arm64ec': ('aarch64', 'arm64ec', 'little'),
  2. if arch_build == 'x86_64':
     arch = {'x86': "amd64_x86",
             'x86_64': 'amd64',
             'armv7': 'amd64_arm',
             'armv8': 'amd64_arm64',
             'arm64ec':'amd64_arm64'}.get(arch_host)
    

the output is:

c:\gitrepo\conan-recipes\recipes\lcms>conan create all --version=2.16  -pr windows-msvc17.6.0-arm64ec -s build_type=Debug

======== Exporting recipe to the cache ========
lcms/2.16: Exporting package recipe: c:\gitrepo\conan-recipes\recipes\lcms\all\conanfile.py
lcms/2.16: exports: File 'conandata.yml' found. Exporting it...
lcms/2.16: Calling export_sources()
lcms/2.16: Copied 1 '.yml' file: conandata.yml
lcms/2.16: Copied 1 '.py' file: conanfile.py
lcms/2.16: Exported to cache folder: C:\Users\zhanghui\.conan2\p\lcmsc3de4ee8e29c0\e
lcms/2.16: Exported: lcms/2.16#7a3424f1f8c709a594947f8bef0d1dd4 (2024-03-07 00:23:02 UTC)

======== Input profiles ========
Profile host:
[settings]
arch=arm64ec
build_type=Debug
compiler=msvc
compiler.cppstd=20
compiler.runtime=dynamic
compiler.runtime_type=Debug
compiler.version=193
os=Windows
[tool_requires]
!msvc_desktop|msvc_redists|windows_redists|toolchain|windows_toolchain: msvc_desktop/17.6.0-sdk22h2.755, msvc_redists/17.6.0, windows_redists/17.6.0-sdk22h2.755
!msvc_desktop|msvc_redists|windows_redists|toolchain|windows_toolchain|cmake|ninja: cmake/3.27.1, ninja/1.11.1
[conf]
tools.build:cflags=['-EHsc', '-Zi', '-Qspectre', '-guard:cf']
tools.build:cxxflags=['-EHsc', '-Zi', '-Qspectre', '-guard:cf']
tools.build:defines=['NTDDI_VERSION=0x06010000', 'WIN32_WINNT=0x0601']
tools.build:exelinkflags=['-DEBUG', '-guard:cf']
tools.build:sharedlinkflags=['-DEBUG', '-guard:cf']
tools.info.package_id:confs=['user.windows_msvc:flags_version']
user.windows_msvc:flags_version=3

Profile build:
[settings]
arch=x86_64
build_type=Release
compiler=msvc
compiler.cppstd=14
compiler.runtime=dynamic
compiler.runtime_type=Release
compiler.version=193
os=Windows


======== Computing dependency graph ========
Graph root
    cli
Requirements
    lcms/2.16#7a3424f1f8c709a594947f8bef0d1dd4 - Cache
Build requirements
    cmake/3.27.1#032de65b33be8fa2120060f8fdd7fbc9 - Cache
    meson/1.3.1#8c8786ce48a30dbe9997e3d563dec868 - Cache
    msvc_desktop/17.6.0-sdk22h2.755#673c55f4ad76b8a2a16901a3908727be - Cache
    msvc_redists/17.6.0#57b39ff81ebafbdc5ec744005d89d7df - Cache
    ninja/1.11.1#f73fb14f87f6343107224de5c8734c0d - Cache
    toolchain/0.1.1#cacc1565ad308b21e7f84ad825b78c6e - Cache
    windows_redists/17.6.0-sdk22h2.755#11edd68bc81188fc4639aa2eb1499d11 - Cache
Python requires
    windows_toolchain/0.1.1#fd7a97749bbec9c384377d2ad6d0d384 - Cache

======== Computing necessary packages ========
lcms/2.16: Forced build from source
Requirements
    lcms/2.16#7a3424f1f8c709a594947f8bef0d1dd4:28050cf5d002e3b3bd18a04f122a0df463827477 - Build
Build requirements
    cmake/3.27.1#032de65b33be8fa2120060f8fdd7fbc9:522dcea5982a3f8a5b624c16477e47195da2f84f#2b918e4cc8e3c0fc83a5ff2ecb95dfcd - Cache
    meson/1.3.1#8c8786ce48a30dbe9997e3d563dec868:da39a3ee5e6b4b0d3255bfef95601890afd80709#63cd3207f6b4bc458239ae82c3e98e8f - Cache
    msvc_desktop/17.6.0-sdk22h2.755#673c55f4ad76b8a2a16901a3908727be:1ac58f1299f75b10d42134bf62e7992c88bff42e#c1f0a43277d6911c9deddbe094bd2034 - Cache
    msvc_redists/17.6.0#57b39ff81ebafbdc5ec744005d89d7df:9105d4f8994f25f55cb83ffc2bfbd7a3a403b8f7#cd6e877ecafe7e9c86fc2a55a5680387 - Cache
    ninja/1.11.1#f73fb14f87f6343107224de5c8734c0d:723257509aee8a72faf021920c2874abc738e029#7ee07890720a81e57a7e141a5472b6ad - Cache
    windows_redists/17.6.0-sdk22h2.755#11edd68bc81188fc4639aa2eb1499d11:9105d4f8994f25f55cb83ffc2bfbd7a3a403b8f7#4cb7d8719254659478a38741410a0433 - Cache
Skipped binaries
    toolchain/0.1.1

======== Installing packages ========
cmake/3.27.1: Already installed! (1 of 7)
msvc_redists/17.6.0: Already installed! (2 of 7)
ninja/1.11.1: Already installed! (3 of 7)
windows_redists/17.6.0-sdk22h2.755: Already installed! (4 of 7)
meson/1.3.1: Already installed! (5 of 7)
msvc_desktop/17.6.0-sdk22h2.755: Already installed! (6 of 7)
lcms/2.16: Calling source() in C:\Users\zhanghui\.conan2\p\lcmsc3de4ee8e29c0\s\src

-------- Installing package lcms/2.16 (7 of 7) --------
lcms/2.16: Building from source
lcms/2.16: Package lcms/2.16:28050cf5d002e3b3bd18a04f122a0df463827477
lcms/2.16: Copying sources to build folder
lcms/2.16: Building your package in C:\Users\zhanghui\.conan2\p\b\lcms4635d12bc7f6a\b
lcms/2.16: Calling generate()
lcms/2.16: Generators folder: C:\Users\zhanghui\.conan2\p\b\lcms4635d12bc7f6a\b\build-debug\conan
lcms/2.16: Generating aggregated env files
lcms/2.16: Generated aggregated env files: ['conanbuild.bat', 'conanrun.bat']
lcms/2.16: Calling build()
lcms/2.16: Meson configure cmd: meson setup --cross-file "C:\Users\zhanghui\.conan2\p\b\lcms4635d12bc7f6a\b\build-debug\conan\conan_meson_cross.ini" "C:\Users\zhanghui\.conan2\p\b\lcms4635d12bc7f6a\b\build-debug" "C:\Users\zhanghui\.conan2\p\b\lcms4635d12bc7f6a\b\src" --prefix=/
lcms/2.16: RUN: meson setup --cross-file "C:\Users\zhanghui\.conan2\p\b\lcms4635d12bc7f6a\b\build-debug\conan\conan_meson_cross.ini" "C:\Users\zhanghui\.conan2\p\b\lcms4635d12bc7f6a\b\build-debug" "C:\Users\zhanghui\.conan2\p\b\lcms4635d12bc7f6a\b\src" --prefix=/
The Meson build system
Version: 1.3.1
Source dir: C:\Users\zhanghui\.conan2\p\b\lcms4635d12bc7f6a\b\src
Build dir: C:\Users\zhanghui\.conan2\p\b\lcms4635d12bc7f6a\b\build-debug
Build type: cross build
Project name: Little-CMS
Project version: 2.16
DEPRECATION: None of the values ['gnu11'] are supported by the c compiler.
However, the deprecated gnu11 std currently falls back to c11.
This will be an error in the future.
If the project supports both GNU and MSVC compilers, a value such as
"c_std=gnu11,c11" specifies that GNU is prefered but it can safely fallback to plain c11.
C compiler for the host machine: C:\Users\zhanghui\.conan2\p\msvc_4797cca96b068\p\win\VS\2022\BuildTools\VC\Tools\MSVC\14.36.32532\bin\Hostx64\arm64\cl.exe (msvc 19.36.32532 "Microsoft (R) C/C++ Optimizing Compiler Version 19.36.32532 for ARM64")
C linker for the host machine: link link 14.36.32532.0
Compiler for language c for the build machine not found.
Build machine cpu family: x86_64
Build machine cpu: x86_64
Host machine cpu family: aarch64
Host machine cpu: arm64ec
Target machine cpu family: aarch64
Target machine cpu: arm64ec
Header "time.h" has symbol "gmtime_r" : NO
Header "time.h" has symbol "gmtime_s" : YES
Checking if "gmtime_s can be used" : links: YES
Found pkg-config: NO
Found CMake: NO
Run-time dependency libjpeg found: NO (tried pkgconfig and cmake)
Run-time dependency libtiff-4 found: NO (tried pkgconfig and cmake)
Checking if "supports SSE2 intrinsics" compiles: NO
Header "time.h" has symbol "timespec_get" : YES
Build targets in project: 2

Little-CMS 2.16

  User defined options
    Cross files: C:\Users\zhanghui\.conan2\p\b\lcms4635d12bc7f6a\b\build-debug\conan\conan_meson_cross.ini
    prefix     : /

Found ninja-1.11.1 at C:\Users\zhanghui\.conan2\p\ninja93de1ffe41e9e\p\bin\ninja.EXE
WARNING: Cross file does not specify strip binary, result will not be stripped.
WARNING: Cross file does not specify strip binary, result will not be stripped.

lcms/2.16: Meson build cmd: meson compile -C "C:\Users\zhanghui\.conan2\p\b\lcms4635d12bc7f6a\b\build-debug" -j16
lcms/2.16: RUN: meson compile -C "C:\Users\zhanghui\.conan2\p\b\lcms4635d12bc7f6a\b\build-debug" -j16
INFO: autodetecting backend as ninja
INFO: calculating backend command to run: C:\Users\zhanghui\.conan2\p\ninja93de1ffe41e9e\p\bin\ninja.EXE -j 16
[30/31] Linking static target src/liblcms2.a
FAILED: src/liblcms2.a
"C:\Users\zhanghui\.conan2\p\msvc_4797cca96b068\p\win\VS\2022\BuildTools\VC\Tools\MSVC\14.36.32532\bin\Hostx64\arm64\lib.exe" "/NOLOGO" /MACHINE:ARM64 /OUT:src/liblcms2.a src/liblcms2.a.p/cmsalpha.c.obj src/liblcms2.a.p/cmscam02.c.obj src/liblcms2.a.p/cmscgats.c.obj src/liblcms2.a.p/cmscnvrt.c.obj src/liblcms2.a.p/cmserr.c.obj src/liblcms2.a.p/cmsgamma.c.obj src/liblcms2.a.p/cmsgmt.c.obj src/liblcms2.a.p/cmshalf.c.obj src/liblcms2.a.p/cmsintrp.c.obj src/liblcms2.a.p/cmsio0.c.obj src/liblcms2.a.p/cmsio1.c.obj src/liblcms2.a.p/cmslut.c.obj src/liblcms2.a.p/cmsmd5.c.obj src/liblcms2.a.p/cmsmtrx.c.obj src/liblcms2.a.p/cmsnamed.c.obj src/liblcms2.a.p/cmsopt.c.obj src/liblcms2.a.p/cmspack.c.obj src/liblcms2.a.p/cmspcs.c.obj src/liblcms2.a.p/cmsplugin.c.obj src/liblcms2.a.p/cmsps2.c.obj src/liblcms2.a.p/cmssamp.c.obj src/liblcms2.a.p/cmssm.c.obj src/liblcms2.a.p/cmstypes.c.obj src/liblcms2.a.p/cmsvirt.c.obj src/liblcms2.a.p/cmswtpnt.c.obj src/liblcms2.a.p/cmsxform.c.obj
src\liblcms2.a.p\cmsalpha.c.obj : fatal error LNK1392: Incompatible object type found. Did you mean /machine:arm64x or /machine:arm64ec?
ninja: build stopped: subcommand failed.

lcms/2.16: ERROR:
Package '28050cf5d002e3b3bd18a04f122a0df463827477' build failed
lcms/2.16: WARN: Build folder C:\Users\zhanghui\.conan2\p\b\lcms4635d12bc7f6a\b\build-debug
ERROR: lcms/2.16: Error in build() method, line 71
        meson.build()
        ConanException: Error 1 while executing

@memsharded
Copy link
Member

Ok, thanks a lot for the feedback, that clarifies a lot, specifically I was confused about missing your step 2.)

With those 2 changes and the following command:

$ conan install --requires=lcms/2.16 --build=missing -pr=profile

with profile:

[settings]
arch=arm64ec
build_type=Debug
compiler=msvc
compiler.cppstd=20
compiler.runtime=dynamic
compiler.runtime_type=Debug
compiler.version=193
os=Windows

[conf]
tools.gnu:pkg_config=C:/ws/pkgconfig/pkg-config

Then it works fine and finish correctly:

lcms/2.16: package(): Packaged 2 '.h' files: lcms2.h, lcms2_plugin.h
lcms/2.16: package(): Packaged 1 '.lib' file: lcms2.lib
lcms/2.16: package(): Packaged 1 file: LICENSE
lcms/2.16: Created package revision eda76b9beea5bbd0cfc58dced88ae1ad
lcms/2.16: Package '4da9c5c6ef621d63e4840bb54d2a44c605589b3e' created
lcms/2.16: Full package reference: lcms/2.16#fb083506ff40fd950c9e5c39df8bed54:4da9c5c6ef621d63e4840bb54d2a44c605589b3e#eda76b9beea5bbd0cfc58dced88ae1ad
lcms/2.16: Package folder C:\Users\memsharded\.conan2\p\b\lcms37de444b09edc\p

======== Finalizing install (deploy, generators) ========
cli: Generating aggregated env files
cli: Generated aggregated env files: ['conanbuild.bat', 'conanrun.bat']
Install finished successfully

The only problem I see is the 2 modal dialog with the error of the "sanitycheck", but if I click and dismiss them, the build succeed.

Could you please try to reproduce the above, with the same command and the same profile and see if it still fails?
There are different tool_requires there that I don't have, and they could be related, so we need to have a common reproducible example.

@crstzh
Copy link
Contributor Author

crstzh commented Mar 7, 2024

The only problem I see is the 2 modal dialog with the error of the "sanitycheck", but if I click and dismiss them, the build succeed.

Could you please try to reproduce the above, with the same command and the same profile and see if it still fails? There are different tool_requires there that I don't have, and they could be related, so we need to have a common reproducible example.

Without any change, if I run:
conan install all --version=2.16 -pr windows-msvc17.6.0-arm64ec -s build_type=Debug
It succeeds very quickly:

======== Installing packages ========
cmake/3.27.1: Already installed! (1 of 6)
msvc_redists/17.6.0: Already installed! (2 of 6)
ninja/1.11.1: Already installed! (3 of 6)
windows_redists/17.6.0-sdk22h2.755: Already installed! (4 of 6)
meson/1.3.1: Already installed! (5 of 6)
msvc_desktop/17.6.0-sdk22h2.755: Already installed! (6 of 6)

======== Finalizing install (deploy, generators) ========
conanfile.py (lcms/2.16): Calling generate()
conanfile.py (lcms/2.16): Generators folder: c:\gitrepo\conan-recipes\recipes\lcms\all\build-debug\conan
conanfile.py (lcms/2.16): Generating aggregated env files
conanfile.py (lcms/2.16): Generated aggregated env files: ['conanbuild.bat', 'conanrun.bat']
Install finished successfully

But If I run
conan create all --version=2.16 -pr windows-msvc17.6.0-arm64ec -s build_type=Debug
It still failed. 2 windows pop up about sanitycheckc.exe. But I saw that in another package as well.

BY the way, I don't know how to set
[conf]
tools.gnu:pkg_config=C:/ws/pkgconfig/pkg-config
Instead I change my conanfile from

    def build_requirements(self):
        self.tool_requires("meson/1.3.1")

to

    def build_requirements(self):
        self.tool_requires("meson/1.3.1")
        if not self.conf.get("tools.gnu:pkg_config", check_type=str):
            self.tool_requires("pkgconf/2.1.0")

Is that OK?

@memsharded
Copy link
Member

windows-msvc17.6.0-arm64ec

But you are still running with a lot of packages and tool-requires that I don't have, so I cannot reproduce the same.
I am saying to use my exact profile above, so all those packages like msvc_redists are not used at all, just the normal installed VS.

self.tool_requires("pkgconf/2.1.0")

Yes, this would be equivalent

@crstzh
Copy link
Contributor Author

crstzh commented Mar 8, 2024

tools.gnu:pkg_config=C:/ws/pkgconfig/pkg-config
Thanks a lot.
What I did is:

  1. create a testpr locally with the below content:
[settings]
arch=arm64ec
build_type=Debug
compiler=msvc
compiler.cppstd=20
compiler.runtime=dynamic
compiler.runtime_type=Debug
compiler.version=193
os=Windows

[conf]
  1. run this command:
    conan install --requires=lcms/2.16 --build=missing -pr=C:\gitrepo\testpr --build=missing

It succeeed as expected and I can see below putput:
conanvcvars.bat: Activating environment Visual Studio 17 - amd64_arm64 - winsdk_version=None - vcvars_ver=14.3

lcms/2.16: package(): Packaged 2 '.h' files: lcms2.h, lcms2_plugin.h
lcms/2.16: package(): Packaged 1 '.lib' file: lcms2.lib
lcms/2.16: package(): Packaged 1 file: LICENSE
lcms/2.16: Created package revision 9dfe35e41fa0eb084bb46731011a10f7
lcms/2.16: Package '4da9c5c6ef621d63e4840bb54d2a44c605589b3e' created
lcms/2.16: Full package reference: lcms/2.16#7a3424f1f8c709a594947f8bef0d1dd4:4da9c5c6ef621d63e4840bb54d2a44c605589b3e#9dfe35e41fa0eb084bb46731011a10f7
lcms/2.16: Package folder C:\Users\zhanghui\.conan2\p\b\lcmseaa8c6c8cfefb\p

======== Finalizing install (deploy, generators) ========
cli: Generating aggregated env files
cli: Generated aggregated env files: ['conanbuild.bat', 'conanrun.bat']
Install finished successfully

Then I tried below command:
conan create all --version=2.16 -pr=C:\gitrepo\testpr -s build_type=Debug

got below results:

  1>Checking Build System
  Building Custom Rule C:/gitrepo/conan-recipes/recipes/lcms/all/test_package/CMakeLists.txt
  test_package.c
test_package.obj : error LNK2019: unresolved external symbol cmsBuildTabulatedToneCurve16 referenced in function #cmsBuildTa
bulatedToneCurve16$exit_thunk (EC Symbol) [C:\gitrepo\conan-recipes\recipes\lcms\all\test_package\build\msvc-193-arm64ec-20-
debug\test_package.vcxproj]
test_package.obj : error LNK2019: unresolved external symbol cmsFreeToneCurve referenced in function #cmsFreeToneCurve$exit_
thunk (EC Symbol) [C:\gitrepo\conan-recipes\recipes\lcms\all\test_package\build\msvc-193-arm64ec-20-debug\test_package.vcxpr
oj]
C:\gitrepo\conan-recipes\recipes\lcms\all\test_package\build\msvc-193-arm64ec-20-debug\Debug\test_package.exe : fatal error
LNK1120: 2 unresolved externals [C:\gitrepo\conan-recipes\recipes\lcms\all\test_package\build\msvc-193-arm64ec-20-debug\test
_package.vcxproj]

ERROR: lcms/2.16 (test package): Error in build() method, line 21
        cmake.build()
        ConanException: Error 1 while executing

Seems I need to make some change avoid run test. I did:
conan create all --version=2.16 -pr=C:\gitrepo\testpr -s build_type=Debug -tf=""

Then it succeeded.
What can we know from this? Does that mean the tool_requires has issue, maybe it does not understand ARM64EC?

[tool_requires]
!msvc_desktop|msvc_redists|windows_redists|toolchain|windows_toolchain: msvc_desktop/17.6.0-sdk22h2.755, msvc_redists/17.6.0, windows_redists/17.6.0-sdk22h2.755
!msvc_desktop|msvc_redists|windows_redists|toolchain|windows_toolchain|cmake|ninja: cmake/3.27.1, ninja/1.11.1

I am sure my local VS supportARM64EC. Thanks for your help.

@crstzh
Copy link
Contributor Author

crstzh commented Mar 12, 2024

@memsharded Can I merge this to conan-io:develop2 now?

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.

Ok, lets merge this then. Thanks very much for your contribution.

It is important to highlight that the Meson integration is not working 100% correctly for this setup yet, I am still getting 2 modal dialog pop ups about sanitycheck.exe not being able to run for the architecture. But at least these definitions of architecture seems correct and a step in the right direction.

@franramirez688 franramirez688 merged commit c0488a2 into conan-io:develop2 Mar 12, 2024
2 checks passed
@memsharded memsharded mentioned this pull request Mar 12, 2024
1 task
@crstzh crstzh mentioned this pull request Mar 25, 2024
5 tasks
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.

[question] meson cross-build
4 participants