Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9188891
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T20:07:16+00:00 2026-06-17T20:07:16+00:00

I have a problem with libssh (libssh.org). I need to run a makefile on

  • 0

I have a problem with libssh (libssh.org). I need to run a makefile on the remote server. I do it with a command “channel_request_exec”:

int SSHExecCmd (void(* MessSender)(char* CurMessage, bool IsError, CWnd* MainWnd),ssh_session session,  CString & ShellEcho, char * cmd, CWnd* MainWnd)
{
    ssh_channel channel;
    int rc;
    channel = ssh_channel_new(session);
    if (channel == NULL) return SSH_ERROR;
    rc = ssh_channel_open_session(channel);
    if (rc != SSH_OK)
    {
        ssh_channel_free(channel);
        return rc;
    }
    rc = ssh_channel_request_exec(channel, cmd);
    if (rc != SSH_OK)
    {
        ssh_channel_close(channel);
        ssh_channel_free(channel);
        return rc;
    }
    char buffer[256];
    unsigned int nbytes;
    nbytes = ssh_channel_read(channel, buffer, sizeof(buffer), 0);
    while (nbytes > 0)
    {
        if (fwrite(buffer, 1, nbytes, stdout) != nbytes)
        {
            ssh_channel_close(channel);
            ssh_channel_free(channel);
            return SSH_ERROR;
        }
        nbytes = ssh_channel_read(channel, buffer, sizeof(buffer), 0);
    }
    if (nbytes < 0)
    {
        ssh_channel_close(channel);
        ssh_channel_free(channel);
        return SSH_ERROR;
    }
    return SSH_OK;
}

Makefile is located in root:

all: mpi_cuda.o pattern2d.o
        mpicc mpi_cuda.o pattern2d.o -o mpi_cuda -lrt -lpthread -L/opt/cuda/lib64 -lcudart -lm

mpi_cuda.o: mpi_cuda.c
        mpicc -g -std=c99 -D_GNU_SOURCE -I/opt/cuda/include -c $< -o $@

pattern2d.o: pattern2d.cu
        nvcc -g -c $< -o $@

I send a command “make” and receive echo:

mpicc -g -std=c99 -D_GNU_SOURCE -I/opt/cuda/include -c mpi_cuda.c -o mpi_cuda.oda

but nothing happens (compilation is not performed).

If I do make with a putty: everything work. Echo:

make
mpicc -g -std=c99 -D_GNU_SOURCE -I/opt/cuda/include -c mpi_cuda.c -o mpi_cuda.o
mpi_cuda.c: В функции ‘main’:
mpi_cuda.c:148: предупреждение: недостаточно аргументов для указанного формата
nvcc -g -c pattern2d.cu -o pattern2d.o
mpicc mpi_cuda.o pattern2d.o -o mpi_cuda -lrt -lpthread -L/opt/cuda/lib64 -lcudart -lm

How do I solve this?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T20:07:17+00:00Added an answer on June 17, 2026 at 8:07 pm

    Not familiar with libssh, but error could be, because environment gets set up differently, so running make through shell explicitly could help.

    Try changing the command (make?) to

    bash -c make
    

    If that does not work, try

    bash -c "export > env.txt ; make > make_out.txt 2> make_err.txt"
    

    Then check if those file appeared, and what they contain, that should give good hints.

    If you have a working and a non-working case, then get these files from both cases, and compare them (eg. with diff -u).

    And change bash to whatever shell you use (and in that case check if -c is right switch to give command string, and if export is right command to show environment), if you’re not using bash.


    Based on comments below: Difference in env.txt could be, because some of the environment variables only get set for interactive shells. For example, in my Ubuntu box, start of .bashrc has lines like this:

    # If not running interactively, don't do anything
    [ -z "$PS1" ] && return
    

    Now if any of those needed environemnt variables are set in .bashrc after that line, and your ssh connection is non-interactive (without pseudo-tty), these don’t get set.

    If this is the case, move these env variable sets to ~/.profile, or in ~/.bashrc before such test as above. Also do man bash, and read stuff about initialization files (like that ~/.bashrc).

    Other solution would be to make the ssh-session interactive, which I believe is documented at this page for libssh: http://api.libssh.org/master/libssh_tutor_shell.html .

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have problem with context menu. I have got: @Override public void onCreateContextMenu(ContextMenu menu,
I have problem with trees in XNA. When I have tree, I need to
I have problem with initializing data into SQL Server Compact .sdf data file in
i have problem with enum I need make a enum in base class or
I have problem in my xampp server php file not work if I write
I have problem setting up CGI scripts to be run on Nginx, so far
I have problem in determining time complexities of algorithms. for(int i=0;i <n i++){} O(n)
Need your help with projecting the makefile. So, what I have and what I
Have problem in dynamically create target name with .SECONDEXPANSION: Small Makefile to reproduce problem:
i have problem for setting upper and lower bytes of (short int). please look

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.