conan-io / cmake-conan

CMake wrapper for conan C and C++ package manager
MIT License
822 stars 250 forks source link

[develop2] Issues with OpenSSL #530

Open simonimpey opened 1 year ago

simonimpey commented 1 year ago

Hi,

I'm having some issues with the OpenSSL package from the conan-center and am unsure whether this is a recipe issue or a cmake-conan issue. I am using the gcc 13 compiler on Window 11 via a MSYS2 installation.

The primary issue here appears to be that the build is missing definitions from the Windows header files e.g. HINSTANCE, LoadLibrary, FreeLibrary, etc. These are certainly present as I have no issues with my other projects using the same build environment that directly use these.

I suspect this must have something to do with the fact that the recipe seems to think it needs to use the msys2/cci.latest package to do the build, rather than relying on the MSYS2 environment that it is already running from. Could this be an issue of the conan-cmake approach not setting the following in the profile?

[conf]
tools.microsoft.bash:subsystem
tools.microsoft.bash:path

Reading similar issues I would assume it is using the MSYS2 version of the gcc headers/libraries rather than the MinGw ones.

Note that I see similar issues with other packages that are trying to use the AutotoolsToolchain build system e.g. libpq, as part of installing poco. All want to use the msys2/cci.latest package as their build environment and have some sort of issue configuring or running the build.

EDIT: After some further playing around this issue seems to be that gcc/g++ is being sourced from the msys2/cci.latest package rather than using the versions defined for the build itself. It appears to be possible to fix this somewhat by forcing the conan_provider.cmake file to add the following lines to the generated conf:

[buildenv]
CXX={{ MINGW64_ROOT }}/bin/g++.exe
CC={{ MINGW64_ROOT }}/bin/gcc.exe

C:\Users\simon\AppData\Local\JetBrains\Toolbox\apps\CLion\ch-0\231.9161.40\bin\cmake\win\x64\bin\cmake.exe -DCMAKE_BUILD_TYPE=Debug -DCMAKE_MAKE_PROGRAM=C:/ProgramData/MSYS2/ucrt64/bin/ninja.exe -DCMAKE_C_COMPILER=C:/ProgramData/MSYS2/ucrt64/bin/gcc.exe -DCMAKE_CXX_COMPILER=C:/ProgramData/MSYS2/ucrt64/bin/g++.exe -G Ninja -DCMAKE_PROJECT_TOP_LEVEL_INCLUDES=Conan.cmake -S C:\Users\simon\Source\Projects\EQL -B C:\Users\simon\Source\Projects\EQL\x64\Debug -- CMake-Conan: first find_package() found. Installing dependencies with Conan -- CMake-Conan: Checking if a default profile exists C:\Users\simon.conan2\profiles\default -- CMake-Conan: cmake_system_name=Windows -- CMake-Conan: cmake_system_processor=x86_64 -- CMake-Conan: CMake compiler=GNU -- CMake-Conan: CMake compiler version=13.1.0 -- CMake-Conan: [settings] compiler=gcc -- CMake-Conan: [settings] compiler.version=13 -- CMake-Conan: Creating profile C:/Users/simon/Source/Projects/EQL/x64/Debug/conan_host_profile -- CMake-Conan: Profile: include(default) [settings] arch=x86_64 os=Windows compiler=gcc compiler.version=13 compiler.cppstd=20 build_type=Debug [conf] tools.cmake.cmaketoolchain:generator=Ninja

-- CMake-Conan: Installing single configuration Debug -- CMake-Conan: conan install C:/Users/simon/Source/Projects/EQL -of=C:/Users/simon/Source/Projects/EQL/x64/Debug/conan -pr;C:/Users/simon/Source/Projects/EQL/x64/Debug/conan_host_profile;--build=missing;-g;CMakeDeps

======== Input profiles ======== Profile host: [settings] arch=x86_64 build_type=Debug compiler=gcc compiler.cppstd=20 compiler.libcxx=libstdc++11 compiler.version=13 os=Windows [conf] tools.cmake.cmaketoolchain:generator=Ninja

Profile build: [settings] arch=x86_64 build_type=Release compiler=gcc compiler.cppstd=gnu17 compiler.libcxx=libstdc++11 compiler.version=12 os=Windows

