Pcsx2: compiling with musl libc fails due to backtrace() being available in glibc only

Created on 2 Jan 2019  路  18Comments  路  Source: PCSX2/pcsx2

PCSX2 version:
latest git (67a6f31b8828194269aec7ac030e00948200ab20)

Description of the issue:
the wxStackWalker feature of wxWidgets relies on the gnu extension backtrace(), and as such is not available on systems with libc other than glibc. This makes compilation fail.

How to reproduce the issue:
try to compile on a linux distribution that utilizes musl libc (e.g Alpine Linux)

Most helpful comment

Otherwise use a real libc

A proper program doesn't depend on non standard/portable compiler extensions, or at the very least can be configured to not use them.

All 18 comments

Wouldn't this be a wx problem first of all?
Ok it seems like they have their checks for that...
https://github.com/wxWidgets/wxWidgets/commit/eaff0f0d3f7828c2acd9ebde4979acc0b3fa43b5

So, did you try to just set wxUSE_STACKWALKER to 0?

from :

#if wxUSE_STACKWALKER

class WXDLLIMPEXP_FWD_BASE wxStackFrame;

and I get

/home/pmos/pcsx2/pcsx2/gui/AppAssert.cpp:43:34: error: 'wxStackFrame' does not name a type; did you mean 'GtkFrame'?
  virtual void OnStackFrame(const wxStackFrame& frame)

so wxUSE_STACKWALKER is probably set to 0 because wxWidgets have figured out during compilation that backtrace() isn't a thing

So it seems they expect the app to check wxUSE_STACKWALKER?
would make more sense to name it wxCAN_I_USE_STACKWALKER then

it's not like setting it to 1 would solve anything

I said put 0?
It s not being forced anywhere else otherwise.

/home/pmos/pcsx2/pcsx2/gui/AppAssert.cpp:43:34: error: 'wxStackFrame' does not name a type; did you mean 'GtkFrame'?

still.

because of:

#if wxUSE_STACKWALKER

class WXDLLIMPEXP_FWD_BASE wxStackFrame;

still

Just add the wx macro on our side to skip debugger backtrace.

Otherwise use a real libc ;) PCSX2 isn't designed to run on embedded card. Saving few MB of ram is pointless.

Otherwise use a real libc

A proper program doesn't depend on non standard/portable compiler extensions, or at the very least can be configured to not use them.

Also, you have Android (x86) in long-term goals, and bionic libc doesn't support backtrace either

and if this is only dependency on glibc extensions, it's not much hard work for the portability

So, does it work if you ifdef in AppAssert or not?

it compiles, I didn't have the opportunity to test it yet

I can't even package it, because of this:

>>> ERROR: pcsx2*: Found textrels:
TEXTREL  /home/pmos/build/pkg/pcsx2/usr/bin/PCSX2
TEXTREL  /home/pmos/build/pkg/pcsx2/usr/lib/pcsx2/libcdvdGigaherz.so
TEXTREL  /home/pmos/build/pkg/pcsx2/usr/lib/pcsx2/libonepad-legacy.so
TEXTREL  /home/pmos/build/pkg/pcsx2/usr/lib/pcsx2/libonepad.so
TEXTREL  /home/pmos/build/pkg/pcsx2/usr/lib/pcsx2/libUSBnull-0.7.0.so
TEXTREL  /home/pmos/build/pkg/pcsx2/usr/lib/pcsx2/libdev9null-0.5.0.so
TEXTREL  /home/pmos/build/pkg/pcsx2/usr/lib/pcsx2/libspu2x-2.0.0.so
TEXTREL  /home/pmos/build/pkg/pcsx2/usr/lib/pcsx2/libFWnull-0.7.0.so
TEXTREL  /home/pmos/build/pkg/pcsx2/usr/lib/pcsx2/libGSdx.so
>>> ERROR: pcsx2*: prepare_subpackages failed
>>> ERROR: pcsx2: rootpkg failed

it seems that check cannot by bypassed. Any chance there is a switch to do it the right way?

We don't use fpic because it is slower and might clash with som asm code (most of asm code ws ported to intrinsic so it might be fine now). Fpic doesn't provide any gain for us as we won't load multiples plugins. But you're free to add it for your package.

uh, you can use backtrace under musl pretty easily. In alpine, just install libexecinfo-dev. It's an extension library done _properly_ - that is, outside the libc.

I use it in my projects, works perfectly fine.

The problem here is telling WX that.

On my alpine system, adding libexecinfo-dev and adding #define wxUSE_STACKWALKER 1 before including stackwalker.h in AppAssert.cpp works for me. Well, mostly - Alpine's WX is built without stackwalker support.

So yeah, I'm going to ifdef it out for now as mentioned above while I ask Alpine to fix it on their end,

Was this page helpful?
0 / 5 - 0 ratings

Related issues

GeekyGami picture GeekyGami  路  3Comments

mirh picture mirh  路  6Comments

RinMaru picture RinMaru  路  5Comments

vgturtle127 picture vgturtle127  路  4Comments

BroKill picture BroKill  路  4Comments