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

[package] poco/1.13.0+: Missing extension of system_libs to include mswsock for MinGW #26404

Open
lbakman opened this issue Jan 17, 2025 · 1 comment · May be fixed by #26419
Open

[package] poco/1.13.0+: Missing extension of system_libs to include mswsock for MinGW #26404

lbakman opened this issue Jan 17, 2025 · 1 comment · May be fixed by #26419
Assignees
Labels
bug Something isn't working

Comments

@lbakman
Copy link
Contributor

lbakman commented Jan 17, 2025

Description

In version 1.13.0, poco added a dependency on mswsock.lib to the poco_net component (pocoproject/poco@214b544) when building with MinGW.

The dependency was added to Net/CMakeLists.txt line 34.

This additional dependency has not been reflected in package_info method of the current poco recipe.

The problem occurs when poco is built as a static library with the poco_net component enabled (enable_net=True) using MinGW, but does not manifest itself until poco_net is linked to by a consuming recipe.

My suggestion is to add the following to conanfile.py:

    @property
    def _is_mingw(self):
        return self.settings.os == "Windows" and self.settings.compiler == "gcc"

    def package_info(self):
        ...
        if self.options.enable_net:
            if not self.options.shared and self._is_mingw and Version(self.version) >= "1.13.0":
                self.cpp_info.components["poco_net"].system_libs.extend(["mswsock"])
        ...        

Not sure about the long if statement or if it is better to split it.

I can provide a pull request, but I would like to know if this is the correct approach.

Package and Environment Details

  • Package Name/Version: poco/1.13.0+
  • Operating System+version: Windows 10/11
  • Compiler+version: MinGW GCC 14 (from mingw-builds/14.2.0)
  • Conan version: conan 2.11.0
  • Python version: Python 3.10.11
  • CMake version: CMake 3.16.3

Conan profile

mingw_host:
[settings]
os=Windows
arch=x86_64
build_type=Release
compiler=gcc
compiler.version=14
compiler.libcxx=libstdc++11
compiler.threads=posix
compiler.exception=seh

[tool_requires]
mingw-builds/14.2.0

mingw_build:
[settings]
os=Windows
arch=x86_64
build_type=Release

Steps to reproduce

git clone https://github.com/lbakman/poco-net-spike.git
conan build poco-net-spike -pr:h=mingw_host -pr:b=mingw_build --build=missing

Logs

Click to expand log
...>conan build poco-net-spike -pr:h=mingw_host -pr:b=mingw_build --build=missing


======== Input profiles ========
Profile host:
[settings]
arch=x86_64
build_type=Release
compiler=gcc
compiler.exception=seh
compiler.libcxx=libstdc++11
compiler.threads=posix
compiler.version=14
os=Windows
[tool_requires]
*: mingw-builds/14.2.0

Profile build:
[settings]
arch=x86_64
build_type=Release
os=Windows


======== Computing dependency graph ========
Graph root
    conanfile.py (poco_test/1.0.0): ...\poco-net-spike\conanfile.py
Requirements
    bzip2/1.0.8#d00dac990f08d991998d624be81a9526 - Cache
    pcre2/10.42#ac2227071f79a062167cf2fee7189d66 - Cache
    poco/1.13.3#007642154974b1f81167b7a3581749aa - Cache
    zlib/1.3.1#b8bc2603263cf7eccbd6e17e66b0ed76 - Cache
Build requirements
    7zip/19.00#6c39c38a52d3e8271deb7195ccc74fe8 - Cache
    lzma_sdk/9.20#f1fe20056422603432563a07b25f2ee3 - Cache
    make/4.3#f3747ef6e47bbd049f9f3f14a9e1d8ba - Cache
    mingw-builds/14.2.0#f00016fe3250cd0d1a30a2a9118c4401 - Cache
    msys2/cci.latest#4927aa5502eb174e95df524f2be2685e - Cache
Resolved version ranges
    zlib/[>=1.2.11 <2]: zlib/1.3.1

======== Computing necessary packages ========
Requirements
    bzip2/1.0.8#d00dac990f08d991998d624be81a9526:85c71668b9185032f54e3c0a7e70012cca6a3f24#9248e2570cba6bbb8cd03fce5dd785f7 - Cache
    pcre2/10.42#ac2227071f79a062167cf2fee7189d66:27ee08f994ee96e858b38d589319ee5645015947#8bedf860ec3efbaaf6eb26ab490be66a - Cache
    poco/1.13.3#007642154974b1f81167b7a3581749aa:a9b8e96aed0d8b660c2fd31ac55ac6114343c37f#dd8899ed42433cb79095835d70dd8e07 - Cache
    zlib/1.3.1#b8bc2603263cf7eccbd6e17e66b0ed76:71031f76291774d591abe17801ef4bbae8fff7c3#66739d60babdf7e426bc45c8243481d2 - Cache
Build requirements
    mingw-builds/14.2.0#f00016fe3250cd0d1a30a2a9118c4401:f82b765f5ccc390bb8d409c50689a5c5ab3eb642#08e79cf8cbbfbb72a8a4fd105c76021a - Cache
Skipped binaries
    7zip/19.00, lzma_sdk/9.20, make/4.3, msys2/cci.latest

======== Installing packages ========
mingw-builds/14.2.0: Already installed! (1 of 5)
bzip2/1.0.8: Already installed! (2 of 5)
zlib/1.3.1: Already installed! (3 of 5)
pcre2/10.42: Already installed! (4 of 5)
pcre2/10.42: Appending PATH environment variable: ...\.conan2\p\b\pcre2e487300fd90a4\p\bin
poco/1.13.3: Already installed! (5 of 5)
WARN: deprecated: Usage of deprecated Conan 1.X features that will be removed in Conan 2.X:
WARN: deprecated:     'env_info' used in: pcre2/10.42, mingw-builds/14.2.0, bzip2/1.0.8
WARN: deprecated:     'cpp_info.names' used in: pcre2/10.42, zlib/1.3.1, poco/1.13.3, bzip2/1.0.8
WARN: deprecated:     'cpp_info.build_modules' used in: bzip2/1.0.8
WARN: deprecated:     'cpp_info.filenames' used in: poco/1.13.3

======== Finalizing install (deploy, generators) ========
conanfile.py (poco_test/1.0.0): Calling generate()
conanfile.py (poco_test/1.0.0): Generators folder: ...\poco-net-spike\build\Release\generators
conanfile.py (poco_test/1.0.0): CMakeToolchain generated: conan_toolchain.cmake
conanfile.py (poco_test/1.0.0): CMakeToolchain: Preset 'conan-release' added to CMakePresets.json.
    (cmake>=3.23) cmake --preset conan-release
    (cmake<3.23) cmake <path> -G "MinGW Makefiles" -DCMAKE_TOOLCHAIN_FILE=generators\conan_toolchain.cmake  -DCMAKE_SH=CMAKE_SH-NOTFOUND -DCMAKE_POLICY_DEFAULT_CMP0091=NEW -DCMAKE_BUILD_TYPE=Release
conanfile.py (poco_test/1.0.0): CMakeToolchain generated: ...\poco-net-spike\build\Release\generators\CMakePresets.json
conanfile.py (poco_test/1.0.0): CMakeToolchain generated: ...\poco-net-spike\CMakeUserPresets.json
conanfile.py (poco_test/1.0.0): CMakeDeps necessary find_package() and targets for your CMakeLists.txt
    find_package(Poco)
    target_link_libraries(... Poco::Poco)
conanfile.py (poco_test/1.0.0): Generating aggregated env files
conanfile.py (poco_test/1.0.0): Generated aggregated env files: ['conanbuild.bat', 'conanrun.bat']

======== Calling build() ========
conanfile.py (poco_test/1.0.0): Calling build()
conanfile.py (poco_test/1.0.0): Running CMake.configure()
conanfile.py (poco_test/1.0.0): RUN: cmake -G "MinGW Makefiles" -DCMAKE_TOOLCHAIN_FILE="generators/conan_toolchain.cmake" -DCMAKE_INSTALL_PREFIX=".../poco-net-spike" -DCMAKE_SH="CMAKE_SH-NOTFOUND" -DCMAKE_POLICY_DEFAULT_CMP0091="NEW" -DCMAKE_BUILD_TYPE="Release" ".../poco-net-spike"
-- Using Conan toolchain: .../poco-net-spike/build/Release/generators/conan_toolchain.cmake
-- Conan toolchain: Defining architecture flag: -m64
-- Conan: Component target declared 'Poco::Foundation'
-- Conan: Component target declared 'Poco::Net'
-- Conan: Target declared 'Poco::Poco'
-- Conan: Component target declared 'PCRE2::8BIT'
-- Conan: Component target declared 'PCRE2::16BIT'
-- Conan: Component target declared 'PCRE2::32BIT'
-- Conan: Component target declared 'PCRE2::POSIX'
-- Conan: Target declared 'pcre2::pcre2'
-- Conan: Target declared 'BZip2::BZip2'
-- Conan: Including build module from '.../.conan2/p/b/bzip2dfc909f9e9aba/p/lib/cmake/conan-official-bzip2-variables.cmake'
-- Conan: Target declared 'ZLIB::ZLIB'
-- Configuring done
-- Generating done
CMake Warning:
  Manually-specified variables were not used by the project:

    CMAKE_TOOLCHAIN_FILE


-- Build files have been written to: .../poco-net-spike/build/Release

conanfile.py (poco_test/1.0.0): Running CMake.build()
conanfile.py (poco_test/1.0.0): RUN: cmake --build "...\poco-net-spike\build\Release" -- -j16
mingw32-make[1]: Entering directory '.../poco-net-spike/build/Release'
mingw32-make[2]: Entering directory '.../poco-net-spike/build/Release'
mingw32-make[2]: Leaving directory '.../poco-net-spike/build/Release'
mingw32-make[2]: Entering directory '.../poco-net-spike/build/Release'
[ 50%] Linking CXX executable test_package.exe
.../.conan2/p/mingwe8c4b6043d588/p/bin/../lib/gcc/x86_64-w64-mingw32/14.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: .../.conan2/p/b/pocoff9944acdaca3/p/lib/libPocoNet.a(SocketImpl.cpp.obj):SocketImpl.cpp:(.text+0x6c9a): undefined reference to `TransmitFile'
collect2.exe: error: ld returned 1 exit status
mingw32-make[2]: *** [CMakeFiles\test_package.dir\build.make:94: test_package.exe] Error 1
mingw32-make[2]: Leaving directory '.../poco-net-spike/build/Release'
mingw32-make[1]: *** [CMakeFiles\Makefile2:75: CMakeFiles/test_package.dir/all] Error 2
mingw32-make[1]: Leaving directory '.../poco-net-spike/build/Release'
mingw32-make: *** [Makefile:83: all] Error 2

ERROR: conanfile.py (poco_test/1.0.0): Error in build() method, line 50
        cmake.build()
        ConanException: Error 2 while executing

@lbakman lbakman added the bug Something isn't working label Jan 17, 2025
@uilianries
Copy link
Member

@lbakman Hello!

Thank you for reporting your case! Your description is very clear, and you also included a repository to reproduce your steps, which is really helpful! Thank you for all those details!

I just cloned your repository and I'm capable of reproducing your case too.

You are right about Poco adding mswsock in version 13.0. It comes from the PR https://github.com/pocoproject/poco/pull/4343/files and is all fine.

I can provide a pull request, but I would like to know if this is the correct approach.

Your PR will be welcome! We only need to check the result by posting a full build log in the PR too, as we do not run MinGW or Cygwin in the CI, so we can not prove it directly.

Your approach is looking fine, it follow the common pattern used in CCI. In case needing to adjust something, we still can review in the PR.

Not sure about the long if statement or if it is better to split it.

Do not worry, the single-line condition is looking fine, and is readable.

Cheers!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
2 participants