conan-io / conan-center-index

Recipes for the ConanCenter repository
https://conan.io/center
MIT License
949 stars 1.73k forks source link

[package] gmp/6.3.0: can't install/build for windows x86 host #22885

Open cen1 opened 7 months ago

cen1 commented 7 months ago

Description

Maybe I am doing something terribly wrong but.. trying to install/build gmp for Win x86 (a 32bit library) on amd64 Windows 10 builder results in libgmp.a and libgmpxx.a produced in lib folder.

This is now several hours in after clearing conan cache multiple times but I did manage somehow (I don't remember doing anything differently) to produce gmp.lib and gmpxx.lib at the beginning of this adventure, but the problem with those was that they were actually x64 libraries after checking them through dumpbin and thus they failed to link at cmake step

So I am at a complete loss how to produce 32bit Windows libraries at this point.

My default profile is Visual Studio 2022:

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

Host profile is in the Conan profile infobox, I just changed the arch to x86.

conanfile.py

from conan import ConanFile
from conan.tools.files import copy

class Bncsutil(ConanFile):
    settings = "os", "compiler", "build_type", "arch"
    generators = "CMakeDeps", "CMakeToolchain"

    requires = (
        "gmp/6.3.0",
    )

    def generate(self):
        for dep in self.dependencies.values():
            if dep.cpp_info.libdirs:
                copy(self, "*.lib", dep.cpp_info.libdirs[0], self.build_folder)
            if dep.cpp_info.bindirs:
                copy(self, "*.dll", dep.cpp_info.bindirs[0], self.build_folder)

Package and Environment Details

Conan profile

this is the host x86 profile

[settings]
arch=x86
build_type=Release
compiler=msvc
compiler.cppstd=14
compiler.runtime=dynamic
compiler.version=193
os=Windows

Steps to reproduce

in cmd:

"C:/Program Files/Microsoft Visual Studio/2022/Community/VC/Auxiliary/Build/vcvarsall.bat" x86
conan install . -of build -s build_type=Release --profile:host=x86 --profile:build=default -o *:shared=False --build=missing

Logs

Click to expand log ``` ======== Input profiles ======== Profile host: [settings] arch=x86 build_type=Release compiler=msvc compiler.cppstd=14 compiler.runtime=dynamic compiler.runtime_type=Release compiler.version=193 os=Windows [options] *:shared=False 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 ======== gmp/6.3.0: Not found in local cache, looking in remotes... gmp/6.3.0: Checking remote: conancenter gmp/6.3.0: Downloaded recipe revision df20ffb6d21c34d67704305bcd1dea9e m4/1.4.19: Not found in local cache, looking in remotes... m4/1.4.19: Checking remote: conancenter m4/1.4.19: Downloaded recipe revision b38ced39a01e31fef5435bc634461fd2 msys2/cci.latest: Not found in local cache, looking in remotes... msys2/cci.latest: Checking remote: conancenter msys2/cci.latest: Downloaded recipe revision 5a31efa2bde593541fd5ac3bcc50c01c yasm/1.3.0: Not found in local cache, looking in remotes... yasm/1.3.0: Checking remote: conancenter yasm/1.3.0: Downloaded recipe revision fb800a15413dca19bfaef9e4b5d50694 automake/1.16.5: Not found in local cache, looking in remotes... automake/1.16.5: Checking remote: conancenter automake/1.16.5: Downloaded recipe revision 058bda3e21c36c9aa8425daf3c1faf50 autoconf/2.71: Not found in local cache, looking in remotes... autoconf/2.71: Checking remote: conancenter autoconf/2.71: Downloaded recipe revision 00a1e46d8ba5baaf7f10d64c1a6a0342 Graph root conanfile.py: C:\Users\cen\git\bncsutil\conanfile.py Requirements gmp/6.3.0#df20ffb6d21c34d67704305bcd1dea9e - Downloaded (conancenter) Build requirements autoconf/2.71#00a1e46d8ba5baaf7f10d64c1a6a0342 - Downloaded (conancenter) automake/1.16.5#058bda3e21c36c9aa8425daf3c1faf50 - Downloaded (conancenter) m4/1.4.19#b38ced39a01e31fef5435bc634461fd2 - Downloaded (conancenter) msys2/cci.latest#5a31efa2bde593541fd5ac3bcc50c01c - Downloaded (conancenter) yasm/1.3.0#fb800a15413dca19bfaef9e4b5d50694 - Downloaded (conancenter) ======== Computing necessary packages ======== gmp/6.3.0: Checking 3 compatible configurations gmp/6.3.0: Compatible configurations not found in cache, checking servers gmp/6.3.0: '124f2b3f8788df45ac5eef4285c4b1a375128fbd': compiler.cppstd=17 gmp/6.3.0: '904bcb4acc83ef7a21922b21b84cb811e0375efc': compiler.cppstd=20 gmp/6.3.0: 'c8cd6a4425b1ecaa93fbb88e68075cce6632aa77': compiler.cppstd=23 Requirements gmp/6.3.0#df20ffb6d21c34d67704305bcd1dea9e:fd553e9009b9b73e86c5255655089b216aae5178 - Build Build requirements autoconf/2.71#00a1e46d8ba5baaf7f10d64c1a6a0342:da39a3ee5e6b4b0d3255bfef95601890afd80709#7440f8a166fc2063a7fc2b7bed8eacb3 - Download (conancenter) automake/1.16.5#058bda3e21c36c9aa8425daf3c1faf50:ebec3dc6d7f6b907b3ada0c3d3cdc83613a2b715#07094da42a0b39fd4b34760c5f1f3e7d - Download (conancenter) m4/1.4.19#b38ced39a01e31fef5435bc634461fd2:723257509aee8a72faf021920c2874abc738e029#f9a0d644c9e90c7024f844416dbe7384 - Download (conancenter) msys2/cci.latest#5a31efa2bde593541fd5ac3bcc50c01c:956a88975bda9dfcc485e2861d71e74bd7e2b9a5#c99a611f14016fba4a51b85204f62fa3 - Download (conancenter) yasm/1.3.0#fb800a15413dca19bfaef9e4b5d50694:723257509aee8a72faf021920c2874abc738e029#68bb37bc24509a0529e3363ecac8f9e3 - Download (conancenter) ======== Installing packages ======== -------- Downloading 5 packages -------- msys2/cci.latest: Retrieving package 956a88975bda9dfcc485e2861d71e74bd7e2b9a5 from remote 'conancenter' msys2/cci.latest: Downloading 275.1MB conan_package.tgz msys2/cci.latest: Decompressing 275.1MB conan_package.tgz msys2/cci.latest: Package installed 956a88975bda9dfcc485e2861d71e74bd7e2b9a5 msys2/cci.latest: Downloaded package revision c99a611f14016fba4a51b85204f62fa3 yasm/1.3.0: Retrieving package 723257509aee8a72faf021920c2874abc738e029 from remote 'conancenter' yasm/1.3.0: Package installed 723257509aee8a72faf021920c2874abc738e029 yasm/1.3.0: Downloaded package revision 68bb37bc24509a0529e3363ecac8f9e3 m4/1.4.19: Retrieving package 723257509aee8a72faf021920c2874abc738e029 from remote 'conancenter' m4/1.4.19: Package installed 723257509aee8a72faf021920c2874abc738e029 m4/1.4.19: Downloaded package revision f9a0d644c9e90c7024f844416dbe7384 autoconf/2.71: Retrieving package da39a3ee5e6b4b0d3255bfef95601890afd80709 from remote 'conancenter' autoconf/2.71: Package installed da39a3ee5e6b4b0d3255bfef95601890afd80709 autoconf/2.71: Downloaded package revision 7440f8a166fc2063a7fc2b7bed8eacb3 automake/1.16.5: Retrieving package ebec3dc6d7f6b907b3ada0c3d3cdc83613a2b715 from remote 'conancenter' automake/1.16.5: Package installed ebec3dc6d7f6b907b3ada0c3d3cdc83613a2b715 automake/1.16.5: Downloaded package revision 07094da42a0b39fd4b34760c5f1f3e7d yasm/1.3.0: Appending PATH environment variable: C:\Users\cen\.conan2\p\yasm78b751d76798d\p\bin gmp/6.3.0: Sources downloaded from 'conancenter' gmp/6.3.0: Calling source() in C:\Users\cen\.conan2\p\gmpa630188b79556\s\src -------- Installing package gmp/6.3.0 (6 of 6) -------- gmp/6.3.0: Building from source gmp/6.3.0: Package gmp/6.3.0:fd553e9009b9b73e86c5255655089b216aae5178 gmp/6.3.0: Copying sources to build folder gmp/6.3.0: Building your package in C:\Users\cen\.conan2\p\b\gmpb5d767bfd5217\b gmp/6.3.0: Calling generate() gmp/6.3.0: Generators folder: C:\Users\cen\.conan2\p\b\gmpb5d767bfd5217\b\build-release\conan gmp/6.3.0: Generating aggregated env files gmp/6.3.0: Generated aggregated env files: ['conanbuild.sh', 'conanbuild.bat', 'conanrun.bat'] gmp/6.3.0: Calling build() gmp/6.3.0: Apply patch (file): patches/0001-msvc-dumpbin-yasm-wrapper.patch gmp/6.3.0: Apply patch (file): patches/6.x.x-0001-fix-MSVC-next-prime-error.patch gmp/6.3.0: Calling: > "/c/users/cen/.conan2/p/b/gmpb5d767bfd5217/b/src/configure" --disable-shared --enable-static --prefix=/ --bindir=${prefix}/bin --sbindir=${prefix}/bin --libdir=${prefix}/lib --includedir=${prefix}/include --oldincludedir=${prefix}/include --host=i686-unknown-windows --build=x86_64-unknown-windows --with-pic=yes --enable-assembly=no --enable-fat=no --enable-cxx=yes --srcdir=../src ac_cv_c_restrict=restrict gmp_cv_asm_label_suffix=: lt_cv_sys_global_symbol_pipe=cat gmp/6.3.0: RUN: "/c/users/cen/.conan2/p/b/gmpb5d767bfd5217/b/src/configure" --disable-shared --enable-static --prefix=/ --bindir=${prefix}/bin --sbindir=${prefix}/bin --libdir=${prefix}/lib --includedir=${prefix}/include --oldincludedir=${prefix}/include --host=i686-unknown-windows --build=x86_64-unknown-windows --with-pic=yes --enable-assembly=no --enable-fat=no --enable-cxx=yes --srcdir=../src ac_cv_c_restrict=restrict gmp_cv_asm_label_suffix=: lt_cv_sys_global_symbol_pipe=cat conanvcvars.bat: Activating environment Visual Studio 17 - amd64_x86 - winsdk_version=None - vcvars_ver=14.3 [vcvarsall.bat] Environment initialized for: 'x64_x86' MSYS2 is starting for the first time. Executing the initial setup. mkdir: cannot create directory '/dev/shm': Read-only file system Creating /dev/shm directory failed. POSIX semaphores and POSIX shared memory will not work mkdir: cannot create directory '/dev/mqueue': Read-only file system Creating /dev/mqueue directory failed. POSIX message queues will not work Copying skeleton files. These files are for the users to personalise their msys2 experience. They will never be overwritten nor automatically updated. './.bashrc' -> '/home/cen/.bashrc' './.bash_logout' -> '/home/cen/.bash_logout' './.bash_profile' -> '/home/cen/.bash_profile' './.profile' -> '/home/cen/.profile' Initial setup complete. MSYS2 is now ready to use. configure: loading site script /etc/config.site checking build system type... x86_64-unknown-windows checking host system type... i686-unknown-windows checking for a BSD-compatible install... /usr/bin/install -c checking whether build environment is sane... yes checking for i686-unknown-windows-strip... no checking for strip... strip configure: WARNING: using cross tools not prefixed with host triplet checking for a thread-safe mkdir -p... /c/users/cen/.conan2/p/msys27f2f094a41efb/p/bin/msys64/usr/bin/mkdir -p checking for gawk... gawk checking whether make sets $(MAKE)... yes checking whether make supports nested variables... yes checking whether to enable maintainer-specific portions of Makefiles... no checking ABI=32 checking compiler cl -nologo -MD -O2 -Ob2 -FS -DNDEBUG... yes checking compiler cl -nologo -MD -O2 -Ob2 -FS has sizeof(long)==4... yes checking for i686-unknown-windows-gcc... cl -nologo checking whether the C compiler works... yes checking for C compiler default output file name... conftest.exe checking for suffix of executables... .exe checking whether we are cross compiling... yes checking for suffix of object files... obj checking whether we are using the GNU C compiler... no checking whether cl -nologo accepts -g... no checking for cl -nologo option to accept ISO C89... none needed checking whether cl -nologo understands -c and -o together... no checking for /c/Users/cen/.conan2/p/b/gmpb5d767bfd5217/b/src/compile cl -nologo option to accept ISO C99... unsupported checking how to run the C preprocessor... /c/Users/cen/.conan2/p/b/gmpb5d767bfd5217/b/src/compile cl -nologo -E checking build system compiler /c/Users/cen/.conan2/p/b/gmpb5d767bfd5217/b/src/compile cl -nologo... conftest.c yes checking for build system preprocessor... /c/Users/cen/.conan2/p/b/gmpb5d767bfd5217/b/src/compile cl -nologo -E checking for build system executable suffix... conftest.c .exe checking whether build system compiler is ANSI... conftest.c yes checking for build system compiler math library... conftest.c LINK : fatal error LNK1181: cannot open input file 'm.lib' no checking whether we are using the GNU C++ compiler... no checking whether cl -nologo accepts -g... no checking C++ compiler cl -nologo -DNDEBUG /std:c++14 -MD -O2 -Ob2 -EHsc -FS... yes checking how to run the C++ preprocessor... cl -nologo -E checking for grep that handles long lines and -e... /c/users/cen/.conan2/p/msys27f2f094a41efb/p/bin/msys64/usr/bin/grep checking for egrep... /c/users/cen/.conan2/p/msys27f2f094a41efb/p/bin/msys64/usr/bin/grep -E using ABI="32" CC="/c/Users/cen/.conan2/p/b/gmpb5d767bfd5217/b/src/compile cl -nologo" CFLAGS=" -MD -O2 -Ob2 -FS" CPPFLAGS=" -DNDEBUG" CXX="cl -nologo" CXXFLAGS=" /std:c++14 -MD -O2 -Ob2 -EHsc -FS" MPN_PATH="generic" ... ```
cen1 commented 7 months ago

By sheer luck I found a similar issue in https://github.com/conan-io/conan-center-index/issues/22822 and tried to simply rename the libraries.. and it seems to work. I can successfully link.