DarkflameUniverse / DarkflameServer

The main repository for the Darkflame Universe Server Emulator project.
https://www.darkflameuniverse.org/
GNU Affero General Public License v3.0
654 stars 173 forks source link

BUILD: Building with backtrace flag fails #210

Closed leolion3 closed 2 years ago

leolion3 commented 2 years ago

Platform

Ubuntu

Architecture

x86

Error Logs

Compiling using the __include_backtrace flag does not work. CMakeVariables:

PROJECT_VERSION_MAJOR=1
PROJECT_VERSION_MINOR=0
PROJECT_VERSION_PATCH=0
# LICENSE
LICENSE=AGPL-3.0
# The network version.
# 171023 - Darkflame Universe client
# 171022 - Unmodded client
NET_VERSION=171022
# Debugging
 __dynamic=1
# Set __dynamic to 1 to enable the -rdynamic flag for the linker, yielding some symbols in crashlogs.
 __ggdb=1
# Set __ggdb to 1 to enable the -ggdb flag for the linker, including more debug info.
 __include_backtrace__=1
# Set __include_backtrace__ to 1 to includes the backtrace library for better crashlogs.
 __compile_backtrace__=1
# Set __compile_backtrace__ to 1 to compile the backtrace library instead of using system libraries.

Stack trace:

libdCommon.a(Diagnostics.cpp.o): In function `CatchUnhandled(int)':
Diagnostics.cpp:(.text+0x8c8): undefined reference to `backtrace_create_state'
Diagnostics.cpp:(.text+0xa5e): undefined reference to `backtrace_print'
Diagnostics.cpp:(.text+0xa7d): undefined reference to `backtrace_print'
collect2: error: ld returned 1 exit status
CMakeFiles/AuthServer.dir/build.make:103: recipe for target 'AuthServer' failed
make[2]: *** [AuthServer] Error 1
CMakeFiles/Makefile2:466: recipe for target 'CMakeFiles/AuthServer.dir/all' failed

Same stack trace happens for the other servers aswell (WorldServer, ChatServer and MasterServer)

Note: I have merged commit 259c236 and this is still an issue

codeshaunted commented 2 years ago

What compiler and linker?

leolion3 commented 2 years ago

As stated in #202 gcc (Ubuntu 7.5.0-3ubuntu1~18.04) 7.5.0

leolion3 commented 2 years ago

Done some debugging, in dCommon/Diagnostics.cpp

struct backtrace_state* state = backtrace_create_state(
        Diagnostics::GetProcessFileName().c_str(),
        BACKTRACE_SUPPORTS_THREADS,
        ErrorCallback,
        nullptr);

    struct bt_ctx ctx = {state, 0};
    Bt(state);

backtrace_create_state cant be resolved for whatever reason, running on Ubuntu 18.04 and I've made sure that backtrace.h does indeed exist.