MINGW-packages: [boost] libboost_fiber-mt.dll missing in mingw32 package

Hello everyone,

I would like to know how can I link a very simple application with boost fibers.

I am getting linking errors that says that fiber references are missing. I confirm that doing objectdump on all *.a doesn’t show any reference to fiber’s classes.

I show below files that I’m using.

CMakeLists.txt

cmake_minimum_required (VERSION 3.13)

set(CMAKE_VS_INCLUDE_INSTALL_TO_DEFAULT_BUILD 1)

project(Fibers VERSION 0.1.0.0)

find_package(Boost 1.73.0 REQUIRED)
#include(${PROJECT_BINARY_DIR}/conanbuildinfo.cmake)
#conan_basic_setup(TARGETS)

add_executable(${PROJECT_NAME})

if (CMAKE_CXX_COMPILER_ID MATCHES "Clang|AppleClang|GNU")
    target_compile_options(${PROJECT_NAME} PRIVATE -Wall -Wextra -Wunreachable-code -Wpedantic)
endif()
if (CMAKE_CXX_COMPILER_ID MATCHES "Clang")
    target_compile_options(${PROJECT_NAME} PRIVATE -Wweak-vtables -Wexit-time-destructors -Wglobal-constructors -Wmissing-noreturn)
endif()
if (CMAKE_CXX_COMPILER_ID MATCHES "MSVC")
    foreach(flag_var CMAKE_CXX_FLAGS CMAKE_CXX_FLAGS_DEBUG
            CMAKE_CXX_FLAGS_RELEASE CMAKE_CXX_FLAGS_MINSIZEREL
            CMAKE_CXX_FLAGS_RELWITHDEBINFO)
        if(${flag_var} MATCHES "/MD")
            string(REGEX REPLACE "/MD" "/MT" ${flag_var} "${${flag_var}}")
        endif(${flag_var} MATCHES "/MD")
    endforeach(flag_var)
    target_compile_options(${PROJECT_NAME} PRIVATE /w44265 /w44061 /w44062)
endif()

set_target_properties(${PROJECT_NAME} PROPERTIES
    EXPORT_NAME ${PROJECT_NAME}
    CXX_STANDARD 14
    CXX_STANDARD_REQUIRED YES
    CXX_EXTENSIONS NO
    DEBUG_POSTFIX "d"
    INTERPROCEDURAL_OPTIMIZATION True
    )

target_include_directories(${PROJECT_NAME}
    PUBLIC
    $<INSTALL_INTERFACE:include>
    $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
    PRIVATE
    ${CMAKE_CURRENT_SOURCE_DIR}/include
)

target_sources(${PROJECT_NAME}
    PRIVATE
	include/sample.h
	src/sample.cpp
)

target_link_libraries (${PROJECT_NAME}
    PRIVATE
        ${Boost_LIBRARIES}
)

src/sample.cpp

#include <iostream>
#include <boost/fiber/all.hpp>

int main()
{
    boost::fibers::fiber f1(
    []
    {
        std::cout << "Hello world!\n";
    });

    f1.join();

    return 0;
}

Linking error

14:49:53: Running steps for project Fibers...
14:49:53: Starting: "C:\msys64\mingw32\bin\cmake.exe" --build . --target all
[ 50%] Linking CXX executable Fibersd.exe
C:/msys64/mingw32/bin/../lib/gcc/i686-w64-mingw32/10.2.0/../../../../i686-w64-mingw32/bin/ld.exe: CMakeFiles\Fibers.dir/objects.a(sample.cpp.obj):C:/Users/User/Documents/Sources/testing/fibers/src/sample.cpp:12: undefined reference to `boost::fibers::fiber::join()'
C:/msys64/mingw32/bin/../lib/gcc/i686-w64-mingw32/10.2.0/../../../../i686-w64-mingw32/bin/ld.exe: CMakeFiles\Fibers.dir/objects.a(sample.cpp.obj):C:/msys64/mingw32/include/boost/fiber/fiber.hpp:67: undefined reference to `boost::context::stack_traits::default_size()'
C:/msys64/mingw32/bin/../lib/gcc/i686-w64-mingw32/10.2.0/../../../../i686-w64-mingw32/bin/ld.exe: CMakeFiles\Fibers.dir/objects.a(sample.cpp.obj):C:/msys64/mingw32/include/boost/fiber/fiber.hpp:109: undefined reference to `boost::fibers::fiber::start_()'
C:/msys64/mingw32/bin/../lib/gcc/i686-w64-mingw32/10.2.0/../../../../i686-w64-mingw32/bin/ld.exe: CMakeFiles\Fibers.dir/objects.a(sample.cpp.obj):C:/msys64/mingw32/include/boost/fiber/context.hpp:448: undefined reference to `boost::fibers::context::~context()'
C:/msys64/mingw32/bin/../lib/gcc/i686-w64-mingw32/10.2.0/../../../../i686-w64-mingw32/bin/ld.exe: CMakeFiles\Fibers.dir/objects.a(sample.cpp.obj):C:/msys64/mingw32/include/boost/fiber/context.hpp:438: undefined reference to `boost::fibers::context::terminate()'
C:/msys64/mingw32/bin/../lib/gcc/i686-w64-mingw32/10.2.0/../../../../i686-w64-mingw32/bin/ld.exe: CMakeFiles\Fibers.dir/objects.a(sample.cpp.obj):C:/msys64/mingw32/include/boost/context/fiber_fcontext.hpp:193: undefined reference to `make_fcontext'
C:/msys64/mingw32/bin/../lib/gcc/i686-w64-mingw32/10.2.0/../../../../i686-w64-mingw32/bin/ld.exe: CMakeFiles\Fibers.dir/objects.a(sample.cpp.obj): in function `create_fiber2<boost::context::detail::fiber_record<boost::context::fiber, boost::context::basic_fixedsize_stack<boost::context::stack_traits>, std::_Bind<boost::context::fiber (boost::fibers::worker_context<main()::<lambda()> >::*(boost::fibers::worker_context<main()::<lambda()> >*, std::_Placeholder<1>))(boost::context::fiber&&)> >, boost::context::basic_fixedsize_stack<boost::context::stack_traits>, std::_Bind<boost::context::fiber (boost::fibers::worker_context<main()::<lambda()> >::*(boost::fibers::worker_context<main()::<lambda()> >*, std::_Placeholder<1>))(boost::context::fiber&&)> >':
C:/msys64/mingw32/include/boost/context/fiber_fcontext.hpp:196: undefined reference to `jump_fcontext'
C:/msys64/mingw32/bin/../lib/gcc/i686-w64-mingw32/10.2.0/../../../../i686-w64-mingw32/bin/ld.exe: CMakeFiles\Fibers.dir/objects.a(sample.cpp.obj):C:/msys64/mingw32/include/boost/context/fiber_fcontext.hpp:78: undefined reference to `jump_fcontext'
C:/msys64/mingw32/bin/../lib/gcc/i686-w64-mingw32/10.2.0/../../../../i686-w64-mingw32/bin/ld.exe: CMakeFiles\Fibers.dir/objects.a(sample.cpp.obj): in function `fiber_entry<boost::context::detail::fiber_record<boost::context::fiber, boost::context::basic_fixedsize_stack<boost::context::stack_traits>, std::_Bind<boost::context::fiber (boost::fibers::worker_context<main()::<lambda()> >::*(boost::fibers::worker_context<main()::<lambda()> >*, std::_Placeholder<1>))(boost::context::fiber&&)> > >':
C:/msys64/mingw32/include/boost/context/fiber_fcontext.hpp:89: undefined reference to `ontop_fcontext'
C:/msys64/mingw32/bin/../lib/gcc/i686-w64-mingw32/10.2.0/../../../../i686-w64-mingw32/bin/ld.exe: CMakeFiles\Fibers.dir/objects.a(sample.cpp.obj):C:/msys64/mingw32/include/boost/fiber/context.hpp:415: undefined reference to `boost::fibers::context::~context()'
C:/msys64/mingw32/bin/../lib/gcc/i686-w64-mingw32/10.2.0/../../../../i686-w64-mingw32/bin/ld.exe: CMakeFiles\Fibers.dir/objects.a(sample.cpp.obj): in function `ZN5boost7context5fiberD1Ev':
C:/msys64/mingw32/include/boost/context/fiber_fcontext.hpp:261: undefined reference to `ontop_fcontext'
C:/msys64/mingw32/bin/../lib/gcc/i686-w64-mingw32/10.2.0/../../../../i686-w64-mingw32/bin/ld.exe: CMakeFiles\Fibers.dir/objects.a(sample.cpp.obj): in function `ZNO5boost7context5fiber6resumeEv':
C:/msys64/mingw32/include/boost/context/fiber_fcontext.hpp:288: undefined reference to `jump_fcontext'
C:/msys64/mingw32/bin/../lib/gcc/i686-w64-mingw32/10.2.0/../../../../i686-w64-mingw32/bin/ld.exe: CMakeFiles\Fibers.dir/objects.a(sample.cpp.obj): in function `ZN5boost6fibers7contextC2EjNS0_4typeENS0_6launchE':
C:/msys64/mingw32/include/boost/fiber/context.hpp:200: undefined reference to `vtable for boost::fibers::context'
collect2.exe: error: ld returned 1 exit status
mingw32-make[2]: *** [CMakeFiles\Fibers.dir\build.make:106: Fibersd.exe] Error 1
mingw32-make[1]: *** [CMakeFiles\Makefile2:95: CMakeFiles/Fibers.dir/all] Error 2
mingw32-make: *** [Makefile:103: all] Error 2
14:49:54: The process "C:\msys64\mingw32\bin\cmake.exe" exited with code 2.
Error while building/deploying project Fibers (kit: MinGW 10 32-bit)
When executing step "CMake Build"
14:49:54: Elapsed time: 00:01.

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Comments: 24 (22 by maintainers)

Commits related to this issue

Most upvoted comments

@Facon so looks like there is no easy fix. I’d advise you to work with the 64bit toolchain instead if possible.

This command compiles your code: g++ test.cpp -lboost_fiber-mt -lboost_context-mt