#61990 closed defect (fixed)
xdotool: error: implicit declaration of function 'strdup' is invalid in C99
Reported by: | iay (Ian Young) | Owned by: | ryandesign (Ryan Carsten Schmidt) |
---|---|---|---|
Priority: | Normal | Milestone: | |
Component: | ports | Version: | 2.6.4 |
Keywords: | catalina bigsur | Cc: | |
Port: | xdotool |
Description
Under:
:debug:sysinfo macOS 11.1 (darwin/20.2.0) arch i386 :debug:sysinfo MacPorts 2.6.4 :debug:sysinfo Xcode 12.3 :debug:sysinfo SDK 11.1 :debug:sysinfo MACOSX_DEPLOYMENT_TARGET: 11.1
Compilation of xdotool fails with:
:info:build xdo.c:1365:26: error: implicit declaration of function 'strdup' is invalid in C99 [-Werror,-Wimplicit-function-declaration] :info:build keyseq_copy = strptr = strdup(keyseq); :info:build ^
I think this is down to strdup not being part of ANSI C / C99, but being part of POSIX. In the string.h header:
#if __DARWIN_C_LEVEL >= 200112L __BEGIN_DECLS int strerror_r(int __errnum, char *__strerrbuf, size_t __buflen); char *strdup(const char *__s1); void *memccpy(void *__dst, const void *__src, int __c, size_t __n); __END_DECLS #endif /* __DARWIN_C_LEVEL >= 200112L */
My knowledge of C is pretty old, though, so I'm not sure how you would begin to fix this. Happily I don't have a current need for this port under Big Sur.
Change History (4)
comment:1 Changed 4 years ago by jmroot (Joshua Root)
Owner: | set to ryandesign |
---|---|
Status: | new → assigned |
comment:2 Changed 4 years ago by ryandesign (Ryan Carsten Schmidt)
Keywords: | catalina bigsur added |
---|---|
Summary: | xdotool does not compile on Big Sur → xdotool: error: implicit declaration of function 'strdup' is invalid in C99 |
comment:3 Changed 4 years ago by ryandesign (Ryan Carsten Schmidt)
Resolution: | → fixed |
---|---|
Status: | assigned → closed |
comment:4 Changed 4 years ago by ryandesign (Ryan Carsten Schmidt)
I've reported the problem to the developers here:
Note: See
TracTickets for help on using
tickets.
Thanks for reporting this.
Many ports fail to build with Xcode 12 with implicit function declaration errors. They need to be fixed by including the function before using it, for example by including the header where the function is defined. We fix these issues as we find them and as we can get around to it.