Closed underthestars-zhy closed 3 years ago
ld: warning: Could not find or use auto-linked library 'ssh2' Undefined symbols for architecture x86_64: "_libssh2_agentconnect", referenced from: $s5Shout5AgentC7connectyyKF in Agent.swift.o "_libssh2_agentdisconnect", referenced from: $s5Shout5AgentCfd in Agent.swift.o "_libssh2_agentfree", referenced from: $s5Shout5AgentCfd in Agent.swift.o "_libssh2_agent_getidentity", referenced from: $s5Shout5AgentC11getIdentity4lastAC9PublicKeyCSgAH_tKF in Agent.swift.o "_libssh2_agentinit", referenced from: $s5Shout5AgentC8cSessionACs13OpaquePointerV_tKcfc in Agent.swift.o "_libssh2_agent_listidentities", referenced from: $s5Shout5AgentC14listIdentitiesyyKF in Agent.swift.o "_libssh2_agentuserauth", referenced from: $s5Shout5AgentC12authenticate8username3keySbSS_AC9PublicKeyCtF in Agent.swift.o "_libssh2_channelclose", referenced from: $s5Shout7ChannelC5closeyyKF in Channel.swift.o "_libssh2_channelfree", referenced from: $s5Shout7ChannelCfd in Channel.swift.o "_libssh2_channel_get_exitstatus", referenced from: $s5Shout7ChannelC10exitStatuss5Int32VyF in Channel.swift.o "_libssh2_channel_openex", referenced from: $s5Shout7ChannelC16createForCommand8cSessionACs13OpaquePointerV_tKFZ in Channel.swift.o "_libssh2_channel_processstartup", referenced from: $s5Shout7ChannelC4exec7commandySS_tKF in Channel.swift.o "_libssh2_channel_readex", referenced from: $s5Shout7ChannelC8readDataAA18ReadWriteProcessorO0E6ResultOyF in Channel.swift.o "_libssh2_channel_request_ptyex", referenced from: $s5Shout7ChannelC10requestPty4typeySS_tKF in Channel.swift.o "_libssh2_channel_sendeof", referenced from: $s5Shout7ChannelC7sendEOFyyKF in Channel.swift.o "_libssh2_channel_waitclosed", referenced from: $s5Shout7ChannelC10waitClosedyyKF in Channel.swift.o "_libssh2_channel_waiteof", referenced from: $s5Shout7ChannelC7waitEOFyyKF in Channel.swift.o "_libssh2_channel_writeex", referenced from: $s5Shout7ChannelC5write4data6length2toAA18ReadWriteProcessorO0H6ResultO10Foundation4DataVSis5Int32VtFs0J0OySiAA8SSHErrorVGSWXEfU in Channel.swift.o "_libssh2init", referenced from: $s5Shout7SessionC10initResult33_E47B0AB8180088EC3B1503AA6C6E936FLL_WZ in Session.swift.o "_libssh2_scpsend64", referenced from: $s5Shout7ChannelC12createForSCP8cSession8fileSize10remotePath11permissionsACs13OpaquePointerV_s5Int64VSSAA15FilePermissionsVtKFZ in Channel.swift.o "_libssh2_sessionfree", referenced from: $s5Shout7SessionCfd in Session.swift.o "_libssh2_session_getblocking", referenced from: $s5Shout7SessionC8blockings5Int32Vvg in Session.swift.o "_libssh2_sessionhandshake", referenced from: $s5Shout7SessionC9handshake4overy6SocketAFC_tKF in Session.swift.o "_libssh2_session_initex", referenced from: $s5Shout7SessionCACyKcfc in Session.swift.o "_libssh2_session_lasterrno", referenced from: $s5Shout8SSHErrorV15mostRecentError7session13backupMessageACs13OpaquePointerV_SStFZ in SSHError.swift.o "_libssh2_session_lasterror", referenced from: $s5Shout8SSHErrorV4kind7session13backupMessageA2C4KindO_s13OpaquePointerVSStc33_36A87DA783DEB00A06E7AF49F9616525LlfC in SSHError.swift.o "_libssh2_session_setblocking", referenced from: $s5Shout7SessionC8blockings5Int32Vvs in Session.swift.o "_libssh2_sftp_closehandle", referenced from: $s5Shout4SFTPC10SFTPHandle030_A805FF59DB65CB363C18C7BCF30A7K1ELLCfd in SFTP.swift.o "_libssh2_sftpinit", referenced from: $s5Shout4SFTPC7session8cSessionAcA0D0C_s13OpaquePointerVtKcfc in SFTP.swift.o "_libssh2_sftp_mkdirex", referenced from: $s5Shout4SFTPC15createDirectoryyySSKFs5Int32VSPys4Int8VGXEfU_ in SFTP.swift.o "_libssh2_sftp_openex", referenced from: $s5Shout4SFTPC10SFTPHandle030_A805FF59DB65CB363C18C7BCF30A7K1ELLC8cSession04sftpL010remotePath5flags4mode8openTypeAFs13OpaquePointerV_ANSSs5Int32VA2PtKcfc in SFTP.swift.o "_libssh2_sftpread", referenced from: $s5Shout4SFTPC10SFTPHandle030_A805FF59DB65CB363C18C7BCF30A7K1ELLC4readAA18ReadWriteProcessorO0M6ResultOyF in SFTP.swift.o "_libssh2_sftp_readdirex", referenced from: $s5Shout4SFTPC10SFTPHandle030_A805FF59DB65CB363C18C7BCF30A7K1ELLC7readDiryAA18ReadWriteProcessorO0N6ResultOSo09_LIBSSH2_B11_ATTRIBUTESVzF in SFTP.swift.o "_libssh2_sftp_renameex", referenced from: $s5Shout4SFTPC6rename3src4dest8overrideySS_SSSbtKFs5Int32VSPys4Int8VGXEfUAiLXEfU in SFTP.swift.o "_libssh2_sftp_rmdirex", referenced from: $s5Shout4SFTPC15removeDirectoryyySSKFs5Int32VSPys4Int8VGXEfU_ in SFTP.swift.o "_libssh2_sftpshutdown", referenced from: $s5Shout4SFTPCfd in SFTP.swift.o "_libssh2_sftp_unlinkex", referenced from: $s5Shout4SFTPC10removeFileyySSKFs5Int32VSPys4Int8VGXEfU_ in SFTP.swift.o "_libssh2_sftpwrite", referenced from: $s5Shout4SFTPC10SFTPHandle030A805FF59DB65CB363C18C7BCF30A7K1ELLC5writeyAA18ReadWriteProcessorO0N6ResultO10Foundation4DataVFs0P0OySiAA8SSHErrorVGSWXEfU in SFTP.swift.o "_libssh2_userauth_passwordex", referenced from: $s5Shout7SessionC12authenticate8username8passwordySS_SStKF in Session.swift.o "_libssh2_userauth_publickey_fromfileex", referenced from: $s5Shout7SessionC12authenticate8username10privateKey06publicF010passphraseySS_S3SSgtKF in Session.swift.o ld: symbol(s) not found for architecture x86_64
Do u fix it ? Because i have the same problem
Likewise, any luck?
This is likely caused by compiling with headers from one libssh2 version, then linking a different one. I saw similar errors when my libraries were compiling with headers from Conan, then linking libraries installed by brew
.
To solve this, I removed the brew-installed version.
ld: warning: Could not find or use auto-linked library 'ssh2' Undefined symbols for architecture x86_64: "_libssh2_agentconnect", referenced from: $s5Shout5AgentC7connectyyKF in Agent.swift.o "_libssh2_agentdisconnect", referenced from: $s5Shout5AgentCfd in Agent.swift.o "_libssh2_agentfree", referenced from: $s5Shout5AgentCfd in Agent.swift.o "_libssh2_agent_getidentity", referenced from: $s5Shout5AgentC11getIdentity4lastAC9PublicKeyCSgAH_tKF in Agent.swift.o "_libssh2_agentinit", referenced from: $s5Shout5AgentC8cSessionACs13OpaquePointerV_tKcfc in Agent.swift.o "_libssh2_agent_listidentities", referenced from: $s5Shout5AgentC14listIdentitiesyyKF in Agent.swift.o "_libssh2_agentuserauth", referenced from: $s5Shout5AgentC12authenticate8username3keySbSS_AC9PublicKeyCtF in Agent.swift.o "_libssh2_channelclose", referenced from: $s5Shout7ChannelC5closeyyKF in Channel.swift.o "_libssh2_channelfree", referenced from: $s5Shout7ChannelCfd in Channel.swift.o "_libssh2_channel_get_exitstatus", referenced from: $s5Shout7ChannelC10exitStatuss5Int32VyF in Channel.swift.o "_libssh2_channel_openex", referenced from: $s5Shout7ChannelC16createForCommand8cSessionACs13OpaquePointerV_tKFZ in Channel.swift.o "_libssh2_channel_processstartup", referenced from: $s5Shout7ChannelC4exec7commandySS_tKF in Channel.swift.o "_libssh2_channel_readex", referenced from: $s5Shout7ChannelC8readDataAA18ReadWriteProcessorO0E6ResultOyF in Channel.swift.o "_libssh2_channel_request_ptyex", referenced from: $s5Shout7ChannelC10requestPty4typeySS_tKF in Channel.swift.o "_libssh2_channel_sendeof", referenced from: $s5Shout7ChannelC7sendEOFyyKF in Channel.swift.o "_libssh2_channel_waitclosed", referenced from: $s5Shout7ChannelC10waitClosedyyKF in Channel.swift.o "_libssh2_channel_waiteof", referenced from: $s5Shout7ChannelC7waitEOFyyKF in Channel.swift.o "_libssh2_channel_writeex", referenced from: $s5Shout7ChannelC5write4data6length2toAA18ReadWriteProcessorO0H6ResultO10Foundation4DataVSis5Int32VtFs0J0OySiAA8SSHErrorVGSWXEfU in Channel.swift.o "_libssh2init", referenced from: $s5Shout7SessionC10initResult33_E47B0AB8180088EC3B1503AA6C6E936FLL_WZ in Session.swift.o "_libssh2_scpsend64", referenced from: $s5Shout7ChannelC12createForSCP8cSession8fileSize10remotePath11permissionsACs13OpaquePointerV_s5Int64VSSAA15FilePermissionsVtKFZ in Channel.swift.o "_libssh2_sessionfree", referenced from: $s5Shout7SessionCfd in Session.swift.o "_libssh2_session_getblocking", referenced from: $s5Shout7SessionC8blockings5Int32Vvg in Session.swift.o "_libssh2_sessionhandshake", referenced from: $s5Shout7SessionC9handshake4overy6SocketAFC_tKF in Session.swift.o "_libssh2_session_initex", referenced from: $s5Shout7SessionCACyKcfc in Session.swift.o "_libssh2_session_lasterrno", referenced from: $s5Shout8SSHErrorV15mostRecentError7session13backupMessageACs13OpaquePointerV_SStFZ in SSHError.swift.o "_libssh2_session_lasterror", referenced from: $s5Shout8SSHErrorV4kind7session13backupMessageA2C4KindO_s13OpaquePointerVSStc33_36A87DA783DEB00A06E7AF49F9616525LlfC in SSHError.swift.o "_libssh2_session_setblocking", referenced from: $s5Shout7SessionC8blockings5Int32Vvs in Session.swift.o "_libssh2_sftp_closehandle", referenced from: $s5Shout4SFTPC10SFTPHandle030_A805FF59DB65CB363C18C7BCF30A7K1ELLCfd in SFTP.swift.o "_libssh2_sftpinit", referenced from: $s5Shout4SFTPC7session8cSessionAcA0D0C_s13OpaquePointerVtKcfc in SFTP.swift.o "_libssh2_sftp_mkdirex", referenced from: $s5Shout4SFTPC15createDirectoryyySSKFs5Int32VSPys4Int8VGXEfU_ in SFTP.swift.o "_libssh2_sftp_openex", referenced from: $s5Shout4SFTPC10SFTPHandle030_A805FF59DB65CB363C18C7BCF30A7K1ELLC8cSession04sftpL010remotePath5flags4mode8openTypeAFs13OpaquePointerV_ANSSs5Int32VA2PtKcfc in SFTP.swift.o "_libssh2_sftpread", referenced from: $s5Shout4SFTPC10SFTPHandle030_A805FF59DB65CB363C18C7BCF30A7K1ELLC4readAA18ReadWriteProcessorO0M6ResultOyF in SFTP.swift.o "_libssh2_sftp_readdirex", referenced from: $s5Shout4SFTPC10SFTPHandle030_A805FF59DB65CB363C18C7BCF30A7K1ELLC7readDiryAA18ReadWriteProcessorO0N6ResultOSo09_LIBSSH2_B11_ATTRIBUTESVzF in SFTP.swift.o "_libssh2_sftp_renameex", referenced from: $s5Shout4SFTPC6rename3src4dest8overrideySS_SSSbtKFs5Int32VSPys4Int8VGXEfUAiLXEfU in SFTP.swift.o "_libssh2_sftp_rmdirex", referenced from: $s5Shout4SFTPC15removeDirectoryyySSKFs5Int32VSPys4Int8VGXEfU_ in SFTP.swift.o "_libssh2_sftpshutdown", referenced from: $s5Shout4SFTPCfd in SFTP.swift.o "_libssh2_sftp_unlinkex", referenced from: $s5Shout4SFTPC10removeFileyySSKFs5Int32VSPys4Int8VGXEfU_ in SFTP.swift.o "_libssh2_sftpwrite", referenced from: $s5Shout4SFTPC10SFTPHandle030A805FF59DB65CB363C18C7BCF30A7K1ELLC5writeyAA18ReadWriteProcessorO0N6ResultO10Foundation4DataVFs0P0OySiAA8SSHErrorVGSWXEfU in SFTP.swift.o "_libssh2_userauth_passwordex", referenced from: $s5Shout7SessionC12authenticate8username8passwordySS_SStKF in Session.swift.o "_libssh2_userauth_publickey_fromfileex", referenced from: $s5Shout7SessionC12authenticate8username10privateKey06publicF010passphraseySS_S3SSgtKF in Session.swift.o ld: symbol(s) not found for architecture x86_64