Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: FTP does not work in release mode.  (Read 3015 times)

0 Members and 1 Guest are viewing this topic.

JAKUBW

  • Newbie
  • *
  • Posts: 8
    • View Profile
FTP does not work in release mode.
« on: July 26, 2016, 02:40:39 pm »
Hey all,
I am creating game and i need download additional music file from internet. I tried do it and... I did.
But there is a problem. Program works only in debug mode. When i switch to release and i try download or upload file it crashes. Code:

#include <SFML/Network.hpp>
#include <iostream>

using namespace sf;
using namespace std;

// Normally there are good texts
string login = "";
string password= "";
string adres = "";
int main()
{
    Ftp ftp;
    Ftp::Response odp = ftp.connect(sf::IpAddress(adres.c_str()),21,sf::seconds(3));
    if(odp.isOk())
        cout<<"Connected!"<<endl;
    else
    {
        cout<<"Connecting error!"<<endl;
        getchar();
        return 1;
    }
    odp = ftp.login(login,password);
    if(odp.isOk())
        cout<<"Login succes!"<<endl;
    else
    {
        cout<<"Bad login or password"<<endl;
        cin.get();
        return 1;
    }
    cout<<"Downloading..."<<endl;
    odp = ftp.download("VexentoGlow.ogg","",sf::Ftp::Binary);
    if(odp.isOk())
        cout<<"Download complete!"<<endl;
    else
        cout<<"Error!"<<endl;
    getchar();
    ftp.disconnect();
    return 0;
}
 

It crashes in:
ftp.download("VexentoGlow.ogg","",sf::Ftp::Binary);

In debug mode it works good. It is SFML bug I suppose. :)
Please help!

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11030
    • View Profile
    • development blog
    • Email
Re: FTP does not work in release mode.
« Reply #1 on: July 26, 2016, 03:08:12 pm »
What's your SFML version? What's the call stack when it crashes?
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

JAKUBW

  • Newbie
  • *
  • Posts: 8
    • View Profile
Re: FTP does not work in release mode.
« Reply #2 on: July 26, 2016, 03:26:44 pm »
I use SFML 2.3.2 windows gcc 4.9.2 mingw 32-bit

#0 0x6fc61225   ??() (C:\Users\Jakubek\Desktop\FTP\bin\Release\libstdc++-6.dll:??)
#1 0x6fc61662   ??() (C:\Users\Jakubek\Desktop\FTP\bin\Release\libstdc++-6.dll:??)
#2 0x6fcae634   ??() (C:\Users\Jakubek\Desktop\FTP\bin\Release\libstdc++-6.dll:??)
#3 0x6fcb1119   ??() (C:\Users\Jakubek\Desktop\FTP\bin\Release\libstdc++-6.dll:??)
#4 0x6fcb2c82   ??() (C:\Users\Jakubek\Desktop\FTP\bin\Release\libstdc++-6.dll:??)
#5 0x6fcb46bb   ??() (C:\Users\Jakubek\Desktop\FTP\bin\Release\libstdc++-6.dll:??)
#6 0x69884a39   _fu152___ZTTSt14basic_ofstreamIcSt11char_traitsIcEE() (C:\Users\Jakubek\Desktop\FTP\bin\Release\sfml-network-2.dll:??)
#7 0x47c40e   ?? () (??:??)
#8 0x4010fd   ?? () (??:??)
#9 0x770537eb   ntdll!RtlInitializeExceptionChain() (C:\Windows\system32\ntdll.dll:??)
#10 0x770537be   ntdll!RtlInitializeExceptionChain() (C:\Windows\system32\ntdll.dll:??)
#11 ??   ?? () (??:??)

And Windows 7 write: SFML.exe has stopped working.
« Last Edit: July 26, 2016, 03:31:35 pm by JAKUBW »

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11030
    • View Profile
    • development blog
    • Email
AW: FTP does not work in release mode.
« Reply #3 on: July 26, 2016, 05:02:02 pm »
So it crashes somewhere in libstdc++. Can you provide the full build command for your application?
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

JAKUBW

  • Newbie
  • *
  • Posts: 8
    • View Profile
Re: FTP does not work in release mode.
« Reply #4 on: July 27, 2016, 10:52:22 am »
Build log:

-------------- Build: Release in SFML (compiler: GNU GCC Compiler)---------------

mingw32-g++.exe -Wall -O2 -IC:\Users\Jakubek\SFML\include -c C:\Users\Jakubek\Desktop\FTP\main.cpp -o obj\Release\main.o
mingw32-g++.exe -LC:\Users\Jakubek\SFML\lib -o bin\Release\SFML.exe obj\Release\main.o  -static -static-libgcc -s  -lsfml-graphics -lsfml-audio -lsfml-main -lsfml-network -lsfml-system -lsfml-window
Output file is bin\Release\SFML.exe with size 544.50 KB
Process terminated with status 0 (0 minute(s), 0 second(s))
0 error(s), 0 warning(s) (0 minute(s), 0 second(s))

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11030
    • View Profile
    • development blog
    • Email
AW: FTP does not work in release mode.
« Reply #5 on: July 27, 2016, 12:29:27 pm »
Kind of what I expected. You're using the dynamic version of SFML which links dynamically against the runtime libraries, yet you link your app statically against the runtime libs. That way you end up with two different runtime libs being used, which can/will cause crashes.
Either use the static SFML version that links statically against the runtime libs (you have to build them yourself), or remove the -static and -static-libgcc flags.
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

 

anything