Menu

#107 No option to disable pthread?

v1.0 (example)
closed-works-for-me
nobody
pthread (1)
5
2015-11-23
2015-11-23
Eric To
No

I'm trying to compile under Linux for Windows 64.
But eventhought i did not use the -lpthread flag, x86_64-w64-mingw32-g++ still adds it.

Looking at the man page, I don't see any option to disable pthread either.

Is there a way to force disable pthread?

Discussion

  • Kai Tietz

    Kai Tietz - 2015-11-23

    pthread dependency is introduced by toolchain-builder, not by miingw-w64 itself. You can build toolchain with classical win32-threading model, but you might run into issues about missing features of c++11 and other threading-libraries (like libgomp).

     
  • Kai Tietz

    Kai Tietz - 2015-11-23
    • status: open --> closed-works-for-me
     
  • Kai Tietz

    Kai Tietz - 2015-11-23

    As it isn't something related to mingw-w64 itself, and is just related to provider of the pre-compiled toolchain (its a matter of their configure-options), I close this bug as works for me.

     
    • Eric To

      Eric To - 2015-11-23

      Can you take a look at my reply?

       
  • Eric To

    Eric To - 2015-11-23

    OS: CentOS 7
    Target OS: Windows 64bit
    Packages installed:
    mingw64-crt-4.0.4-1.el7.noarch
    mingw64-gcc-c++-4.9.1-3.el7.x86_64
    mingw64-pkg-config-0.28-2.el7.x86_64
    mingw64-boost-static-1.54.0-1.el7.noarch
    mingw64-headers-4.0.4-3.el7.noarch
    mingw64-zlib-1.2.8-2.el7.noarch
    mingw64-filesystem-100-1.el7.noarch
    mingw64-cpp-4.9.1-3.el7.x86_64
    mingw64-gcc-4.9.1-3.el7.x86_64
    mingw64-bzip2-1.0.6-3.el7.noarch
    mingw64-binutils-2.25-1.el7.x86_64
    mingw64-boost-1.54.0-1.el7.noarch
    mingw64-zlib-static-1.2.8-2.el7.noarch
    mingw64-winpthreads-4.0.4-1.el7.noarch

    Command to execute:
    x86_64-w64-mingw32-gcc -O3 -Wall -D_LARGEFILE64_SOURCE=1 -o example.exe example.o -L. libz.a

    Running it under verbose, we can see that lpthread if always included:
    Using built-in specs.
    COLLECT_GCC=x86_64-w64-mingw32-gcc
    COLLECT_LTO_WRAPPER=/usr/libexec/gcc/x86_64-w64-mingw32/4.9.1/lto-wrapper
    Target: x86_64-w64-mingw32
    Configured with: ../configure --prefix=/usr --bindir=/usr/bin --includedir=/usr/include --mandir=/usr/share/man --infodir=/usr/share/info --datadir=/usr/share --build=x86_64-redhat-linux-gnu --host=x86_64-redhat-linux-gnu --with-gnu-as --with-gnu-ld --verbose --without-newlib --disable-multilib --disable-plugin --with-system-zlib --disable-nls --without-included-gettext --disable-win32-registry --enable-languages=c,c++,objc,obj-c++,fortran --with-bugurl=http://bugzilla.redhat.com/bugzilla --enable-threads=posix --enable-libgomp --target=x86_64-w64-mingw32 --with-sysroot=/usr/x86_64-w64-mingw32/sys-root --with-gxx-include-dir=/usr/x86_64-w64-mingw32/sys-root/mingw/include/c++
    Thread model: posix
    gcc version 4.9.1 20140716 (Fedora MinGW 4.9.1-3.el7) (GCC)
    COMPILER_PATH=/usr/libexec/gcc/x86_64-w64-mingw32/4.9.1/:/usr/libexec/gcc/x86_64-w64-mingw32/4.9.1/:/usr/libexec/gcc/x86_64-w64-mingw32/:/usr/lib/gcc/x86_64-w64-mingw32/4.9.1/:/usr/lib/gcc/x86_64-w64-mingw32/:/usr/lib/gcc/x86_64-w64-mingw32/4.9.1/../../../../x86_64-w64-mingw32/bin/
    LIBRARY_PATH=/usr/lib/gcc/x86_64-w64-mingw32/4.9.1/:/usr/lib/gcc/x86_64-w64-mingw32/4.9.1/../../../../x86_64-w64-mingw32/lib/../lib/:/usr/x86_64-w64-mingw32/sys-root/mingw/lib/../lib/:/usr/lib/gcc/x86_64-w64-mingw32/4.9.1/../../../../x86_64-w64-mingw32/lib/:/usr/x86_64-w64-mingw32/sys-root/mingw/lib/
    COLLECT_GCC_OPTIONS='-O3' '-Wall' '-D' '_LARGEFILE64_SOURCE=1' '-o' 'example.exe' '-L.' '-v' '-mtune=generic' '-march=x86-64'
    /usr/libexec/gcc/x86_64-w64-mingw32/4.9.1/collect2 -plugin /usr/libexec/gcc/x86_64-w64-mingw32/4.9.1/liblto_plugin.so -plugin-opt=/usr/libexec/gcc/x86_64-w64-mingw32/4.9.1/lto-wrapper -plugin-opt=-fresolution=/tmp/ccmjRYBC.res -plugin-opt=-pass-through=-lmingw32 -plugin-opt=-pass-through=-lgcc -plugin-opt=-pass-through=-lgcc_eh -plugin-opt=-pass-through=-lmoldname -plugin-opt=-pass-through=-lmingwex -plugin-opt=-pass-through=-lmsvcrt -plugin-opt=-pass-through=-lpthread -plugin-opt=-pass-through=-ladvapi32 -plugin-opt=-pass-through=-lshell32 -plugin-opt=-pass-through=-luser32 -plugin-opt=-pass-through=-lkernel32 -plugin-opt=-pass-through=-lmingw32 -plugin-opt=-pass-through=-lgcc -plugin-opt=-pass-through=-lgcc_eh -plugin-opt=-pass-through=-lmoldname -plugin-opt=-pass-through=-lmingwex -plugin-opt=-pass-through=-lmsvcrt --sysroot=/usr/x86_64-w64-mingw32/sys-root -m i386pep -Bdynamic -o example.exe /usr/x86_64-w64-mingw32/sys-root/mingw/lib/../lib/crt2.o /usr/x86_64-w64-mingw32/sys-root/mingw/lib/../lib/crtbegin.o -L. -L/usr/lib/gcc/x86_64-w64-mingw32/4.9.1 -L/usr/lib/gcc/x86_64-w64-mingw32/4.9.1/../../../../x86_64-w64-mingw32/lib/../lib -L/usr/x86_64-w64-mingw32/sys-root/mingw/lib/../lib -L/usr/lib/gcc/x86_64-w64-mingw32/4.9.1/../../../../x86_64-w64-mingw32/lib -L/usr/x86_64-w64-mingw32/sys-root/mingw/lib example.o libz.a -lmingw32 -lgcc -lgcc_eh -lmoldname -lmingwex -lmsvcrt -lpthread -ladvapi32 -lshell32 -luser32 -lkernel32 -lmingw32 -lgcc -lgcc_eh -lmoldname -lmingwex -lmsvcrt /usr/x86_64-w64-mingw32/sys-root/mingw/lib/../lib/crtend.o
    /usr/lib/gcc/x86_64-w64-mingw32/4.9.1/../../../../x86_64-w64-mingw32/bin/ld: cannot find -lpthread

     
  • Kai Tietz

    Kai Tietz - 2015-11-23

    CentOS is using here the option '--enable-threads=posix', which is the reason for the pthread-dependency.

     

Log in to post a comment.