LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 01-04-2012, 02:38 PM   #1
mfziegler
LQ Newbie
 
Registered: Jan 2012
Posts: 7

Rep: Reputation: Disabled
Odd runtime error, undefined symbol: ssh_channel_new


Hey all,

I'm writing a simple c++ program with libssh (http://www.libssh.org/) that will create an ssh connection with my samba server, and then create a user with an inputted username and password.

My program compiles with no errors or warnings, and it executes the first several functions from the libssh library without any problems; however, when my program tries to execute the ssh_channel_new command, I get the run time error: ./myProgram: symbol lookup error: ./myProgram: undefined symbol: ssh_channel_new

I'm using a makefile generated from QT's qmake, and added -lssh to the LIBS option line.

Here is the code leading up to the error, most of it is copied from the libssh examples, so I really don't know what could be going wrong. Any help would be greatly appreciated

Code:
ssh_session ssh;
   ssh = ssh_new();
   if (ssh == NULL) {
      cout << "ssh session could not be initialized";
      ssh_free(ssh);
      return;
   }
   
   ssh_options_set(ssh, SSH_OPTIONS_HOST, IP);
   ssh_options_set(ssh, SSH_OPTIONS_LOG_VERBOSITY, &verbosity);
   ssh_options_set(ssh, SSH_OPTIONS_PORT, &port);
   ssh_options_set(ssh, SSH_OPTIONS_USER, user);
   
   cout << "Connecting to server..." << endl;
   rc = ssh_connect(ssh);
   if (rc != SSH_OK) {
      cout << "Could not connect to server.";
      ssh_free(ssh);
      return;
   }
   
   if (verify_knownhost(ssh) != 0) {
      cout << "Could not verify known host.";
      ssh_disconnect(ssh);
      ssh_free(ssh);
      return;
   }
   
   rc = ssh_userauth_password(ssh, NULL, adminPass);
   if (rc != SSH_AUTH_SUCCESS) {
      cout << "server admin password not accepted.";
      ssh_disconnect(ssh);
      ssh_free(ssh);
      return;
   }
   
   cout << "Connected." << endl;
   ssh_channel channel;
   
   cout << "Creating ssh channel..." << endl;
   channel = ssh_channel_new(ssh);
   if (channel == NULL) {
      cout << "Could not establish channel.";
      ssh_disconnect(ssh);
      ssh_free(ssh);
      return;
   }
 
Old 01-07-2012, 08:17 PM   #2
RudyMartin
Member
 
Registered: Nov 2011
Location: Argentina
Distribution: Slackware, Debian
Posts: 40

Rep: Reputation: Disabled
is there a linker reference missing perhaps?

http://api.libssh.org/master/libssh_linking.html
 
Old 01-11-2012, 02:25 PM   #3
wtruong
Member
 
Registered: May 2009
Distribution: ubuntu
Posts: 35

Rep: Reputation: 16
Where is your libssh.so file located at, relative to your binary?
 
Old 01-11-2012, 02:41 PM   #4
mfziegler
LQ Newbie
 
Registered: Jan 2012
Posts: 7

Original Poster
Rep: Reputation: Disabled
I figured out the problem. Apparently when I installed the libssh libraries, it was not a complete installation and therefore I got these errors. It just confused me because I figured that the program wouldn't even compile if it was missing some of the files. Anyway, thank you all for trying to help!
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] symbol lookup error: /usr/sbin/httpd: undefined symbol: apr_file_link bagi Slackware 3 05-17-2011 07:49 AM
glib error while installing patch: symbol lookup error undefined symbol: g_dgettext mthakare Linux - Software 1 06-14-2010 04:01 AM
symbol lookup error: /usr/lib/libavcodec.so.51: undefined symbol: av_crc04C11DB7 priceey Linux - Software 0 05-06-2009 08:14 AM
./firefox-bin :symbol lookup error:/lib/libgthread-2.0.so.0: undefined symbol: arulupsaras Linux - General 1 11-08-2008 04:48 AM
symbol lookup error: /usr/lib/libgtk-x11.2.0.so.0: undefined symbol:... IamI Slackware 17 02-29-2008 11:10 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 09:48 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration