Welcome to Doom9's Forum, THE in-place to be for everyone interested in DVD conversion. Before you start posting please read the forum rules. By posting to this forum you agree to abide by the rules. |
|
|
Thread Tools | Search this Thread | Display Modes |
|
23rd December 2018, 16:01 | #1 | Link |
Registered User
Join Date: Nov 2005
Posts: 693
|
"error: 'mutex' in namespace 'std' does not name a type" despite up-to-date toolchain
I'm using 'mingw-w64-build-r25' from https://files.1f0.de/mingw/scripts/ (does anyone know who actually maintains these updated scripts? Hendrik / nevairiel?) to create my own toolchain with GCC 8.2, MinGW-w64 6.0.0 and pthreads 2.9.1.
Today I tried to compile libdmusic, but I got the following error: Code:
[ 11%] Building CXX object CMakeFiles/dmusic.dir/src/DlsPlayer.cpp.obj In file included from /[...]/libdmusic_git/include/dmusic/DlsPlayer.h:8, from /[...]/libdmusic_git/src/DlsPlayer.cpp:1: /[...]/libdmusic_git/include/dmusic/PlayingContext.h:74:14: error: 'mutex' in namespace 'std' does not name a type std::mutex m_queueMutex; ^~~~~ I'm using the latest GCC, but export CXXFLAGS="-std=gnu++11" didn't make any difference. I still get the error. Now I wonder, is this guy right, despite having the latest GCC? Or is there a flaw in the MinGW-w64 build script that I'm getting this error?
__________________
My hobby website |
23rd December 2018, 21:21 | #2 | Link |
Software Developer
Join Date: Jun 2005
Location: Last House on Slunk Street
Posts: 13,248
|
std::mutex is indeed a C++11 feature. But I think "-std=gnu++14" is GCC's default for C++ code by now:
https://gcc.gnu.org/onlinedocs/gcc/C...ialect-Options Anyhow, whether setting CXXFLAGS or CFLAGS has any effect, that totally depends on the build system (e.g. Makefile) that is used to build the application! For example, you may need to specify those when running the ./configure script, so that they will actually be applied to the generated Makefile. Also, make sure that your MinGW was built with "posix" threading (libwinpthread). If built with "win32" threading, C++11 threading features are not available! More info on that topic here: * https://stackoverflow.com/a/30390278 * https://wiki.qt.io/MinGW-64-bit#GCC_...ix_vs_win32.29
__________________
Go to https://standforukraine.com/ to find legitimate Ukrainian Charities 🇺🇦✊ Last edited by LoRd_MuldeR; 23rd December 2018 at 21:47. |
25th December 2018, 12:06 | #3 | Link | ||
Registered User
Join Date: Nov 2005
Posts: 693
|
Quote:
Code:
//Flags used by the CXX compiler during all build types. CMAKE_CXX_FLAGS:STRING=-std=gnu++14 Quote:
Code:
$ ./mingw-w64-build-r25 --help [...] Compile Options: [...] --threads=LIB compile with support for thread LIB (winpthreads, pthreads-w32, disable) [pthreads-w32] Despite all the effort however I'm still getting the mutex error. I really don't understand why.
__________________
My hobby website |
||
25th December 2018, 13:02 | #4 | Link | |
Software Developer
Join Date: Jun 2005
Location: Last House on Slunk Street
Posts: 13,248
|
Try "g++ -v" and check the output. Should be something like this:
Quote:
https://pastebin.com/aQ25Gcp0 (BTW: Why not simply grab MinGW/GCC via MSYS2? This is what I'm using now exclusively)
__________________
Go to https://standforukraine.com/ to find legitimate Ukrainian Charities 🇺🇦✊ Last edited by LoRd_MuldeR; 25th December 2018 at 14:01. |
|
26th December 2018, 15:39 | #5 | Link | |
Registered User
Join Date: Nov 2005
Posts: 693
|
Code:
$ ./i686-w64-mingw32-g++.exe -v Using built-in specs. COLLECT_GCC=./i686-w64-mingw32-g++ COLLECT_LTO_WRAPPER=/[...]/cross_compilers/mingw-w64-i686/libexec/gcc/i686-w64-mingw32/8.2.0/lto-wrapper.exe Target: i686-w64-mingw32 Configured with: ../source/gcc-8.2.0/configure --build=i686-pc-cygwin --target=i686-w64-mingw32 --disable-shared --enable-static --disable-nls --disable-multilib --prefix=/[...]/cross_compilers/mingw-w64-i686 --with-sysroot=/[...]/cross_compilers/mingw-w64-i686 --with-mpc=/[...]/cross_compilers/pkgs/mpc/mpc-1.1.0-i686 --with-mpfr=/[...]/cross_compilers/pkgs/mpfr/mpfr-4.0.1-i686 --with-gmp=/[...]/cross_compilers/pkgs/gmp/gmp-6.1.2-i686 --with-isl=/[...]/cross_compilers/pkgs/isl/isl-0.20-i686 --enable-languages=c,c++ --enable-fully-dynamic-string --enable-lto Thread model: win32 gcc version 8.2.0 (GCC) Code:
diff --git a/patches/mingw-w64-build-r25 b/patches/mingw-w64-build-r25 index d43cbd5..007ce53 100755 --- a/patches/mingw-w64-build-r25 +++ b/patches/mingw-w64-build-r25 @@ -317,7 +317,7 @@ fi case "$gcc_ver" in $gcc_old_release_ver ) CC=$gcc "../source/gcc-$gcc_ver/configure" --build="$system_type" --target="$mingw_w64_target" "${static_build[@]}" "${disable_nls[@]}" --disable-multilib --prefix="$mingw_w64_prefix" --with-sysroot="$mingw_w64_prefix" --with-mpc="$mpc_prefix" --with-mpfr="$mpfr_prefix" --with-gmp="$gmp_prefix" --with-host-libstdcxx="-lstdc++" --with-cloog="$cloog_prefix" --with-isl="$isl_prefix" --enable-languages="$enabled_langs" --enable-fully-dynamic-string --enable-lto > >(build_log) 2>&1 ;; - $gcc_release_ver ) CC=$gcc "../source/gcc-$gcc_ver/configure" --build="$system_type" --target="$mingw_w64_target" $gcc_host "${static_build[@]}" "${disable_nls[@]}" --disable-multilib --prefix="$mingw_w64_prefix" --with-sysroot="$mingw_w64_prefix" --with-mpc="$mpc_prefix" --with-mpfr="$mpfr_prefix" --with-gmp="$gmp_prefix" --with-isl="$isl_prefix" --enable-languages="$enabled_langs" --enable-fully-dynamic-string --enable-lto > >(build_log) 2>&1 || print_error ;; + $gcc_release_ver ) CC=$gcc "../source/gcc-$gcc_ver/configure" --build="$system_type" --target="$mingw_w64_target" $gcc_host "${static_build[@]}" "${disable_nls[@]}" --disable-multilib --prefix="$mingw_w64_prefix" --with-sysroot="$mingw_w64_prefix" --with-mpc="$mpc_prefix" --with-mpfr="$mpfr_prefix" --with-gmp="$gmp_prefix" --with-isl="$isl_prefix" --enable-languages="$enabled_langs" --enable-fully-dynamic-string --enable-lto --enable-threads=posix > >(build_log) 2>&1 || print_error ;; esac } Code:
/[...]/cross_compilers/pkgs/gcc/build/./gcc/xgcc -B/[...]/cross_compilers/pkgs/gcc/build/./gcc/ -L/[...]/cross_compilers/mingw-w64-i686/i686-w64-mingw32/lib -L/[...]/cross_compilers/mingw-w64-i686/mingw/lib -isystem /[...]/cross_compilers/mingw-w64-i686/i686-w64-mingw32/include -isystem /[...]/cross_compilers/mingw-w64-i686/mingw/include -B/[...]/cross_compilers/mingw-w64-i686/i686-w64-mingw32/bin/ -B/[...]/cross_compilers/mingw-w64-i686/i686-w64-mingw32/lib/ -isystem /[...]/cross_compilers/mingw-w64-i686/i686-w64-mingw32/include -isystem /[...]/cross_compilers/mingw-w64-i686/i686-w64-mingw32/sys-include -g -O2 -O2 -I../../../source/gcc-8.2.0/libgcc/../winsup/w32api/include -g -O2 -DIN_GCC -DCROSS_DIRECTORY_STRUCTURE -W -Wall -Wno-narrowing -Wwrite-strings -Wcast-qual -Wstrict-prototypes -Wmissing-prototypes -Wold-style-definition -isystem ./include -g -DIN_LIBGCC2 -fbuilding-libgcc -fno-stack-protector -I. -I. -I../.././gcc -I../../../source/gcc-8.2.0/libgcc -I../../../source/gcc-8.2.0/libgcc/. -I../../../source/gcc-8.2.0/libgcc/../gcc -I../../../source/gcc-8.2.0/libgcc/../include -I../../../source/gcc-8.2.0/libgcc/config/libbid -DENABLE_DECIMAL_BID_FORMAT -DHAVE_CC_TLS -DUSE_EMUTLS -o unwind-dw2.o -MT unwind-dw2.o -MD -MP -MF unwind-dw2.dep -fexceptions -c ../../../source/gcc-8.2.0/libgcc/unwind-dw2.c In file included from ../../../source/gcc-8.2.0/libgcc/gthr.h:148, from ../../../source/gcc-8.2.0/libgcc/unwind-dw2.c:37: ./gthr-default.h:35:10: fatal error: pthread.h: No such file or directory #include <pthread.h> ^~~~~~~~~~~ compilation terminated. make[1]: *** [../../../source/gcc-8.2.0/libgcc/static-object.mk:17: unwind-dw2.o] Error 1 make[1]: Leaving directory '/[...]/cross_compilers/pkgs/gcc/build/i686-w64-mingw32/libgcc' make: *** [Makefile:12735: all-target-libgcc] Error 2 Quote:
I might give it a try some day.
__________________
My hobby website |
|
31st December 2018, 13:51 | #6 | Link | |
Software Developer
Join Date: Jun 2005
Location: Last House on Slunk Street
Posts: 13,248
|
Quote:
Finally, run "pacman -S mingw-w64-i686-toolchain" or "pacman -S mingw-w64-x86_64-toolchain" to install MinGW/GCC targeting 32-Bit or 64-Bit, respectively. That's it
__________________
Go to https://standforukraine.com/ to find legitimate Ukrainian Charities 🇺🇦✊ Last edited by LoRd_MuldeR; 31st December 2018 at 13:54. |
|
8th November 2019, 08:26 | #7 | Link | |
SuperVirus
Join Date: Jun 2012
Location: Antarctic Japan
Posts: 1,351
|
Quote:
Downloading the entire "toolchain" means installing normally-unnecessary stuff... Most people need only the C and C++ compilers and really have no use for Ada, Fortran and etc. So I recommend these command-lines: 1) pacman -S mingw-w64-i686-binutils mingw-w64-i686-crt-git mingw-w64-i686-gcc mingw-w64-i686-gcc-libs mingw-w64-i686-headers-git mingw-w64-i686-libwinpthread-git mingw-w64-i686-tools-git mingw-w64-i686-winpthreads-git 2) pacman -S mingw-w64-x86_64-binutils mingw-w64-x86_64-crt-git mingw-w64-x86_64-gcc mingw-w64-x86_64-gcc-libs mingw-w64-x86_64-headers-git mingw-w64-x86_64-libwinpthread-git mingw-w64-x86_64-tools-git mingw-w64-x86_64-winpthreads-git And only if you absolutely need them: mingw-w64-i686-winstorecompat-git && mingw-w64-x86_64-winstorecompat-git, respectively. Last edited by filler56789; 11th December 2019 at 06:32. Reason: update |
|
25th December 2018, 19:59 | #8 | Link |
Registered Developer
Join Date: Mar 2010
Location: Hamburg/Germany
Posts: 10,346
|
Its a shame that they don't want to implement the stuff with native threading. winpthreads is kinda crappy.
Especially since someone already did all the work and made a header file with std::thread support for win32 threading model as well. https://github.com/meganz/mingw-std-threads
__________________
LAV Filters - open source ffmpeg based media splitter and decoders Last edited by nevcairiel; 25th December 2018 at 20:02. |
Thread Tools | Search this Thread |
Display Modes | |
|
|