Opened 3 years ago

Closed 3 years ago

#62320 closed defect (fixed)

openssh @8.4p1_1+gsskex: error: implicit declaration of function 'auth_get_canonical_hostname' is invalid in C99

Reported by: vkuznet (Valentin Kuznetsov) Owned by:
Priority: Normal Milestone:
Component: ports Version: 2.6.4
Keywords: catalina bigsur Cc: Schamschula (Marius Schamschula), fhgwright (Fred Wright), akkornel (A. Karl Kornel)
Port: openssh

Description

Hi, on macOS Catalina 10.15.7 I tried to upgrade openssh port and it fails as following:

sudo port upgrade openssh
Password:
--->  Computing dependencies for openssh
--->  Fetching archive for openssh
--->  Attempting to fetch openssh-8.4p1_1+gsskex+kerberos5+xauth.darwin_19.x86_64.tbz2 from https://ywg.ca.packages.macports.org/mirror/macports/packages/openssh
--->  Attempting to fetch openssh-8.4p1_1+gsskex+kerberos5+xauth.darwin_19.x86_64.tbz2 from https://mse.uk.packages.macports.org/openssh
--->  Attempting to fetch openssh-8.4p1_1+gsskex+kerberos5+xauth.darwin_19.x86_64.tbz2 from https://lil.fr.packages.macports.org/openssh
--->  Building openssh
Error: Failed to build openssh: command execution failed
Error: See /opt/local/var/macports/logs/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_net_openssh/openssh/main.log for details.
Error: Follow https://guide.macports.org/#project.tickets to report a bug.

The log shows the following:

...
:info:build sshconnect2.c:270:23: error: implicit declaration of function 'auth_get_canonical_hostname' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
:info:build                         gss_host = xstrdup(auth_get_canonical_hostname(ssh, 1));
:info:build                                            ^
:info:build sshconnect2.c:270:23: warning: incompatible integer to pointer conversion passing 'int' to parameter of type 'const char *' [-Wint-conversion]
:info:build                         gss_host = xstrdup(auth_get_canonical_hostname(ssh, 1));
:info:build                                            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
:info:build ./xmalloc.h:23:27: note: passing argument to parameter here
:info:build char    *xstrdup(const char *);
:info:build                              ^
:info:build sshconnect2.c:841:22: error: implicit declaration of function 'auth_get_canonical_hostname' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
:info:build                 gss_host = xstrdup(auth_get_canonical_hostname(ssh, 1));
:info:build                                    ^
:info:build sshconnect2.c:841:22: warning: incompatible integer to pointer conversion passing 'int' to parameter of type 'const char *' [-Wint-conversion]
:info:build                 gss_host = xstrdup(auth_get_canonical_hostname(ssh, 1));
:info:build                                    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
:info:build ./xmalloc.h:23:27: note: passing argument to parameter here
:info:build char    *xstrdup(const char *);
:info:build                              ^
:info:build sshd.c:2101:7: warning: 'daemon' is deprecated: first deprecated in macOS 10.5 - Use posix_spawn APIs instead. [-Wdeprecated-declarations]
:info:build                 if (daemon(0, 0) == -1)
:info:build                     ^
:info:build /Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk/usr/include/stdlib.h:292:6: note: 'daemon' has been explicitly marked deprecated here
:info:build int      daemon(int, int) __DARWIN_1050(daemon) __OSX_AVAILABLE_BUT_DEPRECATED_MSG(__MAC_10_0, __MAC_10_5, __IPHONE_2_0, __IPHONE_2_0, "Use posix_spawn APIs instead.") __WATCHOS_PROHIBITED __TVOS_PROHIBITED;
:info:build          ^
:info:build 2 warnings and 2 errors generated.
:info:build make: *** [sshconnect2.o] Error 1
:info:build make: *** Waiting for unfinished jobs....
:info:build 1 warning generated.
:info:build make: Leaving directory `/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_net_openssh/openssh/work/openssh-8.4p1'
:info:build Command failed:  cd "/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_net_openssh/openssh/work/openssh-8.4p1" && /usr/bin/make -j4 -w all
:info:build Exit code: 2
:error:build Failed to build openssh: command execution failed
:debug:build Error code: CHILDSTATUS 53351 2
:debug:build Backtrace: command execution failed
:debug:build     while executing
:debug:build "system {*}$notty {*}$nice $fullcmdstring"
:debug:build     invoked from within
:debug:build "command_exec 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_release_tarballs_ports_net_openssh/openssh/main.log for details.

Attachments (1)

main.log (367.1 KB) - added by vkuznet (Valentin Kuznetsov) 3 years ago.
main.log from port upgrade openssh command

Download all attachments as: .zip

Change History (14)

comment:1 Changed 3 years ago by Schamschula (Marius Schamschula)

Please attach full log file.

Errors with implicit declarations are an issue when the using the latest version of Xcode for Big Sur and Catalina.

However, I've got this version of openssh installed under Big Sur, so there is something else going on on your machine.

Last edited 3 years ago by Schamschula (Marius Schamschula) (previous) (diff)

Changed 3 years ago by vkuznet (Valentin Kuznetsov)

Attachment: main.log added

main.log from port upgrade openssh command

comment:2 Changed 3 years ago by vkuznet (Valentin Kuznetsov)

sure, the log is attached.

comment:3 Changed 3 years ago by Schamschula (Marius Schamschula)

It looks like this gets introduced by the following patch: openssh-8.1p1-gsskex-all-20141021-mp-20201216.patch

comment:4 Changed 3 years ago by Schamschula (Marius Schamschula)

In dbf07b3da095588d8578fa663a51807a4e91be89/macports-ports (master):

openssh: fix implicit declaration in gsskex variant

See: #62320

comment:5 Changed 3 years ago by ryandesign (Ryan Carsten Schmidt)

Keywords: catalina bigsur added; openssh removed
Summary: openssh build failureopenssh @8.4p1_1+gsskex: error: implicit declaration of function 'auth_get_canonical_hostname' is invalid in C99

Did that fix it or is there still more to fix?

comment:6 Changed 3 years ago by Schamschula (Marius Schamschula)

It cleanly built on my M1 mini running Big Sur. However, I didn't not test the functionality, as I normally don't install this variant.

Last edited 3 years ago by Schamschula (Marius Schamschula) (previous) (diff)

comment:7 Changed 3 years ago by vkuznet (Valentin Kuznetsov)

Do you want me to test the functionality? Is it possible to build it on a side such that I'll still keep my existing working port? If so, please send me instructions and I can see how it works. I use GSS authentication to access CERN and FNAL sites.

comment:8 Changed 3 years ago by Schamschula (Marius Schamschula)

Please do! If all is good, we can close this ticket.

comment:9 Changed 3 years ago by vkuznet (Valentin Kuznetsov)

I need a little bit of info, how to apply provided patch and build manually the port in local area? I'm familiar with patching, makefiles, etc., but I never did it within macports workflows. If you have any doc about it this just point me to it.

comment:10 Changed 3 years ago by vkuznet (Valentin Kuznetsov)

I tried the following:

# step 1
cd /tmp
curl -ksLO https://raw.githubusercontent.com/macports/macports-ports/dbf07b3da095588d8578fa663a51807a4e91be89/net/openssh/files/openssh-8.1p1-gsskex-all-20141021-mp-20201216.patch

# step 2, locate port area
port dir openssh
cd /opt/local/var/macports/sources/rsync.macports.org/release/tarballs/ports/net/openssh

# step 3, copy over new patch file
cp openssh-8.1p1-gsskex-all-20141021-mp-20201216.patch openssh-8.1p1-gsskex-all-20141021-mp-20201216.patch.orig
cp /tmp/openssh-8.1p1-gsskex-all-20141021-mp-20201216.patch .

# step 4, build port
sudo port build openssh +gsskex+kerberos5+xauth

The port build fails again with

:info:build /usr/bin/clang -pipe -Os -fPIE -isysroot/Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk -arch x86_64 -pipe -Wunknown-warning-option -Qunused-arguments -Wall -Wextra -Wpointer-arith -Wuninitialized -Wsign-compare -Wformat-security -Wsizeof-pointer-memaccess -Wno-pointer-sign -Wno-unused-parameter -Wno-unused-result -fno-strict-aliasing -mretpoline -D_FORTIFY_SOURCE=2 -ftrapv -fno-builtin-memset -fstack-protector-strong -fPIE   -I. -I. -I/opt/local/include -I/opt/local/include -I/opt/local/include -DBROKEN_STRNVIS=1 -D__APPLE_SANDBOX_NAMED_EXTERNAL__ -D__APPLE_API_STRICT_CONFORMANCE -D__APPLE_LAUNCHD__ -isysroot/Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk -I/opt/local/include/editline -I/opt/local/include -I/opt/local/include -DSSHDIR=\"/opt/local/etc/ssh\" -D_PATH_SSH_PROGRAM=\"/opt/local/bin/ssh\" -D_PATH_SSH_ASKPASS_DEFAULT=\"/opt/local/libexec/ssh-askpass\" -D_PATH_SFTP_SERVER=\"/opt/local/libexec/sftp-server\" -D_PATH_SSH_KEY_SIGN=\"/opt/local/libexec/ssh-keysign\" -D_PATH_SSH_PKCS11_HELPER=\"/opt/local/libexec/ssh-pkcs11-helper\" -D_PATH_SSH_SK_HELPER=\"/opt/local/libexec/ssh-sk-helper\" -D_PATH_SSH_PIDDIR=\"/opt/local/var/run\" -D_PATH_PRIVSEP_CHROOT_DIR=\"/var/empty\" -DHAVE_CONFIG_H -c auth2.c -o auth2.o
:info:build sshconnect2.c:270:23: error: implicit declaration of function 'auth_get_canonical_hostname' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
:info:build                         gss_host = xstrdup(auth_get_canonical_hostname(ssh, 1));
:info:build                                            ^
:info:build sshconnect2.c:270:23: warning: incompatible integer to pointer conversion passing 'int' to parameter of type 'const char *' [-Wint-conversion]
:info:build                         gss_host = xstrdup(auth_get_canonical_hostname(ssh, 1));
:info:build                                            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
:info:build ./xmalloc.h:23:27: note: passing argument to parameter here
:info:build char    *xstrdup(const char *);
:info:build                              ^
:info:build sshconnect2.c:841:22: error: implicit declaration of function 'auth_get_canonical_hostname' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
:info:build                 gss_host = xstrdup(auth_get_canonical_hostname(ssh, 1));
:info:build                                    ^
:info:build sshconnect2.c:841:22: warning: incompatible integer to pointer conversion passing 'int' to parameter of type 'const char *' [-Wint-conversion]
:info:build                 gss_host = xstrdup(auth_get_canonical_hostname(ssh, 1));
:info:build                                    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
:info:build ./xmalloc.h:23:27: note: passing argument to parameter here
:info:build char    *xstrdup(const char *);
:info:build                              ^
:info:build 2 warnings and 2 errors generated.
:info:build make: *** [sshconnect2.o] Error 1
:info:build make: *** Waiting for unfinished jobs....
:info:build make: Leaving directory `/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_net_openssh/openssh/work/openssh-8.4p1'
:info:build Command failed:  cd "/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_net_openssh/openssh/work/openssh-8.4p1" && /usr/bin/make -j4 -w all
:info:build Exit code: 2
:error:build Failed to build openssh: command execution failed
:debug:build Error code: CHILDSTATUS 67878 2
:debug:build Backtrace: command execution failed
:debug:build     while executing
:debug:build "system {*}$notty {*}$nice $fullcmdstring"
:debug:build     invoked from within
:debug:build "command_exec 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_release_tarballs_ports_net_openssh/openssh/main.log for details.

Again, I'm new to port build workflow and may easily miss something, so I need a little bit of guidance.

comment:11 Changed 3 years ago by Schamschula (Marius Schamschula)

The patch needs to be in the net/openssh/files folder. It looks like the original patch (minus the missing #include) was applied.

comment:12 Changed 3 years ago by vkuznet (Valentin Kuznetsov)

ok, it seems to work, here is all steps I did:

# get the patch
cd /tmp
curl -ksLO https://github.com/macports/macports-ports/commit/dbf07b3da095588d8578fa663a51807a4e91be89.patch

# patch the port
cd /opt/local/var/macports/sources/rsync.macports.org/release/tarballs/ports/net/openssh/files
sudo patch -p4 < /tmp/dbf07b3da095588d8578fa663a51807a4e91be89.patch

# clean-up existing port
sudo port clean openssh

# rebuild the port
sudo port build openssh +gsskex+kerberos5+xauth
--->  Computing dependencies for openssh
--->  Fetching distfiles for openssh
--->  Verifying checksums for openssh
--->  Extracting openssh
--->  Applying patches to openssh
--->  Configuring openssh
--->  Building openssh

# verify the port I have
port installed | grep openssh
  openssh @8.1p1_9+gsskex+kerberos5+xauth (active)

# authenticate with gssapi
ssh -S none -v xxxx@xxxx.cern.ch
OpenSSH_8.1p1, OpenSSL 1.1.1i  8 Dec 2020
...
debug1: Authentications that can continue: publickey,gssapi-keyex,gssapi-with-mic,keyboard-interactive
debug1: Next authentication method: gssapi-keyex
debug1: No valid Key exchange context
debug1: Next authentication method: gssapi-with-mic
debug1: Delegating credentials
debug1: Delegating credentials
debug1: Authentication succeeded (gssapi-with-mic).
...

comment:13 Changed 3 years ago by Schamschula (Marius Schamschula)

Resolution: fixed
Status: newclosed
Note: See TracTickets for help on using tickets.