Opened 22 months ago

Closed 22 months ago

Last modified 21 months ago

#65491 closed defect (fixed)

clex @4.6.patch10: implicit declaration of functions

Reported by: bryanchow (Bryan Chow) Owned by: ryandesign (Ryan Carsten Schmidt)
Priority: Normal Milestone:
Component: ports Version: 2.7.2
Keywords: catalina bigsur monterey Cc:
Port: clex

Description

clex fails to build for me on Big Sur.

$ sudo port install clex
--->  Computing dependencies for clex
--->  Fetching archive for clex
--->  Attempting to fetch clex-4.6.patch10_0.darwin_20.arm64.tbz2 from https://packages.macports.org/clex
--->  Attempting to fetch clex-4.6.patch10_0.darwin_20.arm64.tbz2 from https://ywg.ca.packages.macports.org/mirror/macports/packages/clex
--->  Attempting to fetch clex-4.6.patch10_0.darwin_20.arm64.tbz2 from https://kmq.jp.packages.macports.org/clex
--->  Building clex
Error: Failed to build clex: command execution failed
Error: See /opt/local/var/macports/logs/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_sysutils_clex/clex/main.log for details.
Error: Follow https://guide.macports.org/#project.tickets if you believe there is a bug.
Error: Processing of port clex failed

main.log:

version:1
:debug:main Starting logging for clex @4.6.patch10_0
:debug:sysinfo macOS 11.6.7 (darwin/20.6.0) arch arm
:debug:sysinfo MacPorts 2.7.2
:debug:sysinfo Xcode 13.2.1
:debug:sysinfo SDK 11
:debug:sysinfo MACOSX_DEPLOYMENT_TARGET: 11.0
:debug:main epoch: in tree: 0 installed: 0
:debug:main ncurses 6.3_0 exists in the ports tree
:debug:main ncurses 6.3_0  is the latest installed
:debug:main ncurses 6.3_0  is active
:debug:main Merging existing requested variants '' into variants
:debug:main new fully merged portvariants: 
:debug:main Changing to port directory: /opt/local/var/macports/sources/rsync.macports.org/macports/release/tarballs/ports/devel/ncurses
:debug:main OS darwin/20.6.0 (macOS 11.6.7) arch arm
:debug:main Sourcing PortGroup clang_dependency 1.0 from /opt/local/var/macports/sources/rsync.macports.org/macports/release/tarballs/ports/_resources/port1.0/group/clang_dependency-1.0.tcl
:debug:main adding the default universal variant
:debug:main Reading variant descriptions from /opt/local/var/macports/sources/rsync.macports.org/macports/release/tarballs/ports/_resources/port1.0/variant_descriptions.conf
:debug:main Running callback portconfigure::add_automatic_compiler_dependencies
:debug:main Finished running callback portconfigure::add_automatic_compiler_dependencies
:debug:main Running callback portbuild::add_automatic_buildsystem_dependencies
:debug:main Finished running callback portbuild::add_automatic_buildsystem_dependencies
:debug:main Running callback portstartupitem::add_notes
:debug:main Finished running callback portstartupitem::add_notes
:debug:main No need to upgrade! ncurses 6.3_0 >= ncurses 6.3_0
:msg:main --->  Computing dependencies for clex:info:main .:debug:main clex has no conflicts
:debug:main Searching for dependency: ncurses
:debug:main Found Dependency: receipt exists for ncurses
:debug:main Executing org.macports.main (clex)
:debug:main dropping privileges: euid changed to 502, egid changed to 501.
:debug:archivefetch archivefetch phase started at Fri Jul 15 13:12:04 PDT 2022
:msg:archivefetch --->  Fetching archive for clex
:debug:archivefetch Executing org.macports.archivefetch (clex)
:debug:archivefetch euid/egid changed to: 0/0
:debug:archivefetch chowned /opt/local/var/macports/incoming to macports
:debug:archivefetch euid/egid changed to: 502/501
:info:archivefetch --->  clex-4.6.patch10_0.darwin_20.arm64.tbz2 doesn't seem to exist in /opt/local/var/macports/incoming/verified
:msg:archivefetch --->  Attempting to fetch clex-4.6.patch10_0.darwin_20.arm64.tbz2 from https://packages.macports.org/clex
:debug:archivefetch Fetching archive failed: The requested URL returned error: 404 
:msg:archivefetch --->  Attempting to fetch clex-4.6.patch10_0.darwin_20.arm64.tbz2 from https://ywg.ca.packages.macports.org/mirror/macports/packages/clex
:debug:archivefetch Fetching archive failed: The requested URL returned error: 404 Not Found
:msg:archivefetch --->  Attempting to fetch clex-4.6.patch10_0.darwin_20.arm64.tbz2 from https://kmq.jp.packages.macports.org/clex
:debug:archivefetch Fetching archive failed: The requested URL returned error: 404 Not Found
:debug:archivefetch Privilege de-escalation not attempted as not running as root.
:debug:archivefetch Skipping completed org.macports.fetch (clex)
:debug:archivefetch Privilege de-escalation not attempted as not running as root.
:debug:archivefetch Skipping completed org.macports.checksum (clex)
:debug:archivefetch Privilege de-escalation not attempted as not running as root.
:debug:archivefetch Skipping completed org.macports.extract (clex)
:debug:archivefetch Privilege de-escalation not attempted as not running as root.
:debug:archivefetch Skipping completed org.macports.patch (clex)
:debug:archivefetch Privilege de-escalation not attempted as not running as root.
:debug:archivefetch Skipping completed org.macports.configure (clex)
:debug:archivefetch Privilege de-escalation not attempted as not running as root.
:debug:build build phase started at Fri Jul 15 13:12:08 PDT 2022
:notice:build --->  Building clex
:debug:build Executing org.macports.build (clex)
:debug:build Environment: 
:debug:build CC_PRINT_OPTIONS='YES'
:debug:build CC_PRINT_OPTIONS_FILE='/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_sysutils_clex/clex/work/.CC_PRINT_OPTIONS'
:debug:build CPATH='/opt/local/include'
:debug:build DEVELOPER_DIR='/Library/Developer/CommandLineTools'
:debug:build LIBRARY_PATH='/opt/local/lib'
:debug:build MACOSX_DEPLOYMENT_TARGET='11.0'
:debug:build SDKROOT='/Library/Developer/CommandLineTools/SDKs/MacOSX11.sdk'
:info:build Executing:  cd "/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_sysutils_clex/clex/work/clex-4.6.patch10" && /usr/bin/make -j8 -w all 
:debug:build system:  cd "/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_sysutils_clex/clex/work/clex-4.6.patch10" && /usr/bin/make -j8 -w all 
:info:build make: Entering directory `/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_sysutils_clex/clex/work/clex-4.6.patch10'
:info:build /Library/Developer/CommandLineTools/usr/bin/make  all-recursive
:info:build make[1]: Entering directory `/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_sysutils_clex/clex/work/clex-4.6.patch10'
:info:build Making all in src
:info:build make[2]: Entering directory `/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_sysutils_clex/clex/work/clex-4.6.patch10/src'
:info:build /Library/Developer/CommandLineTools/usr/bin/make  all-am
:info:build make[3]: Entering directory `/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_sysutils_clex/clex/work/clex-4.6.patch10/src'
:info:build /usr/bin/clang -DHAVE_CONFIG_H -I. -I..   -I/opt/local/include -isysroot/Library/Developer/CommandLineTools/SDKs/MacOSX11.sdk  -pipe -Os -isysroot/Library/Developer/CommandLineTools/SDKs/MacOSX11.sdk -arch arm64 -Wall -pedantic -MT inout.o -MD -MP -MF .deps/inout.Tpo -c -o inout.o inout.c
:info:build /usr/bin/clang -DHAVE_CONFIG_H -I. -I..   -I/opt/local/include -isysroot/Library/Developer/CommandLineTools/SDKs/MacOSX11.sdk  -pipe -Os -isysroot/Library/Developer/CommandLineTools/SDKs/MacOSX11.sdk -arch arm64 -Wall -pedantic -MT mouse.o -MD -MP -MF .deps/mouse.Tpo -c -o mouse.o mouse.c
:info:build /usr/bin/clang -DHAVE_CONFIG_H -I. -I..   -I/opt/local/include -isysroot/Library/Developer/CommandLineTools/SDKs/MacOSX11.sdk  -pipe -Os -isysroot/Library/Developer/CommandLineTools/SDKs/MacOSX11.sdk -arch arm64 -Wall -pedantic -MT panel.o -MD -MP -MF .deps/panel.Tpo -c -o panel.o panel.c
:info:build /usr/bin/clang -DHAVE_CONFIG_H -I. -I..   -I/opt/local/include -isysroot/Library/Developer/CommandLineTools/SDKs/MacOSX11.sdk  -pipe -Os -isysroot/Library/Developer/CommandLineTools/SDKs/MacOSX11.sdk -arch arm64 -Wall -pedantic -MT preview.o -MD -MP -MF .deps/preview.Tpo -c -o preview.o preview.c
:info:build /usr/bin/clang -DHAVE_CONFIG_H -I. -I..   -I/opt/local/include -isysroot/Library/Developer/CommandLineTools/SDKs/MacOSX11.sdk  -pipe -Os -isysroot/Library/Developer/CommandLineTools/SDKs/MacOSX11.sdk -arch arm64 -Wall -pedantic -MT rename.o -MD -MP -MF .deps/rename.Tpo -c -o rename.o rename.c
:info:build /usr/bin/clang -DHAVE_CONFIG_H -I. -I..   -I/opt/local/include -isysroot/Library/Developer/CommandLineTools/SDKs/MacOSX11.sdk  -pipe -Os -isysroot/Library/Developer/CommandLineTools/SDKs/MacOSX11.sdk -arch arm64 -Wall -pedantic -MT sdstring.o -MD -MP -MF .deps/sdstring.Tpo -c -o sdstring.o sdstring.c
:info:build /usr/bin/clang -DHAVE_CONFIG_H -I. -I..   -I/opt/local/include -isysroot/Library/Developer/CommandLineTools/SDKs/MacOSX11.sdk  -pipe -Os -isysroot/Library/Developer/CommandLineTools/SDKs/MacOSX11.sdk -arch arm64 -Wall -pedantic -MT select.o -MD -MP -MF .deps/select.Tpo -c -o select.o select.c
:info:build /usr/bin/clang -DHAVE_CONFIG_H -I. -I..   -I/opt/local/include -isysroot/Library/Developer/CommandLineTools/SDKs/MacOSX11.sdk  -pipe -Os -isysroot/Library/Developer/CommandLineTools/SDKs/MacOSX11.sdk -arch arm64 -Wall -pedantic -MT signals.o -MD -MP -MF .deps/signals.Tpo -c -o signals.o signals.c
:info:build inout.c:577:11: error: implicit declaration of function 'get_wch' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
:info:build                         type = get_wch(&kinp.key);
:info:build                                ^
:info:build inout.c:843:5: error: implicit declaration of function 'addnwstr' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
:info:build                                 addnwstr(str,i);
:info:build                                 ^
:info:build inout.c:843:5: note: did you mean 'addnstr'?
:info:build /opt/local/include/curses.h:609:28: note: 'addnstr' declared here
:info:build extern NCURSES_EXPORT(int) addnstr (const char *, int);                 /* generated */
:info:build                            ^
:info:build inout.c:851:3: error: implicit declaration of function 'addnwstr' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
:info:build                 addnwstr(str,i);
:info:build                 ^
:info:build inout.c:907:32: warning: unknown warning group '-Wunused-but-set-variable', ignored [-Wunknown-warning-option]
:info:build #pragma GCC diagnostic ignored "-Wunused-but-set-variable"
:info:build                                ^
:info:build inout.c:1058:2: error: implicit declaration of function 'addwstr' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
:info:build         addwstr(msg);
:info:build         ^
:info:build inout.c:1143:3: error: implicit declaration of function 'addwstr' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
:info:build                 addwstr(label);
:info:build                 ^
:info:build inout.c:1202:4: error: implicit declaration of function 'addnwstr' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
:info:build                         addnwstr(&ch,1);
:info:build                         ^
:info:build inout.c:1322:6: error: implicit declaration of function 'addwstr' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
:info:build                                         addwstr(wtxt + i);
:info:build                                         ^
:info:build inout.c:1326:6: error: implicit declaration of function 'addwstr' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
:info:build                                         addwstr(wtxt);
:info:build                                         ^
:info:build inout.c:1386:5: error: implicit declaration of function 'addwstr' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
:info:build                                 addwstr(panel_compl.aux);
:info:build                                 ^
:info:build inout.c:1565:5: error: implicit declaration of function 'addwstr' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
:info:build                                 addwstr(USTR(textline->prompt));
:info:build                                 ^
:info:build inout.c:1630:2: error: implicit declaration of function 'addwstr' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
:info:build         addwstr(tag);
:info:build         ^
:info:build inout.c:1722:2: error: implicit declaration of function 'addwstr' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
:info:build         addwstr(description[ln]);
:info:build         ^
:info:build inout.c:1851:3: error: implicit declaration of function 'addwstr' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
:info:build                 addwstr(failstr);
:info:build                 ^
:info:build 1 warning and 13 errors generated.
:info:build make[3]: *** [inout.o] Error 1
:info:build make[3]: *** Waiting for unfinished jobs....
:info:build mv -f .deps/mouse.Tpo .deps/mouse.Po
:info:build mv -f .deps/signals.Tpo .deps/signals.Po
:info:build mv -f .deps/select.Tpo .deps/select.Po
:info:build mv -f .deps/sdstring.Tpo .deps/sdstring.Po
:info:build mv -f .deps/preview.Tpo .deps/preview.Po
:info:build mv -f .deps/rename.Tpo .deps/rename.Po
:info:build mv -f .deps/panel.Tpo .deps/panel.Po
:info:build make[3]: Leaving directory `/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_sysutils_clex/clex/work/clex-4.6.patch10/src'
:info:build make[2]: *** [all] Error 2
:info:build make[2]: Leaving directory `/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_sysutils_clex/clex/work/clex-4.6.patch10/src'
:info:build make[1]: *** [all-recursive] Error 1
:info:build make[1]: Leaving directory `/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_sysutils_clex/clex/work/clex-4.6.patch10'
:info:build make: *** [all] Error 2
:info:build make: Leaving directory `/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_sysutils_clex/clex/work/clex-4.6.patch10'
:info:build Command failed:  cd "/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_sysutils_clex/clex/work/clex-4.6.patch10" && /usr/bin/make -j8 -w all 
:info:build Exit code: 2
:error:build Failed to build clex: command execution failed
:debug:build Error code: CHILDSTATUS 87991 2
:debug:build Backtrace: command execution failed
:debug:build     while executing
:debug:build "system {*}$notty {*}$callback {*}$nice $fullcmdstring"
:debug:build     invoked from within
:debug:build "command_exec -callback portprogress::target_progress_callback build"
:debug:build     (procedure "portbuild::build_main" line 8)
:debug:build     invoked from within
:debug:build "$procedure $targetname"
:error:build See /opt/local/var/macports/logs/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_sysutils_clex/clex/main.log for details.

Let me know what I can do to help.

Change History (6)

comment:1 Changed 22 months ago by jmroot (Joshua Root)

Owner: set to ryandesign
Status: newassigned

comment:2 Changed 22 months ago by ryandesign (Ryan Carsten Schmidt)

Keywords: catalina bigsur monterey added
Status: assignedaccepted
Summary: clex build failureclex @4.6.patch10: implicit declaration of functions
Version: 2.7.2

Acknowledged and confirmed on macOS Catalina with Xcode 12.

Implicit declaration of function is a new error as of Xcode 12. It must be fixed in the usual way as required by the C99 and later standards, i.e. declare a function before using it.

It will need to be reported to the developers of clex. I can attempt to fix it first. If I can, then I can send them the fix.

comment:3 Changed 22 months ago by bryanchow (Bryan Chow)

Thank you Ryan, really appreciate your time and effort on this 👍

comment:4 Changed 22 months ago by ryandesign (Ryan Carsten Schmidt)

The fix is not as simple as just including a missing header. The undeclared functions being referenced here are wide-character functions declared in curses.h, and clex's inout.c does already include that header. The problem is that wide-character functions are only declared by ncurses if NCURSES_WIDECHAR is nonzero. If it is not already defined, ncurses defines NCURSES_WIDECHAR to 1 if _XOPEN_SOURCE_EXTENDED is defined or if _XOPEN_SOURCE is greater than or equal to 500 (otherwise it defines NCURSES_WIDECHAR to 0) and neither of those seem to be the case here. clexheaders.h does define _XOPEN_SOURCE to 600 but only on system that are not macOS nor FreeBSD. This is probably because defining _XOPEN_SOURCE can have wide-ranging unintended side-effects because if it is defined then the system headers alter which functions are available depending on the value of that define. I tried building on macOS 10.15 with _XOPEN_SOURCE defined to 500 or 600 and it failed with implicit declaration of function strsignal. That's fixed by defining _XOPEN_SOURCE to 700 but then I still have implicit declarations of functions major and minor. Better perhaps not to mess with _XOPEN_SOURCE.

