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] boost/[>=1.69]: shared build fails with MinGW (Windows) #5816

Closed
Chnossos opened this issue Jun 8, 2021 · 3 comments
Closed

[package] boost/[>=1.69]: shared build fails with MinGW (Windows) #5816

Chnossos opened this issue Jun 8, 2021 · 3 comments
Labels
bug Something isn't working

Comments

@Chnossos
Copy link
Contributor

Chnossos commented Jun 8, 2021

Package and Environment Details

  • Package Name/Version: boost (tested with 1.69 and higher)
  • Operating System+version: Windows 10 (21H1)
  • Compiler+version: MinGW 8.1.0 (provided by Qt) - GCC 8
  • Conan version: conan 1.36.0
  • Python version: Python 3.8

Conan profile

[settings]
os=Windows
os_build=Windows
arch=x86_64
arch_build=x86_64
compiler=gcc
compiler.version=8
compiler.libcxx=libstdc++11
compiler.threads=posix
compiler.exception=seh
build_type=Release
[options]
[build_requires]
[env]

Steps to reproduce

conanfile.txt

[requires]
boost/1.69.0

[options]
boost:shared=True
boost:without_atomic=True
boost:without_chrono=True
boost:without_container=True
boost:without_context=True
boost:without_contract=True
boost:without_coroutine=True
boost:without_date_time=True
boost:without_exception=True
boost:without_fiber=True
boost:without_filesystem=False
boost:without_graph=True
boost:without_graph_parallel=True
boost:without_iostreams=True
boost:without_locale=True
boost:without_log=True
boost:without_math=True
boost:without_mpi=True
boost:without_program_options=True
boost:without_python=True
boost:without_random=True
boost:without_regex=True
boost:without_serialization=True
boost:without_stacktrace=True
boost:without_system=False
boost:without_test=True
boost:without_thread=True
boost:without_timer=True
boost:without_type_erasure=True
boost:without_wave=True

Logs

boost/1.69.0: WARN: Boost component 'filesystem' is missing libraries. Try building boost with '-o boost:without_filesystem'. (Option is not guaranteed to exist)
boost/1.69.0: WARN: Boost component 'system' is missing libraries. Try building boost with '-o boost:without_system'. (Option is not guaranteed to exist)
ERROR: boost/1.69.0: Error in package_info() method, line 1492
        raise Conan Exception("These libraries were build, but were not used in any boost module: {}".format(non_used))
        ConanException: These libraries were built, but were not used in any boost module: {'boost_system.dll', 'boost_filesystem.dll'}

The thing is MinGW when building shared libs outputs two files: xxx.dll (placed in package/{id}/bin) and xxx.dll.a (placed in package/{id}/lib), then tools.collect_libs(self) reports what it finds in the lib folder (without lib prefix and .a suffix): {'boost_system.dll', 'boost_filesystem.dll'} instead of reporting {'boost_system', 'boost_filesystem'} and the packaging fails while everything was alright.

boost conanfile.py:

all_detected_libraries = set(tools.collect_libs(self))
# prints {'boost_system.dll', 'boost_filesystem.dll'} if shared=True
    ...
module_libraries = filter_transform_module_libraries(self._dependencies["libs"][module])
# prints {'boost_system', 'boost_filesystem'}
all_expected_libraries = all_expected_libraries.union(module_libraries)
if set(module_libraries).difference(all_detected_libraries): # here is the problem
    incomplete_components.append(module)
@Chnossos Chnossos added the bug Something isn't working label Jun 8, 2021
@madebr
Copy link
Contributor

madebr commented Jun 8, 2021

We can't use str.removesuffix as that required CPython 3.9.
Does replacing

all_detected_libraries = set(tools.collect_libs(self))

with

def clean_libname(lib):
    if lib.endswith(".dll"):
        return lib[:-4]
    return lib
all_detected_libraries = set(clean_libname(l) for l in tools.collect_libs(self))

fix your problem?

@Chnossos
Copy link
Contributor Author

Chnossos commented Jun 10, 2021

Yes it does. Used:

set(l[:-4] if l.endswith(".dll") else l for l in tools.collect_libs(self))

@madebr
Copy link
Contributor

madebr commented Jun 10, 2021

Great to hear this!
If you feel up to the task, please open a pr with the fix.

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
Development

No branches or pull requests

2 participants