Skip to content

Assertion failure with new ArchLinux makepkg flags. #2416

@patrick96

Description

@patrick96

Checklist

  • I have read the appropriate section in the contributing
    guidelines
  • I believe this issue is a problem with polybar itself and not a misconfiguration on my part.
  • I have searched for other open and closed issues that
    may have already reported this problem.
  • I have checked the known issues page for this problem.

Describe the bug

Archlinux has recently changed the default flags for makepkg. This causes a crash in polybar:

/usr/include/c++/10.2.0/bits/basic_string.h:1116: std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::reference std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::back() [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>; std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::reference = char&]: Assertion '!empty()' failed.

The new flags are:

CFLAGS="-march=x86-64 -mtune=generic -O2 -pipe -fno-plt -fexceptions \
        -Wp,-D_FORTIFY_SOURCE=2,-D_GLIBCXX_ASSERTIONS \
        -Wformat -Werror=format-security \
        -fstack-clash-protection -fcf-protection"

Was it working before?

  • Did you also experience this bug in an earlier version of polybar (yes/no/don't know)? No
  • If no, what was the last version where this worked correctly? This seems to be independent of the polybar version but depends on the build flags.

To Reproduce

Either install polybar from the AUR. Or use the following cmake command:

cd build
cmake -DCMAKE_CXX_FLAGS=" -march=x86-64 -mtune=generic -O2 -pipe -fno-plt -fexceptions         -Wp,-D_FORTIFY_SOURCE=2,-D_GLIBCXX_ASSERTIONS         -Wformat -Werror=format-security         -fstack-clash-protection -fcf-protection -Wall -Wextra -Wpedantic -O3 -DNDEBUG" ..
make -j polybar

The following cmake command will also trigger the bug:

cmake -DCMAKE_BUILD_TYPE=Debug -DCMAKE_CXX_FLAGS="-D_GLIBCXX_ASSERTIONS" ..

Then running polybar with the sample config will result in an error, I am working on finding a minimal config.

EDIT: It seems that the bug lies in the i3 module. The following config reproduces the bug:

[bar/example]
modules-left = i3

[module/i3]
type = internal/i3

The bug should only occur if you are not running i3.

Polybar Log

notice: Parsing config file: /home/patrick96/polybar/config.ini
error: Disabling module "bspwm" (reason: Could not find socket: /tmp/bspwm_0_0-socket)
/usr/include/c++/10.2.0/bits/basic_string.h:1116: std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::reference std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::back() [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>; std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::reference = char&]: Assertion '!empty()' failed.

Environment:

  • WM: HLWM
  • Distro: ArchLinux
  • Output of polybar -vvv:
polybar 3.5.5

Features: +alsa +curl +i3 +mpd +network(libnl) +pulseaudio +xkeyboard

X extensions: +randr (+monitors) +composite +xkb +xrm +xcursor

Build type: Release
Compiler: /usr/lib/ccache/bin/c++
Compiler flags: -march=x86-64 -mtune=generic -O2 -pipe -fno-plt -fexceptions         -Wp,-D_FORTIFY_SOURCE=2,-D_GLIBCXX_ASSERTIONS         -Wformat -Werror=format-security         -fstack-clash-protection -fcf-protection -Wall -Wextra -Wpedantic -O3 -DNDEBUG

Additional context

There are two workarounds available:

  • Override the makepkg flags: makepkg -sri CXXFLAGS=""
    This has to be run in a clean AUR repo (there can't be an existing src folder)
  • Build polybar directly from either a release tarball or the github repo: https://github.com/polybar/polybar/wiki/Compiling

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions