Work around strange build error on Ubuntu 18.04
authorCarl Hetherington <cth@carlh.net>
Fri, 23 Sep 2022 08:00:18 +0000 (10:00 +0200)
committerCarl Hetherington <cth@carlh.net>
Fri, 23 Sep 2022 08:51:51 +0000 (10:51 +0200)
tmp/cc4JuI65.s: Assembler messages:
/tmp/cc4JuI65.s:174: Error: symbol `_ZNSt14_Function_base13_Base_managerIUlNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEE_E10_M_managerERSt9_Any_dataRKS9_St18_Manager_operation' is already defined

src/lib/create_cli.cc

index a6e13c8bc04a26ed0df26aaabf0c2f9b8b72c4f0..107311d59ca01130d0c67ab9a85433f5f6bcb216 100644 (file)
@@ -176,6 +176,10 @@ CreateCLI::CreateCLI (int argc, char* argv[])
                        claimed = true;
                }
 
+               std::function<optional<string> (string s)> string_to_string = [](string s) {
+                       return s;
+               };
+
                std::function<optional<boost::filesystem::path> (string s)> string_to_path = [](string s) {
                        return boost::filesystem::path(s);
                };
@@ -212,7 +216,10 @@ CreateCLI::CreateCLI (int argc, char* argv[])
                argument_option(i, argc, argv, "", "--channel", &claimed, &error, &channel, convert_channel);
                argument_option(i, argc, argv, "", "--gain", &claimed, &error, &gain);
                argument_option(i, argc, argv, "", "--kdm", &claimed, &error, &kdm, string_to_path);
-               argument_option(i, argc, argv, "", "--cpl", &claimed, &error, &cpl);
+               /* It shouldn't be necessary to use this string_to_string here, but using the other argument_option()
+                * causes an odd compile error on Ubuntu 18.04.
+                */
+               argument_option(i, argc, argv, "", "--cpl", &claimed, &error, &cpl, string_to_string);
 
                if (!claimed) {
                        if (a.length() > 2 && a.substr(0, 2) == "--") {