Common build error

Questions, problems and discussion about compiling FreeOrion.

Moderator: Oberlus

Message
Author
georgido
Space Floater
Posts: 24
Joined: Sat Jan 12, 2013 4:56 pm

Re: Common build error

#16 Post by georgido »

Geoff the Medio wrote:or a logging issue... Does your Windows username have non-latin characters in it? Issues with them seemed to have been fixed a few months ago, but it's possble there are still issues.
when i was installing windows i had used a name with non-latin characters, but then i changed that to a latin-character one from the control panel... however i just created another user account and now it runs just fine... so i guess you were right...

User avatar
Geoff the Medio
Programming, Design, Admin
Posts: 12770
Joined: Wed Oct 08, 2003 1:33 am
Location: Munich

Re: Common build error

#17 Post by Geoff the Medio »

georgido wrote:when i was installing windows i had used a name with non-latin characters, but then i changed that to a latin-character one from the control panel... however i just created another user account and now it runs just fine... so i guess you were right...
That's irritating. Can you try to hunt down where the crash is happening with your non-latin name? My guess is that the Ogre logger or the general FreeOrion logger (log4cpp) are not converting the UTF-8 or UTF-16 path strings properly. If you can step through the code or add some debugging lines to check how the pathes are being handled and identify where the crash happens, that would be useful.

georgido
Space Floater
Posts: 24
Joined: Sat Jan 12, 2013 4:56 pm

Re: Common build error

#18 Post by georgido »

Code: Select all

void FileAppender::_append(const LoggingEvent& event) {
    std::string message(_getLayout().format(event));
    if (!::write(_fd, message.data(), message.length())) {
        // XXX help! help!
    }
}
the game crashes after reaching the if-statement... that's in FileAppender.cpp. had one cout before the if-block and one after it, but the one after was never reached...

User avatar
Geoff the Medio
Programming, Design, Admin
Posts: 12770
Joined: Wed Oct 08, 2003 1:33 am
Location: Munich

Re: Common build error

#19 Post by Geoff the Medio »

Does it help if you modify CategoryStream::flush() in CategoryStream.cpp to be this:

Code: Select all

    void CategoryStream::flush() {
        try {
            if (_buffer) {
                getCategory().log(getPriority(), _buffer->str());
                delete _buffer;
                _buffer = NULL;
            }
        } catch (...) {
            // logging failed...
        }
    }
Probably a long shot, but maybe worth a try to wrap it in a try-cach block.

georgido
Space Floater
Posts: 24
Joined: Sat Jan 12, 2013 4:56 pm

Re: Common build error

#20 Post by georgido »

Geoff the Medio wrote:Does it help if you modify CategoryStream::flush() in CategoryStream.cpp to be this:

Code: Select all

    void CategoryStream::flush() {
        try {
            if (_buffer) {
                getCategory().log(getPriority(), _buffer->str());
                delete _buffer;
                _buffer = NULL;
            }
        } catch (...) {
            // logging failed...
        }
    }
Probably a long shot, but maybe worth a try to wrap it in a try-cach block.
nope, still the same...

User avatar
Geoff the Medio
Programming, Design, Admin
Posts: 12770
Joined: Wed Oct 08, 2003 1:33 am
Location: Munich

Re: Common build error

#21 Post by Geoff the Medio »

Can you modify this function with the cout line and tell me if / what is output on the console before the crash?

Code: Select all

    void FileAppender::_append(const LoggingEvent& event) {
        std::string message(_getLayout().format(event));
        std::cout << "_fd: " << _fd << std::endl;
        if (!::write(_fd, message.data(), message.length())) {
            // XXX help! help!
        }
    }
Edit: And may try putting

Code: Select all

        if (_fd == -1)
            return;
after the cout line.

georgido
Space Floater
Posts: 24
Joined: Sat Jan 12, 2013 4:56 pm

Re: Common build error

#22 Post by georgido »

Geoff the Medio wrote:Can you modify this function with the cout line and tell me if / what is output on the console before the crash?

Code: Select all

    void FileAppender::_append(const LoggingEvent& event) {
        std::string message(_getLayout().format(event));
        std::cout << "_fd: " << _fd << std::endl;
        if (!::write(_fd, message.data(), message.length())) {
            // XXX help! help!
        }
    }
Edit: And may try putting

Code: Select all

        if (_fd == -1)
            return;
after the cout line.
it was indeed -1 and after putting the return statement the game runs normally... just to mention it, fd was printed more than one time, if that means anything...

User avatar
Geoff the Medio
Programming, Design, Admin
Posts: 12770
Joined: Wed Oct 08, 2003 1:33 am
Location: Munich

Re: Common build error

#23 Post by Geoff the Medio »

georgido wrote:it was indeed -1 and after putting the return statement the game runs normally...
Except that you won't get any log files... except maybe ogre.log; does that get created?

This suggests it's unable to create the file for some reason, likely due to the log4cpp code not handling the non-latin pathes correctly, or not being fed them in a form it can use.
just to mention it, fd was printed more than one time, if that means anything...
It should print it out every time the game tries to write something to the log file.

georgido
Space Floater
Posts: 24
Joined: Sat Jan 12, 2013 4:56 pm

Re: Common build error

#24 Post by georgido »

Geoff the Medio wrote:except maybe ogre.log; does that get created?
well aside from the empty freeorion file now there is a freeoriond file but no ogre.log

User avatar
Geoff the Medio
Programming, Design, Admin
Posts: 12770
Joined: Wed Oct 08, 2003 1:33 am
Location: Munich

Re: Common build error

#25 Post by Geoff the Medio »

Does freeoriond.log contain anything?

If you felt like looking into the logger initialization and what the path string it gets sent is, that might be helpful. I don't have time at the moment to point you to the right place to look, though.

georgido
Space Floater
Posts: 24
Joined: Sat Jan 12, 2013 4:56 pm

Re: Common build error

#26 Post by georgido »

Geoff the Medio wrote:Does freeoriond.log contain anything?

If you felt like looking into the logger initialization and what the path string it gets sent is, that might be helpful. I don't have time at the moment to point you to the right place to look, though.
there were two lines:
2013-01-14 22:30:22,028 DEBUG Server : (ServerFSM) Idle
2013-01-14 22:30:22,028 DEBUG Server : FreeOrion server waiting for network events

once i get more familiar with the code (actually first day looking at it) i guess i'll give it a look...

User avatar
Geoff the Medio
Programming, Design, Admin
Posts: 12770
Joined: Wed Oct 08, 2003 1:33 am
Location: Munich

Re: Common build error

#27 Post by Geoff the Medio »

georgido wrote:
Geoff the Medio wrote:Does freeoriond.log contain anything?
there were two lines:
2013-01-14 22:30:22,028 DEBUG Server : (ServerFSM) Idle
2013-01-14 22:30:22,028 DEBUG Server : FreeOrion server waiting for network events
That's bizzare... Why would the client be unable to write to its log file, while the server can do so fine at almost the same file location?

User avatar
Geoff the Medio
Programming, Design, Admin
Posts: 12770
Joined: Wed Oct 08, 2003 1:33 am
Location: Munich

Re: Common build error

#28 Post by Geoff the Medio »

Looks like there is a bit of a difference in how the client and server log file pathes are set up. Could you try this patch to see if it gets the client log working with the non-latin username?
Attachments

[The extension patch has been deactivated and can no longer be displayed.]


georgido
Space Floater
Posts: 24
Joined: Sat Jan 12, 2013 4:56 pm

Re: Common build error

#29 Post by georgido »

Geoff the Medio wrote:Looks like there is a bit of a difference in how the client and server log file pathes are set up. Could you try this patch to see if it gets the client log working with the non-latin username?
something's wrong with line 15 from the patch file...

std::ofstream : Error:type name not allowed
temp: Error:expected a ';'
also temp is considered undefined on line 16

User avatar
Geoff the Medio
Programming, Design, Admin
Posts: 12770
Joined: Wed Oct 08, 2003 1:33 am
Location: Munich

Re: Common build error

#30 Post by Geoff the Medio »

georgido wrote:something's wrong with line 15 from the patch file...
Weird... It looks fine to me... I guess it didn't apply properly for you. Try manually replacing these lines of HumanClientApp.cpp (around line 194)...

Code: Select all

    boost::filesystem::path log_path = GetUserDir() / "freeorion.log";

    // erase old log
    boost::filesystem::ofstream temp(log_path);
    temp.close();

    std::string LOG_FILENAME = PathString(log_path);

    log4cpp::Appender* appender = new log4cpp::FileAppender("FileAppender", LOG_FILENAME);
with this

Code: Select all

    const std::string HUMAN_CLIENT_LOG_FILENAME((GetUserDir() / "freeorion.log").string());

    // a platform-independent way to erase the old log
    std::ofstream temp(HUMAN_CLIENT_LOG_FILENAME.c_str());
    temp.close();

    log4cpp::Appender* appender = new log4cpp::FileAppender("FileAppender", HUMAN_CLIENT_LOG_FILENAME);

Post Reply