starpu-runtime / starpu

This is a mirror of https://gitlab.inria.fr/starpu/starpu where our development happens, but contributions are welcome here too!
https://starpu.gitlabpages.inria.fr/
GNU Lesser General Public License v2.1
58 stars 13 forks source link

Building 1.4.0 fails on 10.6: error: 'HOST_NAME_MAX' undeclared #15

Closed barracuda156 closed 1 year ago

barracuda156 commented 1 year ago
:info:build In file included from ../include/starpu_profiling.h:218,
:info:build                  from ../include/starpu.h:79,
:info:build                  from core/sched_policy.c:20:
:info:build core/sched_policy.c: In function 'load_sched_lib':
:info:build ./common/utils.h:126:50: error: 'HOST_NAME_MAX' undeclared (first use in this function); did you mean 'NAME_MAX'?
:info:build   126 | #define _STARPU_MSG(fmt, ...) do { char _msghost[HOST_NAME_MAX]; gethostname(_msghost, HOST_NAME_MAX); fprintf(stderr, STARPU_DEBUG_PREFIX"[%s][%s] " fmt, _msghost, __starpu_func__, ## __VA_ARGS__); } while(0)
:info:build       |                                                  ^~~~~~~~~~~~~
:info:build core/sched_policy.c:162:25: note: in expansion of macro '_STARPU_MSG'
:info:build   162 |                         _STARPU_MSG("Warning: scheduling dynamic library '%s' can not be loaded\n", sched_lib);
:info:build       |                         ^~~~~~~~~~~
:info:build ./common/utils.h:126:50: note: each undeclared identifier is reported only once for each function it appears in
:info:build   126 | #define _STARPU_MSG(fmt, ...) do { char _msghost[HOST_NAME_MAX]; gethostname(_msghost, HOST_NAME_MAX); fprintf(stderr, STARPU_DEBUG_PREFIX"[%s][%s] " fmt, _msghost, __starpu_func__, ## __VA_ARGS__); } while(0)
:info:build       |                                                  ^~~~~~~~~~~~~
:info:build core/sched_policy.c:162:25: note: in expansion of macro '_STARPU_MSG'
:info:build   162 |                         _STARPU_MSG("Warning: scheduling dynamic library '%s' can not be loaded\n", sched_lib);
:info:build       |                         ^~~~~~~~~~~
:info:build ./common/utils.h:126:41: warning: unused variable '_msghost' [-Wunused-variable]
:info:build   126 | #define _STARPU_MSG(fmt, ...) do { char _msghost[HOST_NAME_MAX]; gethostname(_msghost, HOST_NAME_MAX); fprintf(stderr, STARPU_DEBUG_PREFIX"[%s][%s] " fmt, _msghost, __starpu_func__, ## __VA_ARGS__); } while(0)
:info:build       |                                         ^~~~~~~~
:info:build core/sched_policy.c:162:25: note: in expansion of macro '_STARPU_MSG'
:info:build   162 |                         _STARPU_MSG("Warning: scheduling dynamic library '%s' can not be loaded\n", sched_lib);
:info:build       |                         ^~~~~~~~~~~
:info:build core/sched_policy.c: In function 'find_sched_policy_from_name':
:info:build ./common/utils.h:126:50: error: 'HOST_NAME_MAX' undeclared (first use in this function); did you mean 'NAME_MAX'?
:info:build   126 | #define _STARPU_MSG(fmt, ...) do { char _msghost[HOST_NAME_MAX]; gethostname(_msghost, HOST_NAME_MAX); fprintf(stderr, STARPU_DEBUG_PREFIX"[%s][%s] " fmt, _msghost, __starpu_func__, ## __VA_ARGS__); } while(0)
:info:build       |                                                  ^~~~~~~~~~~~~
:info:build core/sched_policy.c:187:25: note: in expansion of macro '_STARPU_MSG'
:info:build   187 |                         _STARPU_MSG("Warning: the library '%s' does not define the function 'starpu_get_sched_lib_policy' (error '%s')\n", sched_lib, dlerror());
:info:build       |                         ^~~~~~~~~~~
:info:build ./common/utils.h:126:41: warning: unused variable '_msghost' [-Wunused-variable]
:info:build   126 | #define _STARPU_MSG(fmt, ...) do { char _msghost[HOST_NAME_MAX]; gethostname(_msghost, HOST_NAME_MAX); fprintf(stderr, STARPU_DEBUG_PREFIX"[%s][%s] " fmt, _msghost, __starpu_func__, ## __VA_ARGS__); } while(0)
:info:build       |                                         ^~~~~~~~
:info:build core/sched_policy.c:187:25: note: in expansion of macro '_STARPU_MSG'
:info:build   187 |                         _STARPU_MSG("Warning: the library '%s' does not define the function 'starpu_get_sched_lib_policy' (error '%s')\n", sched_lib, dlerror());
:info:build       |                         ^~~~~~~~~~~
:info:build ./common/utils.h:126:41: warning: unused variable '_msghost' [-Wunused-variable]
:info:build   126 | #define _STARPU_MSG(fmt, ...) do { char _msghost[HOST_NAME_MAX]; gethostname(_msghost, HOST_NAME_MAX); fprintf(stderr, STARPU_DEBUG_PREFIX"[%s][%s] " fmt, _msghost, __starpu_func__, ## __VA_ARGS__); } while(0)
:info:build       |                                         ^~~~~~~~
:info:build core/sched_policy.c:207:17: note: in expansion of macro '_STARPU_MSG'
:info:build   207 |                 _STARPU_MSG("Warning: heft is now called \"dmda\".\n");
:info:build       |                 ^~~~~~~~~~~
:info:build ./common/utils.h:126:41: warning: unused variable '_msghost' [-Wunused-variable]
:info:build   126 | #define _STARPU_MSG(fmt, ...) do { char _msghost[HOST_NAME_MAX]; gethostname(_msghost, HOST_NAME_MAX); fprintf(stderr, STARPU_DEBUG_PREFIX"[%s][%s] " fmt, _msghost, __starpu_func__, ## __VA_ARGS__); } while(0)
:info:build       |                                         ^~~~~~~~
:info:build core/sched_policy.c:228:9: note: in expansion of macro '_STARPU_MSG'
:info:build   228 |         _STARPU_MSG("Warning: scheduling policy '%s' was not found, try 'help' to get a list\n", policy_name);
:info:build       |         ^~~~~~~~~~~
:info:build core/sched_policy.c: In function '_starpu_push_task_to_workers':
:info:build ./common/utils.h:126:50: error: 'HOST_NAME_MAX' undeclared (first use in this function); did you mean 'NAME_MAX'?
:info:build   126 | #define _STARPU_MSG(fmt, ...) do { char _msghost[HOST_NAME_MAX]; gethostname(_msghost, HOST_NAME_MAX); fprintf(stderr, STARPU_DEBUG_PREFIX"[%s][%s] " fmt, _msghost, __starpu_func__, ## __VA_ARGS__); } while(0)
:info:build       |                                                  ^~~~~~~~~~~~~
barracuda156 commented 1 year ago

Looks like this works:

#ifndef HOST_NAME_MAX
#define HOST_NAME_MAX 256
#endif

Borrowed from sys/param.h:

#define MAXHOSTNAMELEN  256     /* max hostname size */

See: https://lists.gnu.org/archive/html/bug-gnulib/2009-08/msg00108.html

sthibaul commented 1 year ago

Yes, we fixed it with 19e5f9cc321623569c9aeb67794012bfcf2cc7c2

barracuda156 commented 1 year ago

Yes, we fixed it with 19e5f9c

Thank you, great! I will borrow the patch.

There is another problem now, with missing libatomic linking: https://github.com/starpu-runtime/starpu/issues/16 (Those also look like ancient versions, modern GCC uses atomic* ones. I will verify if sync* still work or not.)