Raised This Month: $12 Target: $400
 3% 

Solved MM:S plugin fails to compile due to stdlib-related error on newer toolchains


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
nosoop
Veteran Member
Join Date: Aug 2014
Old 05-28-2021 , 00:06   MM:S plugin fails to compile due to stdlib-related error on newer toolchains
Reply With Quote #1

I'm trying to compile my fork of RCBot2 (a hybrid MM:S plugin and SourceMod extension), and it reports the following error message on the current Debian (Buster) release using Clang:

Code:
In file included from /home/user/alliedmodders/rcbot2/utils/RCBot2_meta/bot_plugin_meta.cpp:40:
In file included from /home/user/alliedmodders/rcbot2/utils/RCBot2_meta/bot.h:68:
In file included from /home/user/alliedmodders/rcbot2/utils/RCBot2_meta/bot_utility.h:37:
In file included from /usr/bin/../lib/gcc/x86_64-linux-gnu/8/../../../../include/c++/8/vector:60:
In file included from /usr/bin/../lib/gcc/x86_64-linux-gnu/8/../../../../include/c++/8/bits/stl_algobase.h:64:
/usr/bin/../lib/gcc/x86_64-linux-gnu/8/../../../../include/c++/8/bits/stl_pair.h:428:13: error: no member named 'swap' in namespace 'std'
        using std::swap;
              ~~~~~^
A similar error among others is displayed on GCC:

Code:
In file included from /usr/include/c++/8/bits/stl_algobase.h:64,
                 from /usr/include/c++/8/vector:60,
                 from /home/user/alliedmodders/rcbot2/utils/RCBot2_meta/bot_utility.h:37,
                 from /home/user/alliedmodders/rcbot2/utils/RCBot2_meta/bot.h:68,
                 from /home/user/alliedmodders/rcbot2/utils/RCBot2_meta/bot_plugin_meta.cpp:40:
/usr/include/c++/8/bits/stl_pair.h: In member function ‘void std::pair<_T1, _T2>::swap(std::pair<_T1, _T2>&)’:
/usr/include/c++/8/bits/stl_pair.h:428:13: error: ‘std::swap’ has not been declared
  using std::swap;
             ^~~~
Full error message is available in this issue. It's known to compile against the older Debian 8 and Ubuntu 16.04 without any changes. Google comes up with no results on this particular error, and similar issues don't seem to fit this problem.

Any ideas of where to go from here? Very lost since the compile error appears to happen within the standard library. Compiling a short C++ file using clang++ with the algorithm and vector includes does work no problem.

Would prefer to stick to c++11.
__________________
I do TF2, TF2 servers, and TF2 plugins.
I don't do DMs over Discord -- PM me on the forums regarding inquiries.
AlliedModders Releases / Github / TF2 Server / Donate (BTC / BCH / coffee)

Last edited by nosoop; 05-28-2021 at 00:33.
nosoop is offline
nosoop
Veteran Member
Join Date: Aug 2014
Old 05-28-2021 , 00:32   Re: MM:S plugin fails to compile due to stdlib-related error on newer toolchains
Reply With Quote #2

Ah, that's silly. Commenting out every instance of

Code:
#define swap V_swap
and

Code:
#undef swap
seems to work. This effectively reverts one of my previous commits in my fork which intended to avoid conflicts with libstdc++ at the time. (It predates the corresponding commit to fix this in DoD:S.)

Not sure why the redefinition doesn't show up in the compiler errors, but regardless, this is solved.
__________________
I do TF2, TF2 servers, and TF2 plugins.
I don't do DMs over Discord -- PM me on the forums regarding inquiries.
AlliedModders Releases / Github / TF2 Server / Donate (BTC / BCH / coffee)

Last edited by nosoop; 05-28-2021 at 02:18.
nosoop is offline
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 17:26.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode