Page MenuHomePhabricator

compiling libssh 0.9.2 on Solaris 11
Open, Needs TriagePublic

Description

Compiling libssh 0.9.2 on Solaris 11.3 with GCC 9.2.0 fails with

[ 78%] Linking C executable sshd_direct-tcpip
Undefined first referenced
symbol in file
recv CMakeFiles/sshd_direct-tcpip.dir/sshd_direct-tcpip.c.o (symbol belongs to implicit dependency /lib/amd64/libsocket.so.1)
send CMakeFiles/sshd_direct-tcpip.dir/sshd_direct-tcpip.c.o (symbol belongs to implicit dependency /lib/amd64/libsocket.so.1)
gethostbyname CMakeFiles/sshd_direct-tcpip.dir/sshd_direct-tcpip.c.o (symbol belongs to implicit dependency /lib/amd64/libnsl.so.1)
socket CMakeFiles/sshd_direct-tcpip.dir/sshd_direct-tcpip.c.o (symbol belongs to implicit dependency /lib/amd64/libsocket.so.1)
connect CMakeFiles/sshd_direct-tcpip.dir/sshd_direct-tcpip.c.o (symbol belongs to implicit dependency /lib/amd64/libsocket.so.1)
shutdown CMakeFiles/sshd_direct-tcpip.dir/sshd_direct-tcpip.c.o (symbol belongs to implicit dependency /lib/amd64/libsocket.so.1)

A quick fix is to call cmake with correct LDFLAGS:

$ env LDFLAGS='-lnsl -lsocket' cmake ../libssh-0.9.2

Event Timeline

joernc created this task.Nov 28 2019, 11:24 AM
Jakuje added a subscriber: Jakuje.Apr 16 2020, 9:58 AM

The example is missing the includes as mentioned in T225:

https://gitlab.com/jjelen/libssh-mirror/-/commit/c208dff23722996cab01570668c709497bd115bd

Can you check if just adding the correct includes solves the issue or we need some more cmake magic to unbreak this on solaris (I don't have any at hand).

Jakuje added a project: Restricted Project.Apr 16 2020, 9:59 AM