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

MinGW32 compilation errors #116

Open
Lastique opened this issue Jan 18, 2024 · 13 comments
Open

MinGW32 compilation errors #116

Lastique opened this issue Jan 18, 2024 · 13 comments

Comments

@Lastique
Copy link
Member

Looks like 44582f3 and possibly some other recent commits broke MinGW32 builds of Boost.Filesystem:

gcc.compile.c++ bin.v2\libs\filesystem\build\gcc-5\debug\cxxstd-11-iso\threadapi-win32\threading-multi\visibility-hidden\codecvt_error_category.o
In file included from ./boost/system/detail/append_int.hpp:8:0,
                 from ./boost/system/detail/error_condition.hpp:18,
                 from ./boost/system/detail/error_category_impl.hpp:14,
                 from ./boost/system/error_category.hpp:11,
                 from ./boost/filesystem/detail/path_traits.hpp:25,
                 from libs/filesystem/src/codecvt_error_category.cpp:18:
./boost/system/detail/snprintf.hpp:22:12: error: 'std::snprintf' has not been declared
 using std::snprintf;
            ^
In file included from ./boost/system/detail/error_category_impl.hpp:79:0,
                 from ./boost/system/error_category.hpp:11,
                 from ./boost/filesystem/detail/path_traits.hpp:25,
                 from libs/filesystem/src/codecvt_error_category.cpp:18:
./boost/system/detail/mutex.hpp: At global scope:
./boost/system/detail/mutex.hpp:84:12: error: 'std::mutex' has not been declared
 using std::mutex;
            ^

https://ci.appveyor.com/project/Lastique/filesystem/builds/48983852/job/2cgottx8b8ckwac0?fullLog=true#L376

Is this platform no longer supported?

@Lastique
Copy link
Member Author

BTW, there is boost/core/snprintf.hpp in Boost.Core with snprintf emulation.

@pdimov
Copy link
Member

pdimov commented Jan 18, 2024

I suspect that nobody is using the plain MinGW (as opposed to mingw-w64) anymore, but I have no way to know for sure.

For the time being I've removed (the old) MinGW from my Appveyor. We'll see if anyone (apart from you) notices.

@pdimov
Copy link
Member

pdimov commented Jan 18, 2024

BTW, there is boost/core/snprintf.hpp in Boost.Core with snprintf emulation.

Yeah, there was an snprintf.hpp here too, before I removed it. :-)

@marakew
Copy link

marakew commented Jan 24, 2024

using msvc and C++20 the same issues with _snprintf

D:\T60\git\boost_\libs\system\include\boost/system/detail/snprintf.hpp(22): error C2039: '_snprintf': is not a member of 'std'
D:\Program Files (x86)\Microsoft Visual Studio\2019\EnterprisePreview\VC\Tools\MSVC\14.29.30133\include\functional(31): note: see declaration of 'std'
D:\T60\git\boost_\libs\system\include\boost/system/detail/snprintf.hpp(22): error C2873: '_snprintf': symbol cannot be used in a using-declaration
D:\T60\git\boost_\libs\system\include\boost/system/detail/append_int.hpp(23): error C2039: '_snprintf': is not a member of 'boost::system::detail'
D:\T60\git\boost_\libs\system\include\boost/system/detail/append_int.hpp(17): note: see declaration of 'boost::system::detail'
D:\T60\git\boost_\libs\system\include\boost/system/detail/system_category_message_win32.hpp(33): error C2039: '_snprintf': is not a member of 'boost::system::detail'
D:\T60\git\boost_\libs\system\include\boost/system/detail/system_category_message_win32.hpp(28): note: see declaration of 'boost::system::detail'
D:\T60\git\boost_\libs\system\include\boost/system/detail/interop_category.hpp(58): error C2039: '_snprintf': is not a member of 'boost::system::detail'
D:\T60\git\boost_\libs\system\include\boost/system/detail/interop_category.hpp(24): note: see declaration of 'boost::system::detail'
D:\T60\git\boost_\libs\system\include\boost/system/detail/error_code.hpp(266): error C2039: '_snprintf': is not a member of 'boost::system::detail'
D:\T60\git\boost_\libs\system\include\boost/system/detail/std_category.hpp(25): note: see declaration of 'boost::system::detail'
D:\T60\git\boost_\libs\system\include\boost/system/detail/error_code.hpp(272): error C2039: '_snprintf': is not a member of 'boost::system::detail'
D:\T60\git\boost_\libs\system\include\boost/system/detail/std_category.hpp(25): note: see declaration of 'boost::system::detail'
D:\T60\git\boost_\libs\system\include\boost/system/detail/error_category_impl.hpp(61): error C2039: '_snprintf': is not a member of 'boost::system::detail'
D:\T60\git\boost_\libs\system\include\boost/system/detail/std_category.hpp(25): note: see declaration of 'boost::system::detail'
D:\T60\git\boost_\libs\system\include\boost/system/detail/error_category_impl.hpp(67): error C2039: '_snprintf': is not a member of 'boost::system::detail'
D:\T60\git\boost_\libs\system\include\boost/system/detail/std_category.hpp(25): note: see declaration of 'boost::system::detail'

@marakew
Copy link

marakew commented Jan 24, 2024

look at there
nlohmann/json#1408 (comment)

@Lastique
Copy link
Member Author

Lastique commented Jan 24, 2024

@marakew This looks like snprintf is defined as a macro somewhere and gets replaced to _snprintf. Boost.System doesn't do this, and I'm fairly sure MSVC standard library also doesn't, so you should review your library dependencies and report this to the developers of the offending library.

In any case, this is not the issue that was reported here.

@marakew
Copy link

marakew commented Jan 24, 2024 via email

@pdimov
Copy link
Member

pdimov commented Jan 24, 2024

D:\T60\git\boost_\libs\system\include\boost/system/detail/snprintf.hpp(22): error C2039: '_snprintf': is not a member of 'std'

You have #define snprintf _snprintf somewhere. This is no longer needed on a recent MSVC (VS2015 and later) and needs to be removed.

@marakew
Copy link

marakew commented Jan 24, 2024 via email

@Lastique
Copy link
Member Author

drop "using std::snprintf" will be better solution

This is not a solution at all. Any std::snprintf or boost::core::snprintf calls will remain broken.

@marakew
Copy link

marakew commented Jan 24, 2024 via email

@pdimov
Copy link
Member

pdimov commented Jan 24, 2024

It will be more convenient for me because it will avoid bug reports such as yours, so I may well do that, but it's not a better solution overall, because you'll keep encountering these issues in other libraries until you fix your code to remove the #define.

@Lastique
Copy link
Member Author

Lastique commented Jan 24, 2024

not and how this was work before commit mention above ?

As long as you have the define, it didn't work and it won't work except by accident. Removing the define is the only solution.

Note that snprintf and _snprintf are not equivalent. So the correctness of the define is questionable to begin with.

Lastique added a commit to boostorg/filesystem that referenced this issue Feb 6, 2024
This compiler is no longer supported by Boost.System.

boostorg/system#116
Lastique added a commit to boostorg/log that referenced this issue Feb 6, 2024
This compiler is no longer supported by Boost.System.

boostorg/system#116
Lastique added a commit to boostorg/sync that referenced this issue Feb 6, 2024
This compiler is no longer supported by Boost.System.

boostorg/system#116
apolukhin added a commit to boostorg/stacktrace that referenced this issue Feb 22, 2024
* Update thread_safety_checking.cpp to use Standard Library types
* Remove MinGW runs due to boostorg/system#116
* Delete the shared memory example sources
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants