You are not logged in.

#1 2021-11-14 09:00:44

Registered: 2009-05-23
Posts: 175

i686-w64-mingw32-meson to honor -Doptimization=0

Hi. I want to cross-compile a program for a Windows host and with debug info. I added --buildtype=debug PKGBUILD like I do for native compilations, but it didn't work:


Sanity check compiler command line: i686-w64-mingw32-gcc sanitycheckc.c -o sanitycheckc_cross.exe -D_FORTIFY_SOURCE=2 -D_GLIBCXX_ASSERTIONS -O2 ...

Only patching the *.meson file below allowed me to change -O2 to -O0. What am I doing wrong?


_architectures="i686-w64-mingw32 x86_64-w64-mingw32"

build() {
  cd "${srcdir}/libnice"
  for _arch in $_architectures; do
    mkdir -p "build-${_arch}" && pushd build-${_arch}
    ${_arch}-meson \
      --buildtype=debug \
      -D strip=false \
      -D optimization=0 \

/usr/share/mingw/toolchain-i686-w64-mingw32.meson ( AUR )

[built-in options]
c_args = ['-D_FORTIFY_SOURCE=2', '-D_GLIBCXX_ASSERTIONS', '-O2', '-pipe', '-fno-plt', '-fexceptions', '--param=ssp-buffer-size=4', '-Wformat', '-Werror=format-security', '-fcf-protection']

Last edited by leniviy (2021-11-14 09:03:07)

Arch 64, xfce4


#2 2021-11-14 13:13:06

From: Netherlands, Europe
Registered: 2005-10-04
Posts: 9,596

Re: i686-w64-mingw32-meson to honor -Doptimization=0

$ more /usr/bin/arch-meson
#!/bin/bash -ex
# Highly opinionated wrapper for Arch Linux packaging

exec meson setup \
  --prefix        /usr \
  --libexecdir    lib \
  --sbindir       bin \
  --buildtype     plain \
  --auto-features enabled \
  --wrap-mode     nodownload \
  -D              b_lto=true \
  -D              b_pie=true \

don't use arch-meson , set desired options yourself.
[1] has some details, for a practical (though slightly different) example see the build() function  in [2] .

[1] … y_directly
[2] … inimal-git

Disliking systemd intensely, but not satisfied with alternatives so focusing on taming systemd.
Did you use the guided installer ? If yes, I can't help you.

(A works at time B)  && (time C > time B ) ≠  (A works at time C)


Board footer

Powered by FluxBB