www.libssh2.org | Daily snapshots | Mailing list archive | Docs | Examples | github

Archive Index This month's Index

Subject: Re: problems building under Windows

Re: problems building under Windows

From: Matthew Fleming <mgflem_at_gmail.com>
Date: Sun, 20 Dec 2015 15:16:14 -0600

Thanks for the suggestion. I was eventually able to get the library built,
but its not working quite right.

I tried to send a file with sample code from
http://www.libssh2.org/examples/sftp_write.html.

This code:

/* Request a file via SFTP */
sftp_handle =
libssh2_sftp_open(sftp_session, sftppath,

LIBSSH2_FXF_WRITE | LIBSSH2_FXF_CREAT | LIBSSH2_FXF_TRUNC,
LIBSSH2_SFTP_S_IRUSR | LIBSSH2_SFTP_S_IWUSR |
LIBSSH2_SFTP_S_IRGRP | LIBSSH2_SFTP_S_IROTH);

if (!sftp_handle) {
fprintf(stderr, "Unable to open file with SFTP\n");
char *error;
int errmsg_len, want_buf=1;
libssh2_session_last_error(session, &error, &errmsg_len, want_buf);
fprintf(stderr, "%s\n", error);
goto shutdown;
}

produces this error:

libssh2_sftp_init()!
libssh2_sftp_open()!
Unable to open file with SFTP
Failed opening remote file
all done

This is not a very informative message, and I don't know what to do with
it. I am trying to transfer from a Windows 10 machine to a Raspberry Pi
running Ubuntu Linux. There doesn't seem to be any problem with the server,
because I can transfer to the server from the same Windows machine using
WinSCP. There don't seem to be any problems with directory permissions,
etc.

Any suggestions would be greatly appreciated.

Matthew Fleming

On Sun, Dec 20, 2015 at 12:11 PM, Matthew Voss <ormris_at_ormris.us> wrote:

> Do you have access to the cmake build file? It should be CMakeLists.txt
> under the root directory. Cmake should be able to generate all the
> necessary build files.
>
> Matthew
>
> On December 20, 2015 9:44:57 AM PST, Matthew Fleming <mgflem_at_gmail.com>
> wrote:
>
>> Hi,
>>
>> I'm trying to build libssh2 for use under Windows. I am using Visual
>> Studio Community 2015 under Windows 10. I tried opening the Visual Studio
>> Solution under libssh2-1.6.0/win. Trying to build this solution produces
>> the following error:
>>
>> 1>cl : Command line error D8016: '/ZI' and '/Gy-' command-line options
>> are incompatible
>> 2>cl : Command line error D8016: '/ZI' and '/Gy-' command-line options
>> are incompatible
>>
>> When I remove the /ZI switch I get this error:
>>
>> version.c
>> 1>C:\Program Files (x86)\Windows
>> Kits\10\Include\10.0.10240.0\ucrt\stdio.h(1925): warning C4005: 'snprintf':
>> macro redefinition
>> 1> ..\win32\libssh2_config.h(27): note: see previous definition of
>> 'snprintf'
>> 1>C:\Program Files (x86)\Windows
>> Kits\10\Include\10.0.10240.0\ucrt\stdio.h(1927): fatal error C1189: #error:
>> Macro definition of snprintf conflicts with Standard Library function
>> declaration
>> 1> wincng.c
>> 1>C:\Program Files (x86)\Windows
>> Kits\10\Include\10.0.10240.0\ucrt\stdio.h(1925): warning C4005: 'snprintf':
>> macro redefinition
>> 1> ..\win32\libssh2_config.h(27): note: see previous definition of
>> 'snprintf'
>> 1>C:\Program Files (x86)\Windows
>> Kits\10\Include\10.0.10240.0\ucrt\stdio.h(1927): fatal error C1189: #error:
>> Macro definition of snprintf conflicts with Standard Library function
>> declaration
>>
>> I get the same snprintf error if I use nmake.
>>
>> Advice as to how to solve these problems would be greatly appreciated,
>> thanks.
>>
>> Matthew Fleming
>>
>>
>> ------------------------------
>>
>> libssh2-devel http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel
>>
>>
> --
> Sent from my Android device with K-9 Mail. Please excuse my brevity.
>

_______________________________________________
libssh2-devel http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel
Received on 2015-12-20

the libssh2 team