======== Computing dependency graph ======== openssl/3.1.1: Not found in local cache, looking in remotes... openssl/3.1.1: Checking remote: conancenter openssl/3.1.1: Downloaded recipe revision 3a25e05b364f335633143656dc265841 zlib/1.2.13: Not found in local cache, looking in remotes... zlib/1.2.13: Checking remote: conancenter zlib/1.2.13: Downloaded recipe revision e377bee636333ae348d51ca90874e353 nasm/2.15.05: Not found in local cache, looking in remotes... nasm/2.15.05: Checking remote: conancenter nasm/2.15.05: Downloaded recipe revision 799d63b1672a337584b09635b0f22fc1 strawberryperl/5.32.1.1: Not found in local cache, looking in remotes... strawberryperl/5.32.1.1: Checking remote: conancenter strawberryperl/5.32.1.1: Downloaded recipe revision 8f83d05a60363a422f9033e52d106b47 msys2/cci.latest: Not found in local cache, looking in remotes... msys2/cci.latest: Checking remote: conancenter msys2/cci.latest: Downloaded recipe revision 567331f1604f3c584f04feade960f06e Graph root conanfile.py: C:/Users/simon/Source/Projects/EQL\conanfile.py Requirements gtest/cci.20210126#dafbdf84b58cd687075ace7314651c1a - Cache openssl/3.1.1#3a25e05b364f335633143656dc265841 - Downloaded (conancenter) rapidjson/cci.20220822#8ca51918340f3a21127822258e95ec0f - Cache zlib/1.2.13#e377bee636333ae348d51ca90874e353 - Downloaded (conancenter) Build requirements msys2/cci.latest#567331f1604f3c584f04feade960f06e - Downloaded (conancenter) nasm/2.15.05#799d63b1672a337584b09635b0f22fc1 - Downloaded (conancenter) strawberryperl/5.32.1.1#8f83d05a60363a422f9033e52d106b47 - Downloaded (conancenter)

======== Computing necessary packages ======== Requirements gtest/cci.20210126#dafbdf84b58cd687075ace7314651c1a:4e5bdac0e2dee827b03f7b3cc5b950264e512650#02671df47956e4b076f0602b42682d90 - Cache openssl/3.1.1#3a25e05b364f335633143656dc265841:2799bd3a510a9427d114f466c75d5e79345ea39a - Build rapidjson/cci.20220822#8ca51918340f3a21127822258e95ec0f:da39a3ee5e6b4b0d3255bfef95601890afd80709#a99fd0306f219909b3c1b1059abc47e9 - Cache zlib/1.2.13#e377bee636333ae348d51ca90874e353:f60e50a74ab05a616895712be87aa8c9377863ad - Build Build requirements msys2/cci.latest#567331f1604f3c584f04feade960f06e:956a88975bda9dfcc485e2861d71e74bd7e2b9a5#ce3addef73068ed1ad9ca9976b2d50c1 - Download (conancenter) nasm/2.15.05#799d63b1672a337584b09635b0f22fc1:723257509aee8a72faf021920c2874abc738e029#35f6a3ef14b15246b30071d024e4f18d - Download (conancenter) Skipped binaries strawberryperl/5.32.1.1

======== Installing packages ========

-------- Downloading 2 packages -------- msys2/cci.latest: Retrieving package 956a88975bda9dfcc485e2861d71e74bd7e2b9a5 from remote 'conancenter' msys2/cci.latest: Downloading 358.5MB conan_package.tgz msys2/cci.latest: Downloaded 298.5MB 83% conan_package.tgz msys2/cci.latest: Decompressing 358.5MB conan_package.tgz msys2/cci.latest: Package installed 956a88975bda9dfcc485e2861d71e74bd7e2b9a5 msys2/cci.latest: Downloaded package revision ce3addef73068ed1ad9ca9976b2d50c1 nasm/2.15.05: Retrieving package 723257509aee8a72faf021920c2874abc738e029 from remote 'conancenter' nasm/2.15.05: Package installed 723257509aee8a72faf021920c2874abc738e029 nasm/2.15.05: Downloaded package revision 35f6a3ef14b15246b30071d024e4f18d gtest/cci.20210126: Already installed! (1 of 6) rapidjson/cci.20220822: Already installed! (3 of 6) zlib/1.2.13: Sources downloaded from 'conancenter' zlib/1.2.13: Calling source() in C:\Users\simon.conan2\p\zlib15353192ba4c5\s\src

-------- Installing package zlib/1.2.13 (4 of 6) -------- zlib/1.2.13: Building from source zlib/1.2.13: Package zlib/1.2.13:f60e50a74ab05a616895712be87aa8c9377863ad zlib/1.2.13: Copying sources to build folder zlib/1.2.13: Building your package in C:\Users\simon.conan2\p\b\zlibe4b7e343cf3fa\b zlib/1.2.13: Calling generate() zlib/1.2.13: Generators folder: C:\Users\simon.conan2\p\b\zlibe4b7e343cf3fa\b\build\Debug\generators zlib/1.2.13: CMakeToolchain generated: conan_toolchain.cmake zlib/1.2.13: CMakeToolchain generated: CMakePresets.json zlib/1.2.13: CMakeToolchain generated: ......\src\CMakeUserPresets.json zlib/1.2.13: Generating aggregated env files zlib/1.2.13: Generated aggregated env files: ['conanbuild.bat', 'conanrun.bat'] zlib/1.2.13: Calling build() zlib/1.2.13: Running CMake.configure() zlib/1.2.13: RUN: cmake -G "Ninja" -DCMAKE_TOOLCHAIN_FILE="C:/Users/simon/.conan2/p/b/zlibe4b7e343cf3fa/b/build/Debug/generators/conan_toolchain.cmake" -DCMAKE_INSTALL_PREFIX="C:/Users/simon/.conan2/p/b/zlibe4b7e343cf3fa/p" -DCMAKE_POLICY_DEFAULT_CMP0091="NEW" -DCMAKE_BUILD_TYPE="Debug" "C:\Users\simon.conan2\p\b\zlibe4b7e343cf3fa\b\src" -- Using Conan toolchain: C:/Users/simon/.conan2/p/b/zlibe4b7e343cf3fa/b/build/Debug/generators/conan_toolchain.cmake -- Conan toolchain: Setting BUILD_SHARED_LIBS = OFF -- The C compiler identification is GNU 13.1.0 -- Detecting C compiler ABI info -- Detecting C compiler ABI info - done -- Check for working C compiler: C:/ProgramData/MSYS2/ucrt64/bin/cc.exe - skipped -- Detecting C compile features -- Detecting C compile features - done -- Looking for sys/types.h -- Looking for sys/types.h - found -- Looking for stdint.h -- Looking for stdint.h - found -- Looking for stddef.h -- Looking for stddef.h - found -- Check size of off64_t -- Check size of off64_t - done -- Looking for fseeko -- Looking for fseeko - found -- Looking for unistd.h -- Looking for unistd.h - found -- Renaming -- C:/Users/simon/.conan2/p/b/zlibe4b7e343cf3fa/b/src/zconf.h -- to 'zconf.h.included' because this file is included with zlib -- but CMake generates it automatically in the build directory. -- Configuring done (3.2s) -- Generating done (0.0s) -- Build files have been written to: C:/Users/simon/.conan2/p/b/zlibe4b7e343cf3fa/b/build/Debug

zlib/1.2.13: Running CMake.build() zlib/1.2.13: RUN: cmake --build "C:\Users\simon.conan2\p\b\zlibe4b7e343cf3fa\b\build\Debug" -- -j24 [1/16] Building C object CMakeFiles/zlib.dir/compress.c.obj [2/16] Building C object CMakeFiles/zlib.dir/adler32.c.obj [3/16] Building C object CMakeFiles/zlib.dir/gzclose.c.obj [4/16] Building C object CMakeFiles/zlib.dir/crc32.c.obj [5/16] Building C object CMakeFiles/zlib.dir/gzlib.c.obj [6/16] Building C object CMakeFiles/zlib.dir/gzread.c.obj [7/16] Building C object CMakeFiles/zlib.dir/inftrees.c.obj [8/16] Building C object CMakeFiles/zlib.dir/gzwrite.c.obj [9/16] Building C object CMakeFiles/zlib.dir/uncompr.c.obj [10/16] Building C object CMakeFiles/zlib.dir/infback.c.obj [11/16] Building C object CMakeFiles/zlib.dir/inffast.c.obj [12/16] Building C object CMakeFiles/zlib.dir/zutil.c.obj [13/16] Building C object CMakeFiles/zlib.dir/trees.c.obj [14/16] Building C object CMakeFiles/zlib.dir/inflate.c.obj [15/16] Building C object CMakeFiles/zlib.dir/deflate.c.obj [16/16] Linking C static library libz.a

zlib/1.2.13: Package 'f60e50a74ab05a616895712be87aa8c9377863ad' built zlib/1.2.13: Build folder C:\Users\simon.conan2\p\b\zlibe4b7e343cf3fa\b\build\Debug zlib/1.2.13: Generating the package zlib/1.2.13: Temporary package folder C:\Users\simon.conan2\p\b\zlibe4b7e343cf3fa\p zlib/1.2.13: Calling package() zlib/1.2.13: Running CMake.install() zlib/1.2.13: RUN: cmake --install "C:\Users\simon.conan2\p\b\zlibe4b7e343cf3fa\b\build\Debug" --prefix "C:/Users/simon/.conan2/p/b/zlibe4b7e343cf3fa/p" -- Install configuration: "Debug" -- Installing: C:/Users/simon/.conan2/p/b/zlibe4b7e343cf3fa/p/lib/libz.a -- Installing: C:/Users/simon/.conan2/p/b/zlibe4b7e343cf3fa/p/include/zconf.h -- Installing: C:/Users/simon/.conan2/p/b/zlibe4b7e343cf3fa/p/include/zlib.h

zlib/1.2.13: package(): Packaged 2 '.h' files: zconf.h, zlib.h zlib/1.2.13: package(): Packaged 1 '.a' file: libz.a zlib/1.2.13: package(): Packaged 1 file: LICENSE zlib/1.2.13: Created package revision 1ee9d68c4395be72826aa7e14aab1a55 zlib/1.2.13: Package 'f60e50a74ab05a616895712be87aa8c9377863ad' created zlib/1.2.13: Full package reference: zlib/1.2.13#e377bee636333ae348d51ca90874e353:f60e50a74ab05a616895712be87aa8c9377863ad#1ee9d68c4395be72826aa7e14aab1a55 zlib/1.2.13: Package folder C:\Users\simon.conan2\p\b\zlibe4b7e343cf3fa\p openssl/3.1.1: Calling source() in C:\Users\simon.conan2\p\opensfad028b371990\s\src openssl/3.1.1: Downloading 15.5MB openssl-3.1.1.tar.gz

-------- Installing package openssl/3.1.1 (6 of 6) -------- openssl/3.1.1: Building from source openssl/3.1.1: Package openssl/3.1.1:2799bd3a510a9427d114f466c75d5e79345ea39a openssl/3.1.1: Copying sources to build folder openssl/3.1.1: Building your package in C:\Users\simon.conan2\p\b\opens0633aab6bf623\b openssl/3.1.1: Calling generate() openssl/3.1.1: Generators folder: C:\Users\simon.conan2\p\b\opens0633aab6bf623\b\build-debug\conan openssl/3.1.1: using target: mingw-conan-Debug-Windows-x86_64-gcc-13 -> mingw64 openssl/3.1.1: my %targets = ( "mingw-conan-Debug-Windows-x86_64-gcc-13" => { inherit_from => [ "mingw64" ], cflags => add("-m64 -g"), cxxflags => add("-m64 -g"),

    lflags => add("-m64"),

},

);

openssl/3.1.1: Generating aggregated env files openssl/3.1.1: Generated aggregated env files: ['conanbuild.sh', 'conanrun.bat'] openssl/3.1.1: Calling build() openssl/3.1.1: RUN: perl ./Configure "mingw-conan-Debug-Windows-x86_64-gcc-13" no-shared --prefix=/ --libdir=lib --openssldir="/c/users/simon/.conan2/p/b/opens0633aab6bf623/p/res" no-unit-test threads PERL=perl no-tests --debug enable-fips no-md2 zlib --with-zlib-include="C:/Users/simon/.conan2/p/b/zlibe4b7e343cf3fa/p/include" --with-zlib-lib="C:/Users/simon/.conan2/p/b/zlibe4b7e343cf3fa/p/lib/z.lib" MSYS2 is starting for the first time. Executing the initial setup. Copying skeleton files. These files are for the users to personalise their msys2 experience.

They will never be overwritten nor automatically updated.

'./.bashrc' -> '/home/simon/.bashrc' './.bash_logout' -> '/home/simon/.bash_logout' './.bash_profile' -> '/home/simon/.bash_profile' './.profile' -> '/home/simon/.profile' Initial setup complete. MSYS2 is now ready to use. Configuring OpenSSL version 3.1.1 for target mingw-conan-Debug-Windows-x86_64-gcc-13 Using os-specific seed configuration Created configdata.pm Running configdata.pm Created Makefile.in Created Makefile Created include/openssl/configuration.h



OpenSSL has been successfully configured


If you encounter a problem while building, please open an issue on GitHub https://github.com/openssl/openssl/issues and include the output from the following command:


perl configdata.pm --dump


(If you are new to OpenSSL, you might want to consult the 'Troubleshooting' section in the INSTALL.md file first)



openssl/3.1.1: RUN: make -j24 perl "-I." -Mconfigdata "util/dofile.pl" "-oMakefile" include/crypto/bn_conf.h.in > include/crypto/bn_conf.h perl "-I." -Mconfigdata "util/dofile.pl" "-oMakefile" include/crypto/dso_conf.h.in > include/crypto/dso_conf.h perl "-I." -Mconfigdata "util/dofile.pl" "-oMakefile" include/openssl/asn1.h.in > include/openssl/asn1.h perl "-I." -Mconfigdata "util/dofile.pl" "-oMakefile" include/openssl/asn1t.h.in > include/openssl/asn1t.h perl "-I." -Mconfigdata "util/dofile.pl" "-oMakefile" include/openssl/bio.h.in > include/openssl/bio.h perl "-I." -Mconfigdata "util/dofile.pl" "-oMakefile" include/openssl/cmp.h.in > include/openssl/cmp.h perl "-I." -Mconfigdata "util/dofile.pl" "-oMakefile" include/openssl/cms.h.in > include/openssl/cms.h perl "-I." -Mconfigdata "util/dofile.pl" "-oMakefile" include/openssl/conf.h.in > include/openssl/conf.h perl "-I." -Mconfigdata "util/dofile.pl" "-oMakefile" include/openssl/crmf.h.in > include/openssl/crmf.h perl "-I." -Mconfigdata "util/dofile.pl" "-oMakefile" include/openssl/crypto.h.in > include/openssl/crypto.h perl "-I." -Mconfigdata "util/dofile.pl" "-oMakefile" include/openssl/ct.h.in > include/openssl/ct.h perl "-I." -Mconfigdata "util/dofile.pl" "-oMakefile" include/openssl/err.h.in > include/openssl/err.h perl "-I." -Mconfigdata "util/dofile.pl" "-oMakefile" include/openssl/ess.h.in > include/openssl/ess.h perl "-I." -Mconfigdata "util/dofile.pl" "-oMakefile" include/openssl/fipskey.h.in > include/openssl/fipskey.h perl "-I." -Mconfigdata "util/dofile.pl" "-oMakefile" include/openssl/lhash.h.in > include/openssl/lhash.h perl "-I." -Mconfigdata "util/dofile.pl" "-oMakefile" include/openssl/ocsp.h.in > include/openssl/ocsp.h perl "-I." -Mconfigdata "util/dofile.pl" "-oMakefile" include/openssl/opensslv.h.in > include/openssl/opensslv.h perl "-I." -Mconfigdata "util/dofile.pl" "-oMakefile" include/openssl/pkcs12.h.in > include/openssl/pkcs12.h perl "-I." -Mconfigdata "util/dofile.pl" "-oMakefile" include/openssl/pkcs7.h.in > include/openssl/pkcs7.h perl "-I." -Mconfigdata "util/dofile.pl" "-oMakefile" include/openssl/safestack.h.in > include/openssl/safestack.h perl "-I." -Mconfigdata "util/dofile.pl" "-oMakefile" include/openssl/srp.h.in > include/openssl/srp.h perl "-I." -Mconfigdata "util/dofile.pl" "-oMakefile" include/openssl/ssl.h.in > include/openssl/ssl.h perl "-I." -Mconfigdata "util/dofile.pl" "-oMakefile" include/openssl/ui.h.in > include/openssl/ui.h perl "-I." -Mconfigdata "util/dofile.pl" "-oMakefile" include/openssl/x509.h.in > include/openssl/x509.h perl "-I." -Mconfigdata "util/dofile.pl" "-oMakefile" include/openssl/x509_vfy.h.in > include/openssl/x509_vfy.h perl "-I." -Mconfigdata "util/dofile.pl" "-oMakefile" include/openssl/x509v3.h.in > include/openssl/x509v3.h make depend && make _build_sw make[1]: Entering directory '/c/Users/simon/.conan2/p/b/opens0633aab6bf623/b/src' make[1]: Leaving directory '/c/Users/simon/.conan2/p/b/opens0633aab6bf623/b/src' make[1]: Entering directory '/c/Users/simon/.conan2/p/b/opens0633aab6bf623/b/src' gcc -I. -Iinclude -Iapps/include -m64 -m64 -g -m64 -g -DL_ENDIAN -DOPENSSL_PIC -DOPENSSLDIR="\"/c/users/simon/.conan2/p/b/opens0633aab6bf623/p/res\"" -DENGINESDIR="\"//lib/engines-3\"" -DMODULESDIR="\"//lib/ossl-modules\"" -DUNICODE -D_UNICODE -DWIN32_LEAN_AND_MEAN -D_MT -DOPENSSL_BUILDING_OPENSSL -DZLIB -IC:/Users/simon/.conan2/p/b/zlibe4b7e343cf3fa/p/include -MMD -MF apps/lib/libapps-lib-app_libctx.d.tmp -MT apps/lib/libapps-lib-app_libctx.obj -c -o apps/lib/libapps-lib-app_libctx.obj apps/lib/app_libctx.c gcc -I. -Iinclude -Iapps/include -m64 -m64 -g -m64 -g -DL_ENDIAN -DOPENSSL_PIC -DOPENSSLDIR="\"/c/users/simon/.conan2/p/b/opens0633aab6bf623/p/res\"" -DENGINESDIR="\"//lib/engines-3\"" -DMODULESDIR="\"//lib/ossl-modules\"" -DUNICODE -D_UNICODE -DWIN32_LEAN_AND_MEAN -D_MT -DOPENSSL_BUILDING_OPENSSL -DZLIB -IC:/Users/simon/.conan2/p/b/zlibe4b7e343cf3fa/p/include -MMD -MF apps/lib/libapps-lib-app_params.d.tmp -MT apps/lib/libapps-lib-app_params.obj -c -o apps/lib/libapps-lib-app_params.obj apps/lib/app_params.c gcc -I. -Iinclude -Iapps/include -m64 -m64 -g -m64 -g -DL_ENDIAN -DOPENSSL_PIC -DOPENSSLDIR="\"/c/users/simon/.conan2/p/b/opens0633aab6bf623/p/res\"" -DENGINESDIR="\"//lib/engines-3\"" -DMODULESDIR="\"//lib/ossl-modules\"" -DUNICODE -D_UNICODE -DWIN32_LEAN_AND_MEAN -D_MT -DOPENSSL_BUILDING_OPENSSL -DZLIB -IC:/Users/simon/.conan2/p/b/zlibe4b7e343cf3fa/p/include -MMD -MF apps/lib/libapps-lib-app_provider.d.tmp -MT apps/lib/libapps-lib-app_provider.obj -c -o apps/lib/libapps-lib-app_provider.obj apps/lib/app_provider.c . . . gcc -I. -Iinclude -Iproviders/common/include -Iproviders/implementations/include -DAES_ASM -DBSAES_ASM -DCMLL_ASM -DECP_NISTZ256_ASM -DGHASH_ASM -DKECCAK1600_ASM -DMD5_ASM -DOPENSSL_BN_ASM_GF2m -DOPENSSL_BN_ASM_MONT -DOPENSSL_BN_ASM_MONT5 -DOPENSSL_CPUID_OBJ -DOPENSSL_IA32_SSE2 -DPADLOCK_ASM -DPOLY1305_ASM -DSHA1_ASM -DSHA256_ASM -DSHA512_ASM -DVPAES_ASM -DWHIRLPOOL_ASM -DX25519_ASM -m64 -m64 -g -m64 -g -DL_ENDIAN -DOPENSSL_PIC -DOPENSSLDIR="\"/c/users/simon/.conan2/p/b/opens0633aab6bf623/p/res\"" -DENGINESDIR="\"//lib/engines-3\"" -DMODULESDIR="\"//lib/ossl-modules\"" -DUNICODE -D_UNICODE -DWIN32_LEAN_AND_MEAN -D_MT -DOPENSSL_BUILDING_OPENSSL -DZLIB -IC:/Users/simon/.conan2/p/b/zlibe4b7e343cf3fa/p/include -MMD -MF crypto/ec/curve448/libcrypto-lib-curve448_tables.d.tmp -MT crypto/ec/curve448/libcrypto-lib-curve448_tables.obj -c -o crypto/ec/curve448/libcrypto-lib-curve448_tables.obj crypto/ec/curve448/curve448_tables.c gcc -I. -Iinclude -Iproviders/common/include -Iproviders/implementations/include -DAES_ASM -DBSAES_ASM -DCMLL_ASM -DECP_NISTZ256_ASM -DGHASH_ASM -DKECCAK1600_ASM -DMD5_ASM -DOPENSSL_BN_ASM_GF2m -DOPENSSL_BN_ASM_MONT -DOPENSSL_BN_ASM_MONT5 -DOPENSSL_CPUID_OBJ -DOPENSSL_IA32_SSE2 -DPADLOCK_ASM -DPOLY1305_ASM -DSHA1_ASM -DSHA256_ASM -DSHA512_ASM -DVPAES_ASM -DWHIRLPOOL_ASM -DX25519_ASM -m64 -m64 -g -m64 -g -DL_ENDIAN -DOPENSSL_PIC -DOPENSSLDIR="\"/c/users/simon/.conan2/p/b/opens0633aab6bf623/p/res\"" -DENGINESDIR="\"//lib/engines-3\"" -DMODULESDIR="\"//lib/ossl-modules\"" -DUNICODE -D_UNICODE -DWIN32_LEAN_AND_MEAN -D_MT -DOPENSSL_BUILDING_OPENSSL -DZLIB -IC:/Users/simon/.conan2/p/b/zlibe4b7e343cf3fa/p/include -MMD -MF crypto/ec/curve448/libcrypto-lib-eddsa.d.tmp -MT crypto/ec/curve448/libcrypto-lib-eddsa.obj -c -o crypto/ec/curve448/libcrypto-lib-eddsa.obj crypto/ec/curve448/eddsa.c gcc -I. -Iinclude -Iproviders/common/include -Iproviders/implementations/include -DAES_ASM -DBSAES_ASM -DCMLL_ASM -DECP_NISTZ256_ASM -DGHASH_ASM -DKECCAK1600_ASM -DMD5_ASM -DOPENSSL_BN_ASM_GF2m -DOPENSSL_BN_ASM_MONT -DOPENSSL_BN_ASM_MONT5 -DOPENSSL_CPUID_OBJ -DOPENSSL_IA32_SSE2 -DPADLOCK_ASM -DPOLY1305_ASM -DSHA1_ASM -DSHA256_ASM -DSHA512_ASM -DVPAES_ASM -DWHIRLPOOL_ASM -DX25519_ASM -m64 -m64 -g -m64 -g -DL_ENDIAN -DOPENSSL_PIC -DOPENSSLDIR="\"/c/users/simon/.conan2/p/b/opens0633aab6bf623/p/res\"" -DENGINESDIR="\"//lib/engines-3\"" -DMODULESDIR="\"//lib/ossl-modules\"" -DUNICODE -D_UNICODE -DWIN32_LEAN_AND_MEAN -D_MT -DOPENSSL_BUILDING_OPENSSL -DZLIB -IC:/Users/simon/.conan2/p/b/zlibe4b7e343cf3fa/p/include -MMD -MF crypto/ec/curve448/libcrypto-lib-f_generic.d.tmp -MT crypto/ec/curve448/libcrypto-lib-f_generic.obj -c -o crypto/ec/curve448/libcrypto-lib-f_generic.obj crypto/ec/curve448/f_generic.c crypto/dso/dso_win32.c: In function 'win32_load': crypto/dso/dso_win32.c:98:5: error: unknown type name 'HINSTANCE' 98 | HINSTANCE h = NULL, p = NULL; | ^~~~~ crypto/dso/dso_win32.c:98:19: warning: initialization of 'int' from 'void ' makes integer from pointer without a cast [-Wint-conversion] 98 | HINSTANCE h = NULL, p = NULL; | ^~~~ crypto/dso/dso_win32.c:106:9: warning: implicit declaration of function 'LoadLibraryA' [-Wimplicit-function-declaration] 106 | h = LoadLibraryA(filename); | ^~~~ crypto/dso/dso_win32.c:107:11: warning: comparison between pointer and integer 107 | if (h == NULL) { | ^~ crypto/dso/dso_win32.c:129:11: warning: comparison between pointer and integer 129 | if (h != NULL) | ^~ crypto/dso/dso_win32.c:130:9: warning: implicit declaration of function 'FreeLibrary' [-Wimplicit-function-declaration] 130 | FreeLibrary(h); | ^~~ crypto/dso/dso_win32.c: In function 'win32_unload': crypto/dso/dso_win32.c:136:5: error: unknown type name 'HINSTANCE' 136 | HINSTANCE p; | ^~~~~ crypto/dso/dso_win32.c: In function 'win32_bind_func': crypto/dso/dso_win32.c:163:5: error: unknown type name 'HINSTANCE' 163 | HINSTANCE ptr; | ^~~~~ crypto/dso/dso_win32.c:166:9: error: unknown type name 'FARPROC' 166 | FARPROC f; | ^~~ crypto/dso/dso_win32.c:182:13: warning: implicit declaration of function 'GetProcAddress' [-Wimplicit-function-declaration] 182 | sym.f = GetProcAddress(ptr, symname); | ^~~~~~ crypto/dso/dso_win32.c:187:12: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast] 187 | return (DSO_FUNC_TYPE)sym.f; | ^ . . . crypto/dso/dso_win32.c:618:9: error: unknown type name 'FARPROC' 618 | FARPROC f; | ^~~ crypto/dso/dso_win32.c:622:13: warning: comparison between pointer and integer 622 | if (dll == NULL) { | ^~ crypto/dso/dso_win32.c:627:20: error: 'CREATETOOLHELP32SNAPSHOT' undeclared (first use in this function) 627 | create_snap = (CREATETOOLHELP32SNAPSHOT) | ^~~~~~~~ crypto/dso/dso_win32.c:627:45: error: expected ';' before 'GetProcAddress' 627 | create_snap = (CREATETOOLHELP32SNAPSHOT) | ^ | ; 628 | GetProcAddress(dll, "CreateToolhelp32Snapshot"); | ~~~~~~
crypto/dso/dso_win32.c:629:21: warning: comparison between pointer and integer 629 | if (create_snap == NULL) { | ^~ crypto/dso/dso_win32.c:639:19: error: 'CLOSETOOLHELP32SNAPSHOT' undeclared (first use in this function) 639 | close_snap = (CLOSETOOLHELP32SNAPSHOT) CloseHandle; | ^~~~~~~ crypto/dso/dso_win32.c:639:43: error: expected ';' before 'CloseHandle' 639 | close_snap = (CLOSETOOLHELP32SNAPSHOT) CloseHandle; | ^~~~ | ; crypto/dso/dso_win32.c:641:21: error: 'MODULE32' undeclared (first use in this function); did you mean 'MODULESDIR'? 641 | module_first = (MODULE32) GetProcAddress(dll, "Module32First"); | ^~~~ | MODULESDIR crypto/dso/dso_win32.c:641:30: error: expected ';' before 'GetProcAddress' 641 | module_first = (MODULE32) GetProcAddress(dll, "Module32First"); | ^~~~~~~ | ; crypto/dso/dso_win32.c:642:29: error: expected ';' before 'GetProcAddress' 642 | module_next = (MODULE32) GetProcAddress(dll, "Module32Next"); | ^~~~~~~ | ; crypto/dso/dso_win32.c:644:20: error: invalid type argument of unary '' (have 'int') 644 | hModuleSnap = (create_snap) (TH32CS_SNAPMODULE, 0); | ^~~~ crypto/dso/dso_win32.c:653:11: error: invalid type argument of unary '' (have 'int') 653 | if (!(module_first) (hModuleSnap, &me32)) { | ^~~~~ crypto/dso/dso_win32.c:654:10: error: invalid type argument of unary '' (have 'int') 654 | (close_snap) (hModuleSnap); | ^~~ crypto/dso/dso_win32.c:661:14: error: invalid type argument of unary '' (have 'int') 661 | (close_snap) (hModuleSnap); | ^~~ crypto/dso/dso_win32.c:665:15: error: invalid type argument of unary '' (have 'int') 665 | } while ((module_next) (hModuleSnap, &me32)); | ^~~~ crypto/dso/dso_win32.c:667:6: error: invalid type argument of unary '' (have 'int') 667 | (close_snap) (hModuleSnap); | ^~~ make[1]: [Makefile:6639: crypto/dso/libcrypto-lib-dso_win32.obj] Error 1 make[1]: Waiting for unfinished jobs.... make[1]: Leaving directory '/c/Users/simon/.conan2/p/b/opens0633aab6bf623/b/src' make: *** [Makefile:2357: build_sw] Error 2

openssl/3.1.1: ERROR: Package '2799bd3a510a9427d114f466c75d5e79345ea39a' build failed openssl/3.1.1: WARN: Build folder C:\Users\simon.conan2\p\b\opens0633aab6bf623\b\build-debug


Recipe 'openssl/3.1.1' cannot build its binary It is possible that this recipe is not Conan 2.0 ready If the recipe comes from ConanCenter check: https://conan.io/cci-v2.html If it is your recipe, check if it is updated to 2.0


ERROR: openssl/3.1.1: Error in build() method, line 519 self._make() while calling '_make', line 512 self._run_make() while calling '_run_make', line 489 self.run(" ".join(command), env="conanbuild") ConanException: Error 2 while executing CMake Error at x64/Debug/conan_provider.cmake:197 (message): Conan install failed='1' Call Stack (most recent call first): x64/Debug/conan_provider.cmake:263 (conan_install) Common/JSON/CMakeLists.txt:3 (find_package)

-- Configuring incomplete, errors occurred! See also "C:/Users/simon/Source/Projects/EQL/x64/Debug/CMakeFiles/CMakeOutput.log".

[Failed to reload]

memsharded commented 1 year ago

Hi @simonimpey

package to do the build, rather than relying on the MSYS2 environment that it is already running from. Could this be an issue of the conan-cmake approach not setting the following in the profile?

Yes, definitely the current 2.0 implementation (I understand that you are using 2.0) is not managing msys2 at all. I don't even know how/if possible to reliably detect the subsystem from CMake.

There are other side issues, that might not be fully related to cmake-conan, but related to running inside a msys2 terminal. All testing of the client and all recipes in ConanCenter that requires msys2 are done by running in cmd/cmder terminal, and then activating the msys2 bash. The problem is that testing things like running inside msys2 is way more complicated. So it is possible that there are a few things that are not smooth for this use case.

Finally, some recipes from ConanCenter, specially the special ones like OpenSSL might have their own special issues to build in msys2/mingw, both externally and running inside a msys2 terminal.

I'd definitely start with the first 2 point, those things can be done in parallel and independently. The 2nd point is the most important one, but the challenge of testing is always there.

Also, as a note there is a conf called tools.microsoft.bash:active: If Conan is already running inside bash terminal in Windows, that is specific for this use case (again, it doesn't mean that this will go smoothly, as this is undertested)

simonimpey commented 1 year ago

Hey,

Thanks for the reply. Just to follow up I was able to address this issue by modifying the conan_provider.cmake to insert the following lines into the generated profile:

[buildenv]
CC=${CMAKE_CXX_COMPILER}
CXX=${CMAKE_C_COMPILER}

obviously in the script those were resolved to their actual values. This seemed to allow the AutotoolsToolchain to use the correct compiler and the build succeeded.

It's worth noting that the install failed later as elements of the AutotoolsToolchain seem to have trouble understanding the Windows path separators and so files were not found/copied to the correct locations. I guess maybe this is a job for the recipe to ensure they are all converted to Unix style?

memsharded commented 1 year ago

It sounds like defining tools.build:compiler_executables based on CMAKE_CXX_COMPILER and CMAKE_C_COMPILER would make sense, thanks for the suggestion.