msys2 / MINGW-packages

Package scripts for MinGW-w64 targets to build under MSYS2.
https://packages.msys2.org
BSD 3-Clause "New" or "Revised" License
2.29k stars 1.22k forks source link

'sched_yield' was not declared in this scope #4774

Closed igagis closed 4 years ago

igagis commented 5 years ago

trying to build my library using mingw-w64 gives the following error:

In file included from C:/msys64/mingw64/include/c++/8.2.0/x86_64-w64-mingw32/bits/gthr.h:148,
                 from C:/msys64/mingw64/include/c++/8.2.0/ext/atomicity.h:35,
                 from C:/msys64/mingw64/include/c++/8.2.0/bits/basic_string.h:39,
                 from C:/msys64/mingw64/include/c++/8.2.0/string:52,
                 from src/papki/File.hpp:8,
                 from src/papki/BufferFile.hpp:9,
                 from src/papki/BufferFile.cpp:1:
C:/msys64/mingw64/include/c++/8.2.0/x86_64-w64-mingw32/bits/gthr-default.h: In function 'int __gthread_yield()':
C:/msys64/mingw64/include/c++/8.2.0/x86_64-w64-mingw32/bits/gthr-default.h:692:10: error: 'sched_yield' was not declared in this scope
   return __gthrw_(sched_yield) ();
          ^~~~~~~~

I'm building it in Appveyor and on my local machine, same error in both places. The appveyor build can be found here: https://ci.appveyor.com/project/igagis/papki/builds/21017322

It looks like there is some problem with threading support. I could find some discussions about similar error on the internet, there they say that sched.h file was not included at some point, but it seems like it should happen somewhere in std lib...

stahta01 commented 5 years ago

The four places that included sched.h was guarded by HAVE_SCHED_H. I think it has not been defined. Tim S.

igagis commented 5 years ago

By the way, I tried to explicitly define it with -DHAVE_SCHED_H key to the compiler, but it still gives this error. So it is either undef'ed somewhere or the problem is something else than sched.h. The error is due to the use of std::string which is quite common... I wonder why isn't it there in all other projects using std::string.... or is it just nobody reports the problem...?

stahta01 commented 5 years ago

Do you have a threading package installed? I have winpthreads-git installed as part of the GCC toolchain.

Tim S.

igagis commented 5 years ago

I have mingw-w64-x86_64-winpthreads-git installed

Alexpux commented 5 years ago

@igagis are you using GCC package provided by us or you build your own? Maybe you use GCC builded with win32 threads instead of posix

igagis commented 5 years ago

I have installed mingw-w64-x86_64-toolchain package from your repository. I want to build my library for native windows, i.e. I'm using mingw64, I don't want to link against pthreads. I use makepkg-mingw and I suppose it should use mingw64 toolchain where there should be no posix threads. Or do I misunderstand something?

Alexpux commented 5 years ago

@igagis we provide 64 bit toolchains that are builded with posix threads, so it always link with pthreads. You probably need toolchain builded with win32 threads

igagis commented 5 years ago

It's OK if tools are built with pthreads, but the library which I build with those tools should not use pthreads... Do I still need some custom built toolchain for that? What is the difference between mingw toolchain and msys toolchain then?

mati865 commented 5 years ago

Both Mingw toolchains are native, the difference comes to threading. Win32 threads don't support all C/C++ features and POSIX threads are in good shape. Msys toolchains are Cygwin like (not native).

You can download Win32 toolchains from mingw-builds which are hosted on the mingw-w64 sourceforge page. Then you will have to unpack them somewhere and add to the PATH. Keep in mind you cannot use great part of the libraries from this repository because they will fail either on build or on runtime.

igagis commented 5 years ago

Ok, so the toolchain I use probably uses POSIX threads, but still compilation fails for some reason... As I understand, it should not fail even though it uses POSIX threads...

igagis commented 5 years ago

And I can confirm that building in MSYS environment succeeds, but I need MINGW...

mati865 commented 5 years ago

@igagis what is your output of gcc -v?

igagis commented 5 years ago

Mingw shell:

$ gcc -v
Using built-in specs.
COLLECT_GCC=C:\msys64\mingw64\bin\gcc.exe
COLLECT_LTO_WRAPPER=C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.2.1/lto-wrapper.exe
Target: x86_64-w64-mingw32
Configured with: ../gcc-8-20181207/configure --prefix=/mingw64 --with-local-prefix=/mingw64/local --build=x86_64-w64-mingw32 --host=x86_64-w64-mingw32 --target=x86_64-w64-mingw32 --with-native-system-header-dir=/mingw64/x86_64-w64-mingw32/include --libexecdir=/mingw64/lib --enable-bootstrap --with-arch=x86-64 --with-tune=generic --enable-languages=ada,c,lto,c++,objc,obj-c++,fortran --enable-shared --enable-static --enable-libatomic --enable-threads=posix --enable-graphite --enable-fully-dynamic-string --enable-libstdcxx-filesystem-ts=yes --enable-libstdcxx-time=yes --disable-libstdcxx-pch --disable-libstdcxx-debug --disable-isl-version-check --enable-lto --enable-libgomp --disable-multilib --enable-checking=release --disable-rpath --disable-win32-registry --disable-nls --disable-werror --disable-symvers --with-libiconv --with-system-zlib --with-gmp=/mingw64 --with-mpfr=/mingw64 --with-mpc=/mingw64 --with-isl=/mingw64 --with-pkgversion='Rev1, Built by MSYS2 project' --with-bugurl=https://sourceforge.net/projects/msys2 --with-gnu-as --with-gnu-ld
Thread model: posix
gcc version 8.2.1 20181207 (Rev1, Built by MSYS2 project)

Msys shell:

$ gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-pc-msys/7.4.0/lto-wrapper.exe
Target: x86_64-pc-msys
Configured with: /msys_scripts/gcc/src/gcc-7.4.0/configure --build=x86_64-pc-msys --prefix=/usr --libexecdir=/usr/lib --enable-bootstrap --enable-shared --enable-shared-libgcc --enable-static --enable-version-specific-runtime-libs --with-arch=x86-64 --with-tune=generic --disable-multilib --enable-__cxa_atexit --with-dwarf2 --enable-languages=c,c++,fortran,lto --enable-graphite --enable-threads=posix --enable-libatomic --enable-libcilkrts --enable-libgomp --enable-libitm --enable-libquadmath --enable-libquadmath-support --disable-libssp --disable-win32-registry --disable-symvers --with-gnu-ld --with-gnu-as --disable-isl-version-check --enable-checking=release --without-libiconv-prefix --without-libintl-prefix --with-system-zlib --enable-linker-build-id --with-default-libstdcxx-abi=gcc4-compatible
Thread model: posix
gcc version 7.4.0 (GCC)
igagis commented 5 years ago

Today, after upgrading MSYS it seems like building now succeeds. I have not tried that on Appveyor yet, as I can't upgrade MSYS there from within the script due to

warning: terminate MSYS2 without returning to shell and check for updates again
warning: for example close your terminal window instead of calling exit

thing. I asked Appveyor to upgrade MSYS in their images. But if you know how to overcome this problem would be nice to know, because asking Appveyor guys to upgrade MSYS everytime does not seem right...

mati865 commented 5 years ago

Check MSYS2 AppVeyor config: https://github.com/Alexpux/MINGW-packages/blob/master/appveyor.yml#L18

igagis commented 5 years ago

It works now. Thank for all the help!

igagis commented 4 years ago

I'm having the same issue now:

In file included from C:/msys64/mingw64/include/c++/9.2.0/x86_64-w64-mingw32/bits/gthr.h:148,
                 from C:/msys64/mingw64/include/c++/9.2.0/ext/atomicity.h:35,
                 from C:/msys64/mingw64/include/c++/9.2.0/bits/basic_string.h:39,
                 from C:/msys64/mingw64/include/c++/9.2.0/string:55,
                 from C:/msys64/mingw64/include/utki/Exc.hpp:9,
                 from C:/msys64/mingw64/include/utki/Singleton.hpp:3,
                 from src/audout/Player.hpp:4,
                 from src/audout/Player.cpp:9:
C:/msys64/mingw64/include/c++/9.2.0/x86_64-w64-mingw32/bits/gthr-default.h: In function 'int __gthread_yield()':
C:/msys64/mingw64/include/c++/9.2.0/x86_64-w64-mingw32/bits/gthr-default.h:693:10: error: 'sched_yield' was not declared in this scope
  693 |   return __gthrw_(sched_yield) ();
      |          ^~~~~~~~
compilation terminated due to -Wfatal-errors.

here is my gcc info:

$ gcc -v
Using built-in specs.
COLLECT_GCC=C:\msys64\mingw64\bin\gcc.exe
COLLECT_LTO_WRAPPER=C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/9.2.0/lto-wrapper.exe
Target: x86_64-w64-mingw32
Configured with: ../gcc-9.2.0/configure --prefix=/mingw64 --with-local-prefix=/mingw64/local --build=x86_64-w64-mingw32 --host=x86_64-w64-mingw32 --target=x86_64-w64-mingw32 --with-native-system-header-dir=/mingw64/x86_64-w64-mingw32/include --libexecdir=/mingw64/lib --enable-bootstrap --with-arch=x86-64 --with-tune=generic --enable-languages=c,lto,c++,fortran,ada,objc,obj-c++ --enable-shared --enable-static --enable-libatomic --enable-threads=posix --enable-graphite --enable-fully-dynamic-string --enable-libstdcxx-filesystem-ts=yes --enable-libstdcxx-time=yes --disable-libstdcxx-pch --disable-libstdcxx-debug --disable-isl-version-check --enable-lto --enable-libgomp --disable-multilib --enable-checking=release --disable-rpath --disable-win32-registry --disable-nls --disable-werror --disable-symvers --enable-plugin --with-libiconv --with-system-zlib --with-gmp=/mingw64 --with-mpfr=/mingw64 --with-mpc=/mingw64 --with-isl=/mingw64 --with-pkgversion='Rev2, Built by MSYS2 project' --with-bugurl=https://sourceforge.net/projects/msys2 --with-gnu-as --with-gnu-ld
Thread model: posix
gcc version 9.2.0 (Rev2, Built by MSYS2 project)

I'm building it on my local system.

Any idea of what's wrong again?

igagis commented 4 years ago

Ok, I found that it was my fault, I was giving -I/usr/local/include to the compiler. Closing the bug.

acidtonic commented 3 years ago

I am having the same issue and my flags do not include /usr/local/include.

Not sure what is going wrong. The file in my project that includes is built as a library prior to the file that fails later in the build which includes the file from the library that built... except this time when it hits the include for string in it's header, it branches off and eventually hits includes that hit sched_yield and it stops there.

acidtonic commented 3 years ago
[  0%] Building CXX object libREDACTEDThread/CMakeFiles/REDACTEDThread.dir/threads/BaseThread.cpp.obj
cd /C/msys64/home/User/code/REDACTED/libREDACTEDThread && /C/msys64/mingw64/bin/g++.exe -DDEV_ONLY=1 -DMKL_ILP64 -I/C/msys64/home/User/code/REDACTED/libREDACTEDThread -I/C/msys64/home/User/code/REDACTED/dep/CIPster/source/src -I/C/msys64/home/User/code/REDACTED/libREDACTEDThread/threads -I/C/msys64/home/User/code/REDACTED/libREDACTEDThread/meta -std=c++17 -g -fPIC -O0 -g -D_DEBUG -g -O0   -I/include -std=gnu++17 -MD -MT libREDACTEDThread/CMakeFiles/REDACTEDThread.dir/threads/BaseThread.cpp.obj -MF CMakeFiles/REDACTEDThread.dir/threads/BaseThread.cpp.obj.d -o CMakeFiles/REDACTEDThread.dir/threads/BaseThread.cpp.obj -c /C/msys64/home/User/code/REDACTED/libREDACTEDThread/threads/BaseThread.cpp
[  0%] Building CXX object libREDACTEDThread/CMakeFiles/REDACTEDThread.dir/threads/LogThread.cpp.obj
cd /C/msys64/home/User/code/REDACTED/libREDACTEDThread && /C/msys64/mingw64/bin/g++.exe -DDEV_ONLY=1 -DMKL_ILP64 -I/C/msys64/home/User/code/REDACTED/libREDACTEDThread -I/C/msys64/home/User/code/REDACTED/dep/CIPster/source/src -I/C/msys64/home/User/code/REDACTED/libREDACTEDThread/threads -I/C/msys64/home/User/code/REDACTED/libREDACTEDThread/meta -std=c++17 -g -fPIC -O0 -g -D_DEBUG -g -O0   -I/include -std=gnu++17 -MD -MT libREDACTEDThread/CMakeFiles/REDACTEDThread.dir/threads/LogThread.cpp.obj -MF CMakeFiles/REDACTEDThread.dir/threads/LogThread.cpp.obj.d -o CMakeFiles/REDACTEDThread.dir/threads/LogThread.cpp.obj -c /C/msys64/home/User/code/REDACTED/libREDACTEDThread/threads/LogThread.cpp
[  1%] Linking CXX static library libREDACTEDThread_d.a

[other files building...]

[  4%] Building CXX object libREDACTEDScript/CMakeFiles/REDACTEDScript.dir/audio/AudioThread.cpp.obj
cd /C/msys64/home/User/code/REDACTED/libREDACTEDScript && /C/msys64/mingw64/bin/g++.exe -DDEV_ONLY=1 -DHAVE_SCHED_H=1 -DLOCAL_CONFIG_PATH=\"resources/config.json\" -DLOCAL_DATABASE_FILE=\"C:/msys64/home/User/code/REDACTED/libREDACTEDScript/db.sqlite\" -DLOCAL_DATABASE_MIGRATIONS=\"C:/msys64/home/User/code/REDACTED/libREDACTEDScript/sql\" -DLOCAL_OATPP_SWAGGER_RES_PATH="\"C:/Program Files (x86)/oatpp-swagger/include/oatpp-1.2.5/oatpp-swagger//../bin/oatpp-swagger/res\"" -DMKL_ILP64 -DOPENCV=1 -DOPENCV_TRACKING=1 -I/C/msys64/home/User/code/REDACTED/libREDACTEDScript -I/C/msys64/home/User/code/REDACTED/dep/CIPster/source/src -I/C/msys64/home/User/code/REDACTED/libREDACTEDThread -I/C/msys64/home/User/code/REDACTED/libREDACTEDTracking -I/C/msys64/home/User/code/REDACTED/libREDACTEDSocket -I/C/msys64/home/User/code/REDACTED/libREDACTEDRelay -I/C/msys64/home/User/code/REDACTED/libREDACTEDDb -I/C/msys64/home/User/code/REDACTED/libREDACTEDGuiThumbnailer -I/C/msys64/home/User/code/REDACTED/libREDACTEDThread/threads -I/C/msys64/home/User/code/REDACTED/libREDACTEDThread/meta -I/C/msys64/home/User/code/REDACTED/libREDACTEDSocket/socket -I/C/msys64/home/User/code/REDACTED/libREDACTEDRelay/relay -I/C/msys64/home/User/code/REDACTED/libREDACTEDScript/audio -I/C/msys64/home/User/code/REDACTED/libREDACTEDScript/time -I/C/msys64/home/User/code/REDACTED/libREDACTEDScript/scripting -I/C/msys64/home/User/code/REDACTED/libREDACTEDScript/scripting/angelscript -I/C/msys64/home/User/code/REDACTED/libREDACTEDScript/scripting/angelscript/add_on -I/C/msys64/home/User/code/REDACTED/libREDACTEDScript/scripting/angelscript/include -I/C/msys64/home/User/code/REDACTED/libREDACTEDScript/scripting/angelscript/source -I/C/msys64/home/User/code/REDACTED/libREDACTEDScript/scripting/angelscript/add_on/aatc/source -I/C/msys64/home/User/code/REDACTED/libREDACTEDScript/scripting/angelscript/add_on/autowrapper -I/C/msys64/home/User/code/REDACTED/libREDACTEDScript/scripting/angelscript/add_on/contextmgr -I/C/msys64/home/User/code/REDACTED/libREDACTEDScript/scripting/angelscript/add_on/debugger -I/C/msys64/home/User/code/REDACTED/libREDACTEDScript/scripting/angelscript/add_on/scriptarray -I/C/msys64/home/User/code/REDACTED/libREDACTEDScript/scripting/angelscript/add_on/scriptbuilder -I/C/msys64/home/User/code/REDACTED/libREDACTEDScript/scripting/angelscript/add_on/scriptdictionary -I/C/msys64/home/User/code/REDACTED/libREDACTEDScript/scripting/angelscript/add_on/scripthandle -I/C/msys64/home/User/code/REDACTED/libREDACTEDScript/scripting/angelscript/add_on/scripthelper -I/C/msys64/home/User/code/REDACTED/libREDACTEDScript/scripting/angelscript/add_on/scriptmath -I/C/msys64/home/User/code/REDACTED/libREDACTEDScript/scripting/angelscript/add_on/scriptstdstring -I/C/msys64/home/User/code/REDACTED/libREDACTEDGuiThumbnailer/gui -I/C/msys64/home/User/code/REDACTED/libREDACTEDTracking/tracking -I/C/msys64/home/User/code/REDACTED/libREDACTEDDb/db -I/C/msys64/home/User/code/REDACTED/libREDACTEDGpu/. -I/C/msys64/home/User/code/REDACTED/libREDACTEDGpu/gpu -I/C/msys64/home/User/code/REDACTED/libREDACTEDUtility/. -I/C/msys64/home/User/code/REDACTED/libREDACTEDUtility/crypto -I/C/msys64/home/User/code/REDACTED/libREDACTEDUtility/utility -I/C/msys64/home/User/code/REDACTED/libREDACTEDUtility/jwt -I/C/msys64/home/User/code/REDACTED/libREDACTEDUtility/algorithm -I/C/msys64/home/User/code/REDACTED/libREDACTEDUtility/fft -I/C/msys64/home/User/code/REDACTED/trainer/trainer/include -I/C/msys64/home/User/code/REDACTED/trainer/trainer/3rdparty/stb/include -I/C/msys64/home/User/code/REDACTED/libREDACTEDNet/. -I/C/msys64/home/User/code/REDACTED/libREDACTEDNet/decision -I/C/msys64/home/User/code/REDACTED/libREDACTEDNet/darknet -I/C/msys64/home/User/code/REDACTED/libREDACTEDNet/cip -I/C/msys64/home/User/code/REDACTED/libREDACTEDOpc/opc -I/C/msys64/home/User/code/REDACTED/libREDACTEDOpc/opc/variables -I/C/msys64/home/User/code/REDACTED/libREDACTEDGui/gui -I/C/msys64/home/User/code/REDACTED/libREDACTEDLicense/. -I/C/msys64/home/User/code/REDACTED/libREDACTEDLicense/utility -I/C/msys64/home/User/code/REDACTED/libREDACTEDRestAPI/client -I/C/msys64/home/User/code/REDACTED/libREDACTEDRestAPI/dto -I/C/msys64/home/User/code/REDACTED/libREDACTEDRestAPI/server -I/C/msys64/home/User/code/REDACTED/libREDACTEDRestAPI/server/auth -I/C/msys64/home/User/code/REDACTED/libREDACTEDRestAPI/server/controller -I/C/msys64/home/User/code/REDACTED/libREDACTEDRestAPI/server/service -I/C/msys64/home/User/code/REDACTED/libREDACTEDScriptRegistration/scripting/angelscript/registration -I/C/msys64/home/User/code/REDACTED/libREDACTEDScriptRegistration/scripting/angelscript/registration/relay -I/C/msys64/home/User/code/REDACTED/libREDACTEDScriptRegistration/scripting/angelscript/registration/core -I/C/msys64/home/User/code/REDACTED/libREDACTEDScriptRegistration/scripting/angelscript/registration/audio -I/C/msys64/home/User/code/REDACTED/lib/. -I/C/msys64/home/User/code/REDACTED/lib/capture -I/C/msys64/home/User/code/REDACTED/lib/chart -I/C/msys64/home/User/code/REDACTED/lib/catch -I/C/msys64/home/User/code/REDACTED/lib/id -I/C/msys64/home/User/code/REDACTED/lib/preprocessing -I/C/msys64/home/User/code/REDACTED/lib/tar -I/C/msys64/home/User/code/REDACTED/lib/event -I/C/msys64/home/User/code/REDACTED/lib/event/model -I/C/msys64/mingw64/include/gtkmm-3.0 -I/C/msys64/mingw64/lib/gtkmm-3.0/include -I/C/msys64/mingw64/include/giomm-2.4 -I/C/msys64/mingw64/lib/giomm-2.4/include -I/C/msys64/mingw64/include/glib-2.0 -I/C/msys64/mingw64/lib/glib-2.0/include -I/C/msys64/mingw64/include/glibmm-2.4 -I/C/msys64/mingw64/lib/glibmm-2.4/include -I/C/msys64/mingw64/include/sigc++-2.0 -I/C/msys64/mingw64/lib/sigc++-2.0/include -I/C/msys64/mingw64/include/gtk-3.0 -I/C/msys64/mingw64/include/pango-1.0 -I/C/msys64/mingw64/include/harfbuzz -I/C/msys64/mingw64/include/freetype2 -I/C/msys64/mingw64/include/libpng16 -I/C/msys64/mingw64/include/fribidi -I/C/msys64/mingw64/include/cairo -I/C/msys64/mingw64/include/lzo -I/C/msys64/mingw64/include/pixman-1 -I/C/msys64/mingw64/include/gdk-pixbuf-2.0 -I/C/msys64/mingw64/include/atk-1.0 -I/C/msys64/mingw64/include/cairomm-1.0 -I/C/msys64/mingw64/lib/cairomm-1.0/include -I/C/msys64/mingw64/include/pangomm-1.4 -I/C/msys64/mingw64/lib/pangomm-1.4/include -I/C/msys64/mingw64/include/atkmm-1.6 -I/C/msys64/mingw64/lib/atkmm-1.6/include -I/C/msys64/mingw64/include/gdkmm-3.0 -I/C/msys64/mingw64/lib/gdkmm-3.0/include -I/C/msys64/mingw64/include/gdlmm-3.0 -I/C/msys64/mingw64/lib/gdlmm-3.0/include -I/C/msys64/mingw64/include/libgdl-3.0 -I/C/msys64/mingw64/include/libxml2 -I/C/msys64/mingw64/include/gtksourceviewmm-3.0 -I/C/msys64/mingw64/lib/gtksourceviewmm-3.0/include -I/C/msys64/mingw64/include/gtksourceview-3.0 -I/C/msys64/mingw64/include/opencv4 -I/C/msys64/usr/include -I/C/msys64/mingw64/include/eigen3 -I/C/msys64/mingw64/include/ao -std=c++17 -g -fPIC -O0 -g -D_DEBUG -g -O0   -I/include -std=gnu++17 -MD -MT libREDACTEDScript/CMakeFiles/REDACTEDScript.dir/audio/AudioThread.cpp.obj -MF CMakeFiles/REDACTEDScript.dir/audio/AudioThread.cpp.obj.d -o CMakeFiles/REDACTEDScript.dir/audio/AudioThread.cpp.obj -c /C/msys64/home/User/code/REDACTED/libREDACTEDScript/audio/AudioThread.cpp
In file included from C:/msys64/mingw64/include/c++/10.3.0/x86_64-w64-mingw32/bits/gthr.h:148,
                 from C:/msys64/mingw64/include/c++/10.3.0/ext/atomicity.h:35,
                 from C:/msys64/mingw64/include/c++/10.3.0/bits/basic_string.h:39,
                 from C:/msys64/mingw64/include/c++/10.3.0/string:55,
                 from C:/msys64/home/User/code/REDACTED/libREDACTEDThread/threads/BaseThread.hpp:12,
                 from C:/msys64/home/User/code/REDACTED/libREDACTEDScript/audio/AudioThread.hpp:6,
                 from C:/msys64/home/User/code/REDACTED/libREDACTEDScript/audio/AudioThread.cpp:2:
C:/msys64/mingw64/include/c++/10.3.0/x86_64-w64-mingw32/bits/gthr-default.h: In function 'int __gthread_yield()':
C:/msys64/mingw64/include/c++/10.3.0/x86_64-w64-mingw32/bits/gthr-default.h:693:10: error: 'sched_yield' was not declared in this scope; did you mean 'pthread_yield'?
  693 |   return __gthrw_(sched_yield) ();
      |          ^~~~~~~~
In file included from C:/msys64/mingw64/include/c++/10.3.0/cctype:42,
                 from C:/msys64/mingw64/include/c++/10.3.0/bits/localefwd.h:42,
                 from C:/msys64/mingw64/include/c++/10.3.0/string:43,
                 from C:/msys64/home/User/code/REDACTED/libREDACTEDThread/threads/BaseThread.hpp:12,
                 from C:/msys64/home/User/code/REDACTED/libREDACTEDScript/audio/AudioThread.hpp:6,
                 from C:/msys64/home/User/code/REDACTED/libREDACTEDScript/audio/AudioThread.cpp:2:
C:/msys64/mingw64/x86_64-w64-mingw32/include/stdlib.h: At global scope:
C:/msys64/mingw64/x86_64-w64-mingw32/include/stdlib.h:414:23: error: expected ',' or '...' before numeric constant
  414 |   int __cdecl abs(int _X);
      |                       ^~
C:/msys64/mingw64/x86_64-w64-mingw32/include/stdlib.h:415:26: error: expected ',' or '...' before numeric constant
  415 |   long __cdecl labs(long _X);
      |                          ^~
In file included from C:/msys64/mingw64/x86_64-w64-mingw32/include/sec_api/stdlib_s.h:9,
                 from C:/msys64/mingw64/x86_64-w64-mingw32/include/stdlib.h:765,
                 from C:/msys64/mingw64/include/c++/10.3.0/cstdlib:75,
                 from C:/msys64/mingw64/include/c++/10.3.0/ext/string_conversions.h:41,
                 from C:/msys64/mingw64/include/c++/10.3.0/bits/basic_string.h:6545,
                 from C:/msys64/mingw64/include/c++/10.3.0/string:55,
                 from C:/msys64/home/User/code/REDACTED/libREDACTEDThread/threads/BaseThread.hpp:12,
                 from C:/msys64/home/User/code/REDACTED/libREDACTEDScript/audio/AudioThread.hpp:6,
                 from C:/msys64/home/User/code/REDACTED/libREDACTEDScript/audio/AudioThread.cpp:2:
C:/msys64/usr/include/stdlib.h:39:3: error: conflicting declaration 'typedef struct div_t div_t'
   39 | } div_t;
      |   ^~~~~
In file included from C:/msys64/mingw64/include/c++/10.3.0/cstdlib:75,
                 from C:/msys64/mingw64/include/c++/10.3.0/ext/string_conversions.h:41,
                 from C:/msys64/mingw64/include/c++/10.3.0/bits/basic_string.h:6545,
                 from C:/msys64/mingw64/include/c++/10.3.0/string:55,
                 from C:/msys64/home/User/code/REDACTED/libREDACTEDThread/threads/BaseThread.hpp:12,
                 from C:/msys64/home/User/code/REDACTED/libREDACTEDScript/audio/AudioThread.hpp:6,
                 from C:/msys64/home/User/code/REDACTED/libREDACTEDScript/audio/AudioThread.cpp:2:
C:/msys64/mingw64/x86_64-w64-mingw32/include/stdlib.h:63:5: note: previous declaration as 'typedef struct _div_t div_t'
   63 |   } div_t;
      |     ^~~~~
In file included from C:/msys64/mingw64/x86_64-w64-mingw32/include/sec_api/stdlib_s.h:9,
                 from C:/msys64/mingw64/x86_64-w64-mingw32/include/stdlib.h:765,
                 from C:/msys64/mingw64/include/c++/10.3.0/cstdlib:75,
                 from C:/msys64/mingw64/include/c++/10.3.0/ext/string_conversions.h:41,
                 from C:/msys64/mingw64/include/c++/10.3.0/bits/basic_string.h:6545,
                 from C:/msys64/mingw64/include/c++/10.3.0/string:55,
                 from C:/msys64/home/User/code/REDACTED/libREDACTEDThread/threads/BaseThread.hpp:12,
                 from C:/msys64/home/User/code/REDACTED/libREDACTEDScript/audio/AudioThread.hpp:6,
                 from C:/msys64/home/User/code/REDACTED/libREDACTEDScript/audio/AudioThread.cpp:2:
C:/msys64/usr/include/stdlib.h:45:3: error: conflicting declaration 'typedef struct ldiv_t ldiv_t'
   45 | } ldiv_t;
      |   ^~~~~~
In file included from C:/msys64/mingw64/include/c++/10.3.0/cstdlib:75,
                 from C:/msys64/mingw64/include/c++/10.3.0/ext/string_conversions.h:41,
                 from C:/msys64/mingw64/include/c++/10.3.0/bits/basic_string.h:6545,
                 from C:/msys64/mingw64/include/c++/10.3.0/string:55,
                 from C:/msys64/home/User/code/REDACTED/libREDACTEDThread/threads/BaseThread.hpp:12,
                 from C:/msys64/home/User/code/REDACTED/libREDACTEDScript/audio/AudioThread.hpp:6,
                 from C:/msys64/home/User/code/REDACTED/libREDACTEDScript/audio/AudioThread.cpp:2:
C:/msys64/mingw64/x86_64-w64-mingw32/include/stdlib.h:68:5: note: previous declaration as 'typedef struct _ldiv_t ldiv_t'
   68 |   } ldiv_t;
      |     ^~~~~~
In file included from C:/msys64/mingw64/x86_64-w64-mingw32/include/sec_api/stdlib_s.h:9,
                 from C:/msys64/mingw64/x86_64-w64-mingw32/include/stdlib.h:765,
                 from C:/msys64/mingw64/include/c++/10.3.0/cstdlib:75,
                 from C:/msys64/mingw64/include/c++/10.3.0/ext/string_conversions.h:41,
                 from C:/msys64/mingw64/include/c++/10.3.0/bits/basic_string.h:6545,
                 from C:/msys64/mingw64/include/c++/10.3.0/string:55,
                 from C:/msys64/home/User/code/REDACTED/libREDACTEDThread/threads/BaseThread.hpp:12,
                 from C:/msys64/home/User/code/REDACTED/libREDACTEDScript/audio/AudioThread.hpp:6,
                 from C:/msys64/home/User/code/REDACTED/libREDACTEDScript/audio/AudioThread.cpp:2:
C:/msys64/usr/include/stdlib.h:52:3: error: conflicting declaration 'typedef struct lldiv_t lldiv_t'
   52 | } lldiv_t;
      |   ^~~~~~~
In file included from C:/msys64/mingw64/include/c++/10.3.0/cstdlib:75,
                 from C:/msys64/mingw64/include/c++/10.3.0/ext/string_conversions.h:41,
                 from C:/msys64/mingw64/include/c++/10.3.0/bits/basic_string.h:6545,
                 from C:/msys64/mingw64/include/c++/10.3.0/string:55,
                 from C:/msys64/home/User/code/REDACTED/libREDACTEDThread/threads/BaseThread.hpp:12,
                 from C:/msys64/home/User/code/REDACTED/libREDACTEDScript/audio/AudioThread.hpp:6,
                 from C:/msys64/home/User/code/REDACTED/libREDACTEDScript/audio/AudioThread.cpp:2:
C:/msys64/mingw64/x86_64-w64-mingw32/include/stdlib.h:724:61: note: previous declaration as 'typedef struct lldiv_t lldiv_t'
  724 |   typedef struct { __MINGW_EXTENSION long long quot, rem; } lldiv_t;
      |                                                             ^~~~~~~
In file included from C:/msys64/mingw64/x86_64-w64-mingw32/include/sec_api/stdlib_s.h:9,
                 from C:/msys64/mingw64/x86_64-w64-mingw32/include/stdlib.h:765,
                 from C:/msys64/mingw64/include/c++/10.3.0/cstdlib:75,
                 from C:/msys64/mingw64/include/c++/10.3.0/ext/string_conversions.h:41,
                 from C:/msys64/mingw64/include/c++/10.3.0/bits/basic_string.h:6545,
                 from C:/msys64/mingw64/include/c++/10.3.0/string:55,
                 from C:/msys64/home/User/code/REDACTED/libREDACTEDThread/threads/BaseThread.hpp:12,
                 from C:/msys64/home/User/code/REDACTED/libREDACTEDScript/audio/AudioThread.hpp:6,
                 from C:/msys64/home/User/code/REDACTED/libREDACTEDScript/audio/AudioThread.cpp:2:
C:/msys64/usr/include/stdlib.h:205:5: error: conflicting declaration of C function 'int putenv(char*)'
  205 | int putenv (char *__string);
      |     ^~~~~~
In file included from C:/msys64/mingw64/include/c++/10.3.0/cstdlib:75,
                 from C:/msys64/mingw64/include/c++/10.3.0/ext/string_conversions.h:41,
                 from C:/msys64/mingw64/include/c++/10.3.0/bits/basic_string.h:6545,
                 from C:/msys64/mingw64/include/c++/10.3.0/string:55,
                 from C:/msys64/home/User/code/REDACTED/libREDACTEDThread/threads/BaseThread.hpp:12,
                 from C:/msys64/home/User/code/REDACTED/libREDACTEDScript/audio/AudioThread.hpp:6,
                 from C:/msys64/home/User/code/REDACTED/libREDACTEDScript/audio/AudioThread.cpp:2:
C:/msys64/mingw64/x86_64-w64-mingw32/include/stdlib.h:710:15: note: previous declaration 'int putenv(const char*)'
  710 |   int __cdecl putenv(const char *_EnvString) __MINGW_ATTRIB_DEPRECATED_MSVC2005;
      |               ^~~~~~
In file included from C:/msys64/usr/include/errno.h:9,
                 from C:/msys64/mingw64/include/c++/10.3.0/cerrno:42,
                 from C:/msys64/mingw64/include/c++/10.3.0/ext/string_conversions.h:44,
                 from C:/msys64/mingw64/include/c++/10.3.0/bits/basic_string.h:6545,
                 from C:/msys64/mingw64/include/c++/10.3.0/string:55,
                 from C:/msys64/home/User/code/REDACTED/libREDACTEDThread/threads/BaseThread.hpp:12,
                 from C:/msys64/home/User/code/REDACTED/libREDACTEDScript/audio/AudioThread.hpp:6,
                 from C:/msys64/home/User/code/REDACTED/libREDACTEDScript/audio/AudioThread.cpp:2:
C:/msys64/usr/include/sys/errno.h:20:36: error: conflicting declaration 'const char* const _sys_errlist []'
   20 | extern __IMPORT const char * const _sys_errlist[];
      |                                    ^~~~~~~~~~~~
In file included from C:/msys64/mingw64/include/c++/10.3.0/cstdlib:75,
                 from C:/msys64/mingw64/include/c++/10.3.0/ext/string_conversions.h:41,
                 from C:/msys64/mingw64/include/c++/10.3.0/bits/basic_string.h:6545,
                 from C:/msys64/mingw64/include/c++/10.3.0/string:55,
                 from C:/msys64/home/User/code/REDACTED/libREDACTEDThread/threads/BaseThread.hpp:12,
                 from C:/msys64/home/User/code/REDACTED/libREDACTEDScript/audio/AudioThread.hpp:6,
                 from C:/msys64/home/User/code/REDACTED/libREDACTEDScript/audio/AudioThread.cpp:2:
C:/msys64/mingw64/x86_64-w64-mingw32/include/stdlib.h:173:38: note: previous declaration as 'char* _sys_errlist [1]'
  173 |   extern __declspec(dllimport) char *_sys_errlist[1];
      |                                      ^~~~~~~~~~~~
In file included from C:/msys64/mingw64/include/c++/10.3.0/cwctype:50,
                 from C:/msys64/mingw64/include/c++/10.3.0/bits/locale_facets.h:39,
                 from C:/msys64/mingw64/include/c++/10.3.0/bits/basic_ios.h:37,
                 from C:/msys64/mingw64/include/c++/10.3.0/ios:44,
                 from C:/msys64/mingw64/include/c++/10.3.0/istream:38,
                 from C:/msys64/mingw64/include/c++/10.3.0/sstream:38,
                 from C:/msys64/home/User/code/REDACTED/libREDACTEDThread/threads/BaseThread.hpp:14,
                 from C:/msys64/home/User/code/REDACTED/libREDACTEDScript/audio/AudioThread.hpp:6,
                 from C:/msys64/home/User/code/REDACTED/libREDACTEDScript/audio/AudioThread.cpp:2:
C:/msys64/usr/include/wctype.h:22:13: error: conflicting declaration 'typedef int wctype_t'
   22 | typedef int wctype_t;
      |             ^~~~~~~~
In file included from C:/msys64/mingw64/x86_64-w64-mingw32/include/crtdefs.h:10,
                 from C:/msys64/mingw64/x86_64-w64-mingw32/include/stddef.h:7,
                 from C:/msys64/mingw64/lib/gcc/x86_64-w64-mingw32/10.3.0/include/stddef.h:1,
                 from C:/msys64/usr/include/sys/cdefs.h:47,
                 from C:/msys64/usr/include/sys/types.h:21,
                 from C:/msys64/usr/include/sched.h:23,
                 from C:/msys64/home/User/code/REDACTED/libREDACTEDScript/audio/AudioThread.hpp:5,
                 from C:/msys64/home/User/code/REDACTED/libREDACTEDScript/audio/AudioThread.cpp:2:
C:/msys64/mingw64/x86_64-w64-mingw32/include/corecrt.h:107:24: note: previous declaration as 'typedef short unsigned int wctype_t'
  107 | typedef unsigned short wctype_t;
      |                        ^~~~~~~~
In file included from C:/msys64/home/User/code/REDACTED/libREDACTEDThread/threads/BaseThread.hpp:18,
                 from C:/msys64/home/User/code/REDACTED/libREDACTEDScript/audio/AudioThread.hpp:6,
                 from C:/msys64/home/User/code/REDACTED/libREDACTEDScript/audio/AudioThread.cpp:2:
C:/msys64/mingw64/include/c++/10.3.0/thread: In function 'void std::this_thread::sleep_for(const std::chrono::duration<_Rep1, _Period1>&)':
C:/msys64/mingw64/include/c++/10.3.0/thread:401:11: error: '::nanosleep' has not been declared
  401 |  while (::nanosleep(&__ts, &__ts) == -1 && errno == EINTR)
      |           ^~~~~~~~~
make[2]: *** [libREDACTEDScript/CMakeFiles/REDACTEDScript.dir/build.make:79: libREDACTEDScript/CMakeFiles/REDACTEDScript.dir/audio/AudioThread.cpp.obj] Error 1
make[2]: Leaving directory '/home/User/code/REDACTED'
make[1]: *** [CMakeFiles/Makefile2:1870: libREDACTEDScript/CMakeFiles/REDACTEDScript.dir/all] Error 2
make[1]: Leaving directory '/home/User/code/REDACTED'
make: *** [Makefile:159: all] Error 2
acidtonic commented 3 years ago

I have toyed with manually placing -DHAVE_SCHED_H=1 in the configuration with no change in behavior. Not sure what is wrong here....

1480c1 commented 3 years ago

It seems it's because you have -I/C/msys64/usr/include, which I guess is including the wrong headers (the cygwin base and not the mingw-w64 ones)

acidtonic commented 3 years ago

That is actually very helpful thank you very much. I will take a look further tomorrow and report back.

acidtonic commented 3 years ago

Discovered a custom cmake file to find the fmem library was bringing in that path due to fmem placing it's installed files on windows inside Program Files (x86).

Still investigating but I believe that is my culprit.

acidtonic commented 3 years ago

In short it was my fault... fmem put files inside Program Files (x86) and my cmake file to find it did not look there. I thought since it only dropped a single header and static library file I would just copy it to /usr/include and /usr/lib on this windows machine to get the build going instead of editing the paths inside my FindFmem.cmake file.

Turned out the path it found was /msys64/usr/include and /msys64/usr/lib which then eventually made their way into my compiler invocation paths and cross-linked cygwin/mingw64 headers.

Without that advice above I would not have known what to do. Thanks again!