[MXS-4343] error: no matching function for call to 'mkstemp' Created: 2022-10-08  Updated: 2022-10-11  Resolved: 2022-10-11

Status: Closed
Project: MariaDB MaxScale
Component/s: build
Affects Version/s: 22.08.1
Fix Version/s: N/A

Type: Bug Priority: Major
Reporter: Martin Filla Assignee: Unassigned
Resolution: Won't Fix Votes: 0
Labels: None
Environment:

uname -a
FreeBSD 13.1-RELEASE-p1 FreeBSD 13.1-RELEASE-p1 GENERIC amd64
clang -v
FreeBSD clang version 13.0.0 (git@github.com:llvm/llvm-project.git llvmorg-13.0.0-0-gd7b669b3a303)
Target: x86_64-unknown-freebsd13.1
Thread model: posix
InstalledDir: /usr/bin

-std=gnu+14 or -std=gnu+17



 Description   

Hi.
I am trying to compile your code on FreeBSD and have an issue in compilation the source code with -std=gnu++14

FreeBSD-Ports/maxscale/work/.build/maxutils/maxbase/src && /usr/bin/c++ -DOPENSSL_1_1 -Iwork/code/FreeBSD-Ports/maxscale/work/.build/connector-c/install/include/mariadb -Iwork/code/FreeBSD-Ports/maxscale/work/.build/pcre2 -Iwork/code/FreeBSD-Ports/maxscale/work/.build/libmicrohttpd/include -Iwork/code/FreeBSD-Ports/maxscale/work/.build/jwt-cpp-prefix/src/jwt-cpp/include -Iwork/code/FreeBSD-Ports/maxscale/work/.build/jansson/install/include -Iwork/code/FreeBSD-Ports/maxscale/work/.build/librdkafka/include -Iwork/code/FreeBSD-Ports/maxscale/work/MaxScale-22.08.1/include -Iwork/code/FreeBSD-Ports/maxscale/work/MaxScale-22.08.1/server/modules/include -Iwork/code/FreeBSD-Ports/maxscale/work/.build/include -I/usr/local/include -Iwork/code/FreeBSD-Ports/maxscale/work/MaxScale-22.08.1/maxutils/maxbase/include -Iwork/code/FreeBSD-Ports/maxscale/work/MaxScale-22.08.1/maxutils/maxsql/include -Iwork/code/FreeBSD-Ports/maxscale/work/MaxScale-22.08.1/maxutils/maxsimd/include -I/usr/local/include/libxml2 -pipe -g -fstack-protector-strong -fno-strict-aliasing -rdynamic -fno-omit-frame-pointer -Wall -Wno-unused-variable -Wno-unused-function -Wno-unused-result -fPIC -Wno-deprecated-declarations -Wsuggest-override -pipe -g -fstack-protector-strong -fno-strict-aliasing -ggdb -pthread -pipe -Wformat -fstack-protector --param=ssp-buffer-size=4 -DSS_DEBUG -DLOG_ASSERT -std=gnu++14 -MD -MT maxutils/maxbase/src/CMakeFiles/maxbase.dir/filesystem.cc.o -MF CMakeFiles/maxbase.dir/filesystem.cc.o.d -o CMakeFiles/maxbase.dir/filesystem.cc.o -c work/code/FreeBSD-Ports/maxscale/work/MaxScale-22.08.1/maxutils/maxbase/src/filesystem.cc
c++: warning: argument unused during compilation: '-rdynamic' [-Wunused-command-line-argument]
In file included from work/code/FreeBSD-Ports/maxscale/work/MaxScale-22.08.1/maxutils/maxbase/src/filesystem.cc:14:
work/code/FreeBSD-Ports/maxscale/work/MaxScale-22.08.1/maxutils/maxbase/include/maxbase/filesystem.hh:35:83: warning: 'static_assert' with no message is a C++17 extension [-Wc++17-extensions]
    static_assert(sizeof(typename Container::iterator::value_type) == sizeof(char));
                                                                                  ^
                                                                                  , ""
work/code/FreeBSD-Ports/maxscale/work/MaxScale-22.08.1/maxutils/maxbase/src/filesystem.cc:29:14: error: no matching function for call to 'mkstemp'
    int fd = mkstemp(tmp.data());
             ^~~~~~~
/usr/include/stdlib.h:195:6: note: candidate function not viable: 1st argument ('const std::basic_string<char>::value_type *' (aka 'const char *')) would lose const qualifier
int      mkstemp(char *);
         ^
1 warning and 1 error generated.

Here is issue with parameter -std=gnu++17
In version C++17 was removed std::ptr<> from standard
for this case I have patch

--- maxutils/maxbase/include/maxbase/string.hh.orig     2022-09-12 06:23:56 UTC
+++ maxutils/maxbase/include/maxbase/string.hh
@@ -123,7 +123,7 @@ inline void ltrim(std::string& s)
     s.erase(s.begin(),
             std::find_if(s.begin(),
                          s.end(),
-                         std::not1(std::ptr_fun<int, int>(std::isspace))));
+                         [](unsigned char c){ return !std::isspace(c);}));
 }
 
 /**
@@ -135,7 +135,8 @@ inline void rtrim(std::string& s)
 {
     s.erase(std::find_if(s.rbegin(),
                          s.rend(),
-                         std::not1(std::ptr_fun<int, int>(std::isspace))).base(),
+                         [](unsigned char c){ return !std::isspace(c);}).base(),
+                         //std::not1(std::ptr_fun<int, int>(std::isspace))).base(),
             s.end());
 }

[  9%] Building CXX object maxutils/maxbase/src/CMakeFiles/maxbase.dir/filesystem.cc.o
cd work/code/FreeBSD-Ports/maxscale/work/.build/maxutils/maxbase/src && /usr/bin/c++ -DOPENSSL_1_1 -Iwork/code/FreeBSD-Ports/maxscale/work/.build/connector-c/install/include/mariadb -Iwork/code/FreeBSD-Ports/maxscale/work/.build/pcre2 -Iwork/code/FreeBSD-Ports/maxscale/work/.build/libmicrohttpd/include -Iwork/code/FreeBSD-Ports/maxscale/work/.build/jwt-cpp-prefix/src/jwt-cpp/include -Iwork/code/FreeBSD-Ports/maxscale/work/.build/jansson/install/include -Iwork/code/FreeBSD-Ports/maxscale/work/.build/librdkafka/include -Iwork/code/FreeBSD-Ports/maxscale/work/MaxScale-22.08.1/include -Iwork/code/FreeBSD-Ports/maxscale/work/MaxScale-22.08.1/server/modules/include -Iwork/code/FreeBSD-Ports/maxscale/work/.build/include -I/usr/local/include -Iwork/code/FreeBSD-Ports/maxscale/work/MaxScale-22.08.1/maxutils/maxbase/include -Iwork/code/FreeBSD-Ports/maxscale/work/MaxScale-22.08.1/maxutils/maxsql/include -Iwork/code/FreeBSD-Ports/maxscale/work/MaxScale-22.08.1/maxutils/maxsimd/include -I/usr/local/include/libxml2 -pipe -g -fstack-protector-strong -fno-strict-aliasing -rdynamic -fno-omit-frame-pointer -Wall -Wno-unused-variable -Wno-unused-function -Wno-unused-result -fPIC -Wno-deprecated-declarations -Wsuggest-override -pipe -g -fstack-protector-strong -fno-strict-aliasing -ggdb -pthread -pipe -Wformat -fstack-protector --param=ssp-buffer-size=4 -DSS_DEBUG -DLOG_ASSERT -std=gnu++17 -MD -MT maxutils/maxbase/src/CMakeFiles/maxbase.dir/filesystem.cc.o -MF CMakeFiles/maxbase.dir/filesystem.cc.o.d -o CMakeFiles/maxbase.dir/filesystem.cc.o -c work/code/FreeBSD-Ports/maxscale/work/MaxScale-22.08.1/maxutils/maxbase/src/filesystem.cc
c++: warning: argument unused during compilation: '-rdynamic' [-Wunused-command-line-argument]
In file included from work/code/FreeBSD-Ports/maxscale/work/MaxScale-22.08.1/maxutils/maxbase/src/filesystem.cc:14:
In file included from work/code/FreeBSD-Ports/maxscale/work/MaxScale-22.08.1/maxutils/maxbase/include/maxbase/filesystem.hh:18:
work/code/FreeBSD-Ports/maxscale/work/MaxScale-22.08.1/maxutils/maxbase/include/maxbase/string.hh:126:41: error: no member named 'ptr_fun' in namespace 'std'
                         std::not1(std::ptr_fun<int, int>(std::isspace))));
                                   ~~~~~^
work/code/FreeBSD-Ports/maxscale/work/MaxScale-22.08.1/maxutils/maxbase/include/maxbase/string.hh:126:52: error: expected '(' for function-style cast or type construction
                         std::not1(std::ptr_fun<int, int>(std::isspace))));
                                                ~~~^
work/code/FreeBSD-Ports/maxscale/work/MaxScale-22.08.1/maxutils/maxbase/include/maxbase/string.hh:126:57: error: expected '(' for function-style cast or type construction
                         std::not1(std::ptr_fun<int, int>(std::isspace))));
                                                     ~~~^
work/code/FreeBSD-Ports/maxscale/work/MaxScale-22.08.1/maxutils/maxbase/include/maxbase/string.hh:138:41: error: no member named 'ptr_fun' in namespace 'std'
                         std::not1(std::ptr_fun<int, int>(std::isspace))).base(),
                                   ~~~~~^
work/code/FreeBSD-Ports/maxscale/work/MaxScale-22.08.1/maxutils/maxbase/include/maxbase/string.hh:138:52: error: expected '(' for function-style cast or type construction
                         std::not1(std::ptr_fun<int, int>(std::isspace))).base(),
                                                ~~~^
work/code/FreeBSD-Ports/maxscale/work/MaxScale-22.08.1/maxutils/maxbase/include/maxbase/string.hh:138:57: error: expected '(' for function-style cast or type construction
                         std::not1(std::ptr_fun<int, int>(std::isspace))).base(),
                                                     ~~~^



 Comments   
Comment by Johan Wikman [ 2022-10-10 ]

22.08 is built with C++17, so you need to turn on that first. Officially we only support Linux, but if you fix things for FreeBSD and make a pull-request we may accept it, provided it does not break the Linux build. However, these are rather minor issues compared to the fact that MaxScale relies upon epoll that to the best of my knowledge is not available on FreeBSD.

Comment by Johan Wikman [ 2022-10-11 ]

We only support Linux. Pull-requests may be accepted provided they do not break the Linux build.

Generated at Thu Feb 08 04:27:57 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.