Opened 4 years ago
Closed 4 years ago
#61145 closed defect (fixed)
libvterm @0.1.2:error: implicit declaration of function 'strdup' is invalid in C99
Reported by: | keke-cute (小可可可爱多) | Owned by: | raimue (Rainer Müller) |
---|---|---|---|
Priority: | Normal | Milestone: | |
Component: | ports | Version: | 2.6.99 |
Keywords: | Cc: | keke-cute (小可可可爱多), chrstphrchvz (Christopher Chavez) | |
Port: | libvterm |
Description
---> Building libvterm Executing: cd "/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_devel_libvterm/libvterm/work/libvterm-0.1.2" && /usr/bin/make -j4 -w all PREFIX=/opt/local make: Entering directory `/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_devel_libvterm/libvterm/work/libvterm-0.1.2' CC bin/vterm-ctrl.c bin/vterm-ctrl.c:117:10: error: implicit declaration of function 'strdup' is invalid in C99 [-Werror,-Wimplicit-function-declaration] return strdup(csi); ^ bin/vterm-ctrl.c:117:10: note: did you mean 'strcmp'? /Applications/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX11.0.sdk/usr/include/string.h:77:6: note: 'strcmp' declared here int strcmp(const char *__s1, const char *__s2); ^ bin/vterm-ctrl.c:117:10: warning: incompatible integer to pointer conversion returning 'int' from a function with result type 'char *' [-Wint-conversion] return strdup(csi); ^~~~~~~~~~~ bin/vterm-ctrl.c:142:10: error: implicit declaration of function 'strdup' is invalid in C99 [-Werror,-Wimplicit-function-declaration] return strdup(dcs); ^ bin/vterm-ctrl.c:142:10: warning: incompatible integer to pointer conversion returning 'int' from a function with result type 'char *' [-Wint-conversion] return strdup(dcs); ^~~~~~~~~~~ bin/vterm-ctrl.c:129:10: warning: result of comparison of constant 156 with expression of type 'char' is always false [-Wtautological-constant-out-of-range-compare] if(c == 0x9c) // ST ~ ^ ~~~~ 3 warnings and 2 errors generated. make: *** [bin/vterm-ctrl] Error 1 make: Leaving directory `/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_devel_libvterm/libvterm/work/libvterm-0.1.2' Command failed: cd "/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_devel_libvterm/libvterm/work/libvterm-0.1.2" && /usr/bin/make -j4 -w all PREFIX=/opt/local Exit code: 2 Error: Failed to build libvterm: command execution failed
Change History (12)
comment:1 Changed 4 years ago by keke-cute (小可可可爱多)
Cc: | keke-cute added |
---|
comment:3 Changed 4 years ago by mf2k (Frank Schima)
Cc: | raimue removed |
---|---|
Owner: | set to raimue |
Status: | new → assigned |
comment:4 Changed 4 years ago by jmroot (Joshua Root)
It's defining _XOPEN_SOURCE to 500 which is too low to make strdup visible. The upstream fix is https://bazaar.launchpad.net/~libvterm/libvterm/trunk/revision/769 and https://bazaar.launchpad.net/~libvterm/libvterm/trunk/revision/770 which effectively just change it to 600.
comment:5 Changed 4 years ago by kencu (Ken)
apple bug? it seems it should be available with a setting of 500...
comment:6 Changed 4 years ago by jmroot (Joshua Root)
No I think it's correct. Setting _XOPEN_SOURCE to 500 is equivalent to setting _POSIX_C_SOURCE to 199506, and strdup was only added to POSIX in POSIX.1-2001. Before that, strdup was an X/Open extension, and you had to define _XOPEN_SOURCE_EXTENDED to use it on systems that implemented those extensions. Understandably, Apple only implements the POSIX requirements and _XOPEN_SOURCE_EXTENDED does nothing on current macOS.
I would assume previous versions of clang were letting the implicit declaration through with a warning.
comment:7 Changed 4 years ago by kencu (Ken)
I don't know... <https://man7.org/linux/man-pages/man3/strdup.3.html>
Feature Test Macro Requirements for glibc (see feature_test_macros(7)): strdup(): _XOPEN_SOURCE >= 500 || /* Since glibc 2.12: */ _POSIX_C_SOURCE >= 200809L || /* Glibc versions <= 2.19: */ _BSD_SOURCE || _SVID_SOURCE
comment:8 Changed 4 years ago by jmroot (Joshua Root)
Well, I guess you can open a bug with Apple if you think they are interpreting the standards wrong. But as far as macOS is concerned, it's been this way since 10.7: <https://opensource.apple.com/source/Libc/Libc-763.11/include/string.h.auto.html>
comment:10 Changed 4 years ago by chrstphrchvz (Christopher Chavez)
PR opened to update to 0.1.4: https://github.com/macports/macports-ports/pull/8506
comment:11 Changed 4 years ago by chrstphrchvz (Christopher Chavez)
Cc: | chrstphrchvz added |
---|
comment:12 Changed 4 years ago by chrstphrchvz (Christopher Chavez)
Resolution: | → fixed |
---|---|
Status: | assigned → closed |