Opened 10 years ago

Closed 10 years ago

Last modified 10 years ago

#43059 closed defect (fixed)

openssh fails to build using default xcode gcc 4.2

Reported by: leeawalsh@… Owned by: macports-tickets@…
Priority: Normal Milestone:
Component: ports Version: 2.2.1
Keywords: Cc:
Port: openssh

Description

When trying upgrade openssh (from @6.5p1_4+kerberos5+xauth to @6.6p1_1+kerberos5+xauth), I received the following error:

$ sudo port clean openssh
--->  Cleaning openssh
$ sudo port install -sd openssh
--->  Computing dependencies for openssh
--->  Fetching distfiles for openssh
--->  Verifying checksums for openssh
--->  Extracting openssh
--->  Applying patches to openssh
--->  Configuring openssh
--->  Building openssh
Error: org.macports.build for port openssh returned: command execution failed
Please see the log file for port openssh for details:
    /opt/local/var/macports/logs/_opt_local_var_macports_sources_rsync.macports.org_release_ports_net_openssh/openssh/main.log
To report a bug, follow the instructions in the guide:
    http://guide.macports.org/#project.tickets
Error: Processing of port openssh failed

Upon inspecting the named log file (which I no longer have, sorry), I discovered that it was being built with the default xcode gcc4.2, despite the fact that my active selected gcc is mp-gcc48. It built successfully when I forced it to use gcc48:

$ sudo port install -s openssh  configure.compiler=macports-gcc-4.8

I'm no expert, but I'm not sure that's really the best solution. For one, I have to remember to specify each time I update it, and for another, it seems like this might harm some other compatibility in the future?

Shouldn't the default compiler work?

Please let me know if I can provide more information (I can probably uninstall and attempt build with the default compiler if you need the original error log).

Attachments (4)

main.log (305.5 KB) - added by leeawalsh@… 10 years ago.
openssh main log
libssh.nm (167.2 KB) - added by leeawalsh@… 10 years ago.
$ nm /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_ports_net_openssh/openssh/work/openssh-6.6p1/libssh.a > libssh.nm
patch-Portfile.diff (475 bytes) - added by neverpanic (Clemens Lang) 10 years ago.
Patch against the Portfile
libssh.4.2.5.dylib (300.7 KB) - added by leeawalsh@… 10 years ago.
/opt/local/lib/libssh.dylib

Download all attachments as: .zip

Change History (14)

comment:1 Changed 10 years ago by neverpanic (Clemens Lang)

Your active selected gcc does not affect the compiler used by MacPorts to build stuff. If it did that would significantly increase the support burden for us because builds would no longer be easy to reproduce. The select mechanism is purely for your own convenience. In fact, depending on a selection is considered a bug in a port.

The default compiler should work, and if it doesn't we should blacklist it so a better compiler gets used automatically. However, we'd have to know why this fails in the first place. We need to logfile to debug that, so please run:

sudo port clean openssh
sudo port destroot openssh

This will not affect your currently installed openssh, but it will attempt to build openssh, and should fail as before. Once it did fail, attach the log file mentioned in the error message.

Changed 10 years ago by leeawalsh@…

Attachment: main.log added

openssh main log

comment:2 in reply to:  1 Changed 10 years ago by leeawalsh@…

Replying to cal@…:

Your active selected gcc does not affect the compiler used by MacPorts to build stuff. If it did that would significantly increase the support burden for us because builds would no longer be easy to reproduce. The select mechanism is purely for your own convenience. In fact, depending on a selection is considered a bug in a port.

Thanks, so it selects the compiler for my own use elsewhere, not an internal selection for macports' use.

The default compiler should work, and if it doesn't we should blacklist it so a better compiler gets used automatically. However, we'd have to know why this fails in the first place. We need to logfile to debug that, so please run:

sudo port clean openssh
sudo port destroot openssh

This will not affect your currently installed openssh, but it will attempt to build openssh, and should fail as before. Once it did fail, attach the log file mentioned in the error message.

The log from the above procedure is now attached.

comment:3 Changed 10 years ago by neverpanic (Clemens Lang)

Please attach the output of

nm /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_ports_net_openssh/openssh/work/openssh-6.6p1/libssh.a

Changed 10 years ago by leeawalsh@…

Attachment: libssh.nm added

$ nm /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_ports_net_openssh/openssh/work/openssh-6.6p1/libssh.a > libssh.nm

comment:4 Changed 10 years ago by neverpanic (Clemens Lang)

I don't get that. The compilation fails in the linking stage of ssh-add with missing symbols:

:info:build /usr/bin/gcc-4.2 -o ssh-add ssh-add.o -L. -Lopenbsd-compat/ -L/opt/local/lib -L/opt/local/lib -L/opt/local/lib -Wl,-headerpad_max_install_names -arch x86_64 -fstack-protector-all -pie -lssh -lopenbsd-compat -lcrypto -lz  -lresolv
:info:build Undefined symbols:
:info:build   "_key_free", referenced from:
:info:build       _do_file in ssh-add.o
:info:build       _do_file in ssh-add.o
:info:build       _do_file in ssh-add.o
:info:build       _do_file in ssh-add.o
:info:build       _do_file in ssh-add.o
:info:build       _main in ssh-add.o
:info:build   "_key_load_file", referenced from:
:info:build       _do_file in ssh-add.o
:info:build   "_key_perm_ok", referenced from:
:info:build       _do_file in ssh-add.o
:info:build   "_key_fingerprint", referenced from:
:info:build       _main in ssh-add.o
:info:build   "_ssh_close_authentication_connection", referenced from:
:info:build       _main in ssh-add.o
:info:build   "_key_type", referenced from:
:info:build       _main in ssh-add.o
:info:build   "_buffer_init", referenced from:
:info:build       _do_file in ssh-add.o
:info:build   "_error", referenced from:
:info:build       _do_file in ssh-add.o
:info:build       _do_file in ssh-add.o
:info:build       _do_file in ssh-add.o
:info:build   "_ssh_get_authentication_connection", referenced from:
:info:build       _main in ssh-add.o
:info:build   "_seed_rng", referenced from:
:info:build       _main in ssh-add.o
:info:build   "_key_equal_public", referenced from:
:info:build       _do_file in ssh-add.o
:info:build       _do_file in ssh-add.o
:info:build   "_xstrdup", referenced from:
:info:build       _do_file in ssh-add.o
:info:build       _ssh_get_progname in libopenbsd-compat.a(bsd-misc.o)
:info:build   "_fatal", referenced from:
:info:build       _do_file in ssh-add.o
:info:build   "_key_parse_private", referenced from:
:info:build       _do_file in ssh-add.o
:info:build       _do_file in ssh-add.o
:info:build       _do_file in ssh-add.o
:info:build   "_key_write", referenced from:
:info:build       _main in ssh-add.o
:info:build   "_sanitise_stdfd", referenced from:
:info:build       _main in ssh-add.o
:info:build   "_ssh_get_first_identity", referenced from:
:info:build       _main in ssh-add.o
:info:build   "_key_load_public", referenced from:
:info:build       _do_file in ssh-add.o
:info:build       _do_file in ssh-add.o
:info:build       _do_file in ssh-add.o
:info:build   "_key_cert_is_legacy", referenced from:
:info:build       _do_file in ssh-add.o
:info:build   "_ssh_add_identity_constrained", referenced from:
:info:build       _do_file in ssh-add.o
:info:build       _do_file in ssh-add.o
:info:build   "_ssh_remove_all_identities", referenced from:
:info:build       _main in ssh-add.o
:info:build       _main in ssh-add.o
:info:build       _main in ssh-add.o
:info:build   "_convtime", referenced from:
:info:build       _main in ssh-add.o
:info:build   "_ssh_lock_agent", referenced from:
:info:build       _main in ssh-add.o
:info:build   "_read_passphrase", referenced from:
:info:build       _do_file in ssh-add.o
:info:build       _main in ssh-add.o
:info:build       _main in ssh-add.o
:info:build       _main in ssh-add.o
:info:build   "_ssh_remove_identity", referenced from:
:info:build       _do_file in ssh-add.o
:info:build       _do_file in ssh-add.o
:info:build   "_key_size", referenced from:
:info:build       _main in ssh-add.o
:info:build   "_key_cert_copy", referenced from:
:info:build       _do_file in ssh-add.o
:info:build   "_key_to_certified", referenced from:
:info:build       _do_file in ssh-add.o
:info:build   "_ssh_update_card", referenced from:
:info:build       _main in ssh-add.o
:info:build   "_ssh_get_next_identity", referenced from:
:info:build       _main in ssh-add.o
:info:build   "_xasprintf", referenced from:
:info:build       _do_file in ssh-add.o
:info:build       _do_file in ssh-add.o
:info:build ld: symbol(s) not found
:info:build collect2: ld returned 1 exit status
:info:build make: *** [ssh-add] Error 1

but the linker command line correctly says -L. -lssh which has these symbols.

The only reasonable explanation I have for this is that older versions of the OS X linker first tried finding dynamic libraries in all linker search paths before trying to link against static libraries. Do you have a file named libssh.dylib in any of /opt/local/lib, /usr/local/lib, or /usr/lib?

Changed 10 years ago by neverpanic (Clemens Lang)

Attachment: patch-Portfile.diff added

Patch against the Portfile

comment:5 Changed 10 years ago by neverpanic (Clemens Lang)

Can you try again with the attached patch applied to the Portfile (you can locate it using port file openssh)?

Changed 10 years ago by leeawalsh@…

Attachment: libssh.4.2.5.dylib added

/opt/local/lib/libssh.dylib

comment:6 Changed 10 years ago by leeawalsh@…

Replying to cal@…:

The only reasonable explanation I have for this is that older versions of the OS X linker first tried finding dynamic libraries in all linker search paths before trying to link against static libraries. Do you have a file named libssh.dylib in any of /opt/local/lib, /usr/local/lib, or /usr/lib?

I have these:

$ ls /opt/local/lib/libssh*dylib
/opt/local/lib/libssh.4.2.5.dylib*         /opt/local/lib/libssh_threads.4.2.5.dylib*
/opt/local/lib/libssh.4.dylib@             /opt/local/lib/libssh_threads.4.dylib@
/opt/local/lib/libssh.dylib@               /opt/local/lib/libssh_threads.dylib@
$ ls /usr/local/lib/libssh*dylib
ls: /usr/local/lib/libssh*dylib: No such file or directory
$ ls /usr/lib/libssh*dylib
ls: /usr/lib/libssh*dylib: No such file or directory

Most of those are links to libssh.4.2.5.dylib which I've attached.

comment:7 Changed 10 years ago by neverpanic (Clemens Lang)

Yeah, that would probably cause these problems with old linkers. Please try the patch, it should help.

comment:8 Changed 10 years ago by leeawalsh@…

Appears to have helped!

$ sudo patch < patch-Portfile.diff 
patching file Portfile
$ sudo port clean openssh
--->  Cleaning openssh
$ sudo port destroot openssh
--->  Computing dependencies for openssh
--->  Fetching distfiles for openssh
--->  Verifying checksums for openssh
--->  Extracting openssh
--->  Applying patches to openssh
--->  Configuring openssh
--->  Building openssh
--->  Staging openssh into destroot
--->  Creating launchd control script
###########################################################
# A startup item has been generated that will aid in
# starting openssh with launchd. It is disabled
# by default. Execute the following command to start it,
# and to cause it to launch at startup:
#
# sudo port load openssh
###########################################################

comment:9 Changed 10 years ago by neverpanic (Clemens Lang)

Resolution: fixed
Status: newclosed

OK, r118176.

comment:10 in reply to:  9 Changed 10 years ago by leeawalsh@…

Thank you very much!

Note: See TracTickets for help on using tickets.