Defining NCURSES_WIDECHAR to 1 seems to be to be the least invasive solution since this define is specific to ncurses and the functionality we want to enable, and doing that does work for clex in MacPorts. But this workaround is probably not general enough for the developers of clex to rely on themselves. For one thing, there are implementations of curses other than ncurses which would not respond to that define. And not even all versions of ncurses do. MacPorts ncurses does because it is version 6.3; this define was introduced in ncurses 5.7 patch 20100403. But even macOS 12.2.1 still ships with the ancient ncurses 5.7 patch 20081102 so it does not support this define. It does still support the _XOPEN_SOURCE_EXTENDED define. That was not a define I was familiar with before today, but it looks like the only system header that uses it is curses.h so setting it is probably a safe workaround, and doing that does allow clex to build successfully with either MacPorts ncurses or macOS ncurses so that's the solution I'll commit and I'll pass it on to the developers.

More on how programs are supposed to enable ncurses wide-character support is available in the ncurses documentation under the --enable-widec configuration option (which the MacPorts ncurses port uses).

comment:5 Changed 22 months ago by ryandesign (Ryan Carsten Schmidt)

Resolution: fixed
Status: acceptedclosed

In f79dd0afd5ec7ad3c33543c1932ed29a9af132b5/macports-ports (master):

clex: Fix implicit declaration of functions

Closes: #65491

comment:6 Changed 21 months ago by bryanchow (Bryan Chow)

Hi Ryan, just confirming that I am now able to build clex successfully on Big Sur. Thank you for taking the time to patch this!

Note: See TracTickets for help on using tickets.