conan-io / conan

Conan - The open-source C and C++ package manager
https://conan.io
MIT License
8.14k stars 970 forks source link

[bug] Meson ignores x86_64 setting and builds a package as x86 #9402

Closed ghost closed 9 months ago

ghost commented 3 years ago

Environment Details

Steps to reproduce

I'm trying to build the libepoxy package. It internally uses Meson, I'm targetting x86_64, but somehow Meson ignores this and builds the package as x86 which later leads to a linking error when building my project.

Logs

Executing conan install .. -s build_type=Debug --build=libepoxy gives this:

Configuration:
[settings]
arch=x86_64
arch_build=x86_64
build_type=Debug
compiler=Visual Studio
compiler.runtime=MDd
compiler.version=16
os=Windows
os_build=Windows

...

The Meson build system
Version: 0.59.0

...

Host machine cpu family: x86
Host machine cpu: x86

...
lasote commented 3 years ago

Are you running in an x86 machine or is it x86_64?

lasote commented 3 years ago

I've found this: https://github.com/mesonbuild/meson/issues/6128 If the machine is x86_64 it might be the cause, try to upgrade the meson tool to the latest version.

The Meson build helper that is used by the libepoxy is not managing the "cross-building" at all, we introduced a new one more complete that will be eventually introduced in the recipes of conan center index. Anyway, it is weird that error and I would say it might be a Meson bug.

pandyah5 commented 9 months ago

I am facing a similar problem, I am on a Windows 11 64-bit system and have a 64-bit Python (3.11.4) installation. However, meson detects my system as x86 instead of x86_64. This in turn prompts it to look for x86 python which I don't have installed. Any suggestions on how to fix it?

The Meson build system
  Version: 1.3.0
  Source dir: D:\Hetav_Documents\UofT\Academic Planning\ECE 444\OSS\matplotlib
  Build dir: D:\Hetav_Documents\UofT\Academic Planning\ECE 444\OSS\matplotlib\build\cp311
  Build type: native build
  Project name: matplotlib
  Project version: 3.9.0.dev0
  C compiler for the host machine: cl (msvc 19.36.32537 "Microsoft (R) C/C++ Optimizing Compiler Version 19.36.32537 for x86")
  C linker for the host machine: link link 14.36.32537.0
  C++ compiler for the host machine: cl (msvc 19.36.32537 "Microsoft (R) C/C++ Optimizing Compiler Version 19.36.32537 for x86")
  C++ linker for the host machine: link link 14.36.32537.0
  Host machine cpu family: x86
  Host machine cpu: x86
  Program python found: YES (D:\Hetav_Documents\UofT\Academic Planning\ECE 444\OSS\matplotlib-env\Scripts\python.exe)
  Need python for x86, but found x86_64
  Run-time dependency python found: NO (tried sysconfig)

  ..\..\meson.build:24:14: ERROR: Python dependency not found
franramirez688 commented 9 months ago

Hi @pandyah5

We would need more details about your current configuration:

It sounds like a Meson bug, but let's try to understand your case before concluding anything.

sbhasan commented 9 months ago

Hi, I am facing the same problem when I try to compile this package from the source. I am using Windows 11 and have no familiarity with meson or conan. Could you help me a bit in understanding how to retrieve the information you need to figure this problem? Thanks

pandyah5 commented 9 months ago

Hi @franramirez688 thanks for the prompt reply, I sincerely apologize for posting it here. It has little to do with Conan. I have solved the issue on my end and the problem was I was using Developer Command Prompt for VS 2022 which is meant for x86 and not x86_64. That solved my issue 😄

@sbhasan if you are facing the same error please make sure you don't use Developer Command Prompt for VS 2022 instead use VS x64 Native Tools Command Prompt.

Alternatively have a look at this issue, it also suggests using set VSLANG=1033

memsharded commented 9 months ago

Conan has the capability, and it is actually recommended for many cases, to automatically activate the environment that is required. That is if you do conan install ... -s compiler=msvc -s compiler.version=192... conan will generate conanbuild.bat script that will automatically call the correct vcvars to activate the correct VS version and architecture.

The recommendation could be run Conan from normal cmd (Y use cmder, for example), and if at some point is necessary to locally set the VS prompt, then just call conanbuild.bat and it will activate it.

franramirez688 commented 9 months ago

Hi @pandyah5

Thanks for reporting what solved your issue. I hope it helps @sbhasan too.

Closing the issue as there are no bugs related to Conan but Meson.

Don't hesitate to reopen it if any problems come up.