Arch Linux ARM armv6h does not compile

Hi,

I want to install homegear on a raspberry pi armv6h. Therefore I have downloaded the package from AUR and modified the PKBUILD to support armv6h.

During the build I recevie errors that

error: ‘function’ in namespace ‘std’ does not name a template type
or
error: ‘std::function’ has not been declared

I don’t know whats wrong here because -std=c++11 is set ?!?

checking for strchr... yes
checking for strerror... yes
checking for strstr... yes
checking for strtol... yes
checking that generated files are newer than configure... done
configure: creating ./config.status
config.status: creating Makefile
config.status: creating src/Makefile
config.status: creating config.h
config.status: executing depfiles commands
config.status: executing libtool commands
make  all-recursive
make[1]: Entering directory '/tmp/libhomegear-base-git/src/libhomegear-base'
Making all in src
make[2]: Entering directory '/tmp/libhomegear-base-git/src/libhomegear-base/src'
depbase=`echo BaseLib.lo | sed 's|[^/]*$|.deps/&|;s|\.lo$||'`;\
/bin/sh ../libtool  --tag=CXX   --mode=compile g++ -DHAVE_CONFIG_H -I. -I..  -Wall -std=c++11 -DFORTIFY_SOURCE=2 -DGCRYPT_NO_DEPRECATED -D_FORTIFY_SOURCE=2 -DLINUXSYSTEM  -march=armv6 -mfloat-abi=hard -mfpu=vfp -O2 -pipe -fstack-protector --param=ssp-buffer-size=4 -MT BaseLib.lo -MD -MP -MF $depbase.Tpo -c -o BaseLib.lo BaseLib.cpp &&\
mv -f $depbase.Tpo $depbase.Plo
libtool: compile:  g++ -DHAVE_CONFIG_H -I. -I.. -Wall -std=c++11 -DFORTIFY_SOURCE=2 -DGCRYPT_NO_DEPRECATED -D_FORTIFY_SOURCE=2 -DLINUXSYSTEM -march=armv6 -mfloat-abi=hard -mfpu=vfp -O2 -pipe -fstack-protector --param=ssp-buffer-size=4 -MT BaseLib.lo -MD -MP -MF .deps/BaseLib.Tpo -c BaseLib.cpp  -fPIC -DPIC -o .libs/BaseLib.o
In file included from Encoding/XmlrpcEncoder.h:38:0,
                from BaseLib.h:37,
                from BaseLib.cpp:31:
Encoding/../Output/Output.h:97:7: error: 'function' in namespace 'std' does not name a template type
  std::function<void(int32_t, std::string)>* getErrorCallback();
      ^~~~~~~~
In file included from Encoding/XmlrpcEncoder.h:38:0,
                from BaseLib.h:37,
                from BaseLib.cpp:31:
Encoding/../Output/Output.h:104:29: error: 'std::function' has not been declared
  void setErrorCallback(std::function<void(int32_t, std::string)>* errorCallback);
                            ^~~~~~~~
Encoding/../Output/Output.h:104:37: error: expected ',' or '...' before '<' token
  void setErrorCallback(std::function<void(int32_t, std::string)>* errorCallback);
                                    ^
Encoding/../Output/Output.h:247:7: error: 'function' in namespace 'std' does not name a template type
  std::function<void(int32_t, std::string)>* _errorCallback = nullptr;
      ^~~~~~~~
In file included from BaseLib.h:62:0,
                from BaseLib.cpp:31:
ScriptEngine/ScriptInfo.h:102:7: error: 'function' in namespace 'std' does not name a template type
  std::function<void(PScriptInfo& scriptInfo, std::string& output)> scriptOutputCallback;
      ^~~~~~~~
ScriptEngine/ScriptInfo.h:103:7: error: 'function' in namespace 'std' does not name a template type
  std::function<void(PScriptInfo& scriptInfo, PVariable& headers)> scriptHeadersCallback;
      ^~~~~~~~
ScriptEngine/ScriptInfo.h:107:8: error: 'function' in namespace 'std' does not name a template type
  std::function<void(PScriptInfo& scriptInfo, int32_t exitCode)> scriptFinishedCallback;
        ^~~~~~~~
In file included from BaseLib.cpp:31:0:
BaseLib.h:189:29: error: 'std::function' has not been declared
  void setErrorCallback(std::function<void(int32_t, std::string)>* errorCallback);
                            ^~~~~~~~
BaseLib.h:189:37: error: expected ',' or '...' before '<' token
  void setErrorCallback(std::function<void(int32_t, std::string)>* errorCallback);
                                    ^
BaseLib.cpp:60:43: error: variable or field 'setErrorCallback' declared void
void SharedObjects::setErrorCallback(std::function<void(int32_t, std::string)>* errorCallback)
                                          ^~~~~~~~
BaseLib.cpp:60:43: error: 'function' is not a member of 'std'
BaseLib.cpp:60:43: note: suggested alternative: 'is_function'
void SharedObjects::setErrorCallback(std::function<void(int32_t, std::string)>* errorCallback)
                                          ^~~~~~~~
                                          is_function
BaseLib.cpp:60:77: error: expression list treated as compound expression in functional cast [-fpermissive]
void SharedObjects::setErrorCallback(std::function<void(int32_t, std::string)>* errorCallback)
                                                                            ^
BaseLib.cpp:60:52: error: expected primary-expression before 'void'
void SharedObjects::setErrorCallback(std::function<void(int32_t, std::string)>* errorCallback)
                                                    ^~~~
make[2]: *** [Makefile:869: BaseLib.lo] Error 1
make[2]: Leaving directory '/tmp/libhomegear-base-git/src/libhomegear-base/src'
make[1]: *** [Makefile:403: all-recursive] Error 1
make[1]: Leaving directory '/tmp/libhomegear-base-git/src/libhomegear-base'
make: *** [Makefile:335: all] Error 2
==> ERROR: A failure occurred in build().
    Aborting...
[alarm@alarmpi libhomegear-base-git]$ gcc --version
gcc (GCC) 7.1.1 20170516
Copyright (C) 2017 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

Ok found the solution, #include is missing in two places. Maybe a requirement in gcc 7.x onwards.

    diff -ura -x index libhomegear-base1/src/Output/Output.h libhomegear-base2/src/Output/Output.h
--- libhomegear-base1/src/Output/Output.h       2017-07-02 15:53:44.728587304 +0200
+++ libhomegear-base2/src/Output/Output.h       2017-07-02 15:54:38.417475653 +0200
@@ -33,6 +33,7 @@

#include "../Exception.h"

+#include <functional>
#include <iostream>
#include <iomanip>
#include <string>
diff -ura -x index libhomegear-base1/src/ScriptEngine/ScriptInfo.h libhomegear-base2/src/ScriptEngine/ScriptInfo.h
--- libhomegear-base1/src/ScriptEngine/ScriptInfo.h     2017-07-02 15:53:44.728587304 +0200
+++ libhomegear-base2/src/ScriptEngine/ScriptInfo.h     2017-07-02 16:20:07.070541012 +0200
@@ -34,6 +34,7 @@
#include "../Sockets/ServerInfo.h"
#include "../Encoding/Http.h"

+#include <functional>
#include <string>
#include <mutex>
#include <condition_variable>

Hi @pheinrich,

thanks. I added the includes in the repository now, too.

Cheers,

Sathya