NixOS / nixpkgs

Nix Packages collection & NixOS
MIT License
18.19k stars 14.2k forks source link

mingw cross-compiler is broken when invoked outside of nix #144126

Open bgamari opened 3 years ago

bgamari commented 3 years ago

Describe the bug

Attempting to use pkgsCross.mingwW64.stdenv.cc to cross-compile a simple Hello World program fails with a linker error.

Steps To Reproduce

Steps to reproduce the behavior:

  1. Write a simple C program, hi.c
  2. nix run -f ~/nixpkgs pkgsCross.mingwW64.stdenv.cc -c x86_64-w64-mingw32-cc hi.c
  3. Observe that it fails:
    /nix/store/40hb0cp3xl4cr14zxdp8lr5kf9lb594w-x86_64-w64-mingw32-binutils-2.35.1/bin/x86_64-w64-mingw32-ld: cannot find -lmcfgthread
    collect2: error: ld returned 1 exit status

Expected behavior

It should produce an executable

Additional context

Tested with nixpkgs from late September (7728136201023022493e85e790ccc719516aab3c).

Notify maintainers

@Ericson2314, who introduced the mcfgthreads dependency in https://github.com/NixOS/nixpkgs/pull/73195

Metadata

Please run nix-shell -p nix-info --run "nix-info -m" and paste the result.

[user@system:~]$ nix-shell -p nix-info --run "nix-info -m"
output here

Maintainer information:

# a list of nixpkgs attributes affected by the problem
attribute:
# a list of nixos modules affected by the problem
module:
bgamari commented 3 years ago

With NIX_DEBUG=1 the compiler emits:

$ NIX_DEBUG=1 nix run -f ~/nixpkgs pkgsCross.mingwW64.stdenv.cc -c x86_64-w64-mingw32-cc hi.c
HARDENING: disabled flags: pie pic format stackprotector fortify strictoverflow
extra flags before to /nix/store/pwyviik8vc54mf1gdbh4gi0l4qw8snmw-x86_64-w64-mingw32-stage-final-gcc-debug-10.3.0/bin/x86_64-w64-mingw32-gcc:
  ''     
original flags to /nix/store/pwyviik8vc54mf1gdbh4gi0l4qw8snmw-x86_64-w64-mingw32-stage-final-gcc-debug-10.3.0/bin/x86_64-w64-mingw32-gcc:
  hi.c                                                                                        
extra flags after to /nix/store/pwyviik8vc54mf1gdbh4gi0l4qw8snmw-x86_64-w64-mingw32-stage-final-gcc-debug-10.3.0/bin/x86_64-w64-mingw32-gcc:
  -B/nix/store/kb99s91m3ah43bh785ana1h0anpy9a1y-x86_64-w64-mingw32-stage-final-gcc-debug-10.3.0-lib/x86_64-w64-mingw32/lib
  -B/nix/store/l2miwdlhsb80yzv6ghplcp3qc8c2ikp4-mingw-w64-x86_64-w64-mingw32-9.0.0/lib/                                                                                                      
  -idirafter                                                                                                                                                                                 
  /nix/store/1mmpln1vnzj7jhb4pj48aavgpbdfzlsx-mingw-w64-x86_64-w64-mingw32-9.0.0-dev/include
  -idirafter                                                                                                                                                                                 
  /nix/store/pwyviik8vc54mf1gdbh4gi0l4qw8snmw-x86_64-w64-mingw32-stage-final-gcc-debug-10.3.0/lib/gcc/x86_64-w64-mingw32/10.3.0/include-fixed
  -B/nix/store/ns64vr3cx6hfxz03r49749md22z4pp55-x86_64-w64-mingw32-stage-final-gcc-debug-wrapper-10.3.0/bin/                                                               
  -L/nix/store/l2miwdlhsb80yzv6ghplcp3qc8c2ikp4-mingw-w64-x86_64-w64-mingw32-9.0.0/lib                                                                                                       
  -L/nix/store/kb99s91m3ah43bh785ana1h0anpy9a1y-x86_64-w64-mingw32-stage-final-gcc-debug-10.3.0-lib/x86_64-w64-mingw32/lib
HARDENING: disabled flags: relro pie bindnow
extra flags before to /nix/store/40hb0cp3xl4cr14zxdp8lr5kf9lb594w-x86_64-w64-mingw32-binutils-2.35.1/bin/x86_64-w64-mingw32-ld:
  ''      
original flags to /nix/store/40hb0cp3xl4cr14zxdp8lr5kf9lb594w-x86_64-w64-mingw32-binutils-2.35.1/bin/x86_64-w64-mingw32-ld:                                                                  
  -plugin  
  /nix/store/pwyviik8vc54mf1gdbh4gi0l4qw8snmw-x86_64-w64-mingw32-stage-final-gcc-debug-10.3.0/libexec/gcc/x86_64-w64-mingw32/10.3.0/liblto_plugin.so                                         
  -plugin-opt=/nix/store/pwyviik8vc54mf1gdbh4gi0l4qw8snmw-x86_64-w64-mingw32-stage-final-gcc-debug-10.3.0/libexec/gcc/x86_64-w64-mingw32/10.3.0/lto-wrapper                                  
  -plugin-opt=-fresolution=/tmp/ccJ4R7Gd.res
  -plugin-opt=-pass-through=-lmingw32
  -plugin-opt=-pass-through=-lgcc
  -plugin-opt=-pass-through=-lgcc_eh
  -plugin-opt=-pass-through=-lmoldname
  -plugin-opt=-pass-through=-lmingwex
  -plugin-opt=-pass-through=-lmsvcrt
  -plugin-opt=-pass-through=-lmcfgthread
  -plugin-opt=-pass-through=-ladvapi32
  -plugin-opt=-pass-through=-lshell32
  -plugin-opt=-pass-through=-luser32                                                          
  -plugin-opt=-pass-through=-lkernel32                                                                                                                                                       
  -plugin-opt=-pass-through=-lmingw32
  -plugin-opt=-pass-through=-lgcc                                                                                                                                                            
  -plugin-opt=-pass-through=-lgcc_eh      
  -plugin-opt=-pass-through=-lmoldname  
  -plugin-opt=-pass-through=-lmingwex                                                                                                                                                        
  -plugin-opt=-pass-through=-lmsvcrt                                                          
  -m                                                                                                                                                                                         
  i386pep
  -Bdynamic                                                                                                                                                                                  
  /nix/store/l2miwdlhsb80yzv6ghplcp3qc8c2ikp4-mingw-w64-x86_64-w64-mingw32-9.0.0/lib/crt2.o   
  /nix/store/l2miwdlhsb80yzv6ghplcp3qc8c2ikp4-mingw-w64-x86_64-w64-mingw32-9.0.0/lib/crtbegin.o                                             
  -L/nix/store/l2miwdlhsb80yzv6ghplcp3qc8c2ikp4-mingw-w64-x86_64-w64-mingw32-9.0.0/lib                                                                                                       
  -L/nix/store/kb99s91m3ah43bh785ana1h0anpy9a1y-x86_64-w64-mingw32-stage-final-gcc-debug-10.3.0-lib/x86_64-w64-mingw32/lib                                                                   
  -L/nix/store/kb99s91m3ah43bh785ana1h0anpy9a1y-x86_64-w64-mingw32-stage-final-gcc-debug-10.3.0-lib/x86_64-w64-mingw32/lib                                                                   
  -L/nix/store/l2miwdlhsb80yzv6ghplcp3qc8c2ikp4-mingw-w64-x86_64-w64-mingw32-9.0.0/lib      
  -L/nix/store/ns64vr3cx6hfxz03r49749md22z4pp55-x86_64-w64-mingw32-stage-final-gcc-debug-wrapper-10.3.0/bin                                                                                  
  -L/nix/store/pwyviik8vc54mf1gdbh4gi0l4qw8snmw-x86_64-w64-mingw32-stage-final-gcc-debug-10.3.0/lib/gcc/x86_64-w64-mingw32/10.3.0            
  -L/nix/store/pwyviik8vc54mf1gdbh4gi0l4qw8snmw-x86_64-w64-mingw32-stage-final-gcc-debug-10.3.0/lib/gcc/x86_64-w64-mingw32/10.3.0/../../../../x86_64-w64-mingw32/lib/../lib
  -L/nix/store/pwyviik8vc54mf1gdbh4gi0l4qw8snmw-x86_64-w64-mingw32-stage-final-gcc-debug-10.3.0/lib/gcc/x86_64-w64-mingw32/10.3.0/../../../../x86_64-w64-mingw32/lib                         
  /tmp/ccxjax6G.o                                                                                                                                                                            
  -lmingw32                                 
  -lgcc                                                                                                                                                                                      
  -lgcc_eh
  -lmoldname                                                                                                                                                                                 
  -lmingwex
  -lmsvcrt                                                                                                                                                                                   
  -lmcfgthread                                                                                                                                                                               
  -ladvapi32                                
  -lshell32                          
  -luser32                       
  -lkernel32                        
  -lmingw32                           
  -lgcc                              
  -lgcc_eh                          
  -lmoldname                            
  -lmingwex                           
  -lmsvcrt                           
  /nix/store/l2miwdlhsb80yzv6ghplcp3qc8c2ikp4-mingw-w64-x86_64-w64-mingw32-9.0.0/lib/crtend.o 
extra flags after to /nix/store/40hb0cp3xl4cr14zxdp8lr5kf9lb594w-x86_64-w64-mingw32-binutils-2.35.1/bin/x86_64-w64-mingw32-ld:                                                               
  ''                                 
/nix/store/40hb0cp3xl4cr14zxdp8lr5kf9lb594w-x86_64-w64-mingw32-binutils-2.35.1/bin/x86_64-w64-mingw32-ld: cannot find -lmcfgthread                                                           
collect2: error: ld returned 1 exit status
bgamari commented 3 years ago

The relevant flags do appear to be set correctly:

$ nix repl ~/nixpkgs
nix-repl> pkgsCross.mingwW64.stdenv.cc.cc.EXTRA_LDFLAGS_FOR_TARGET
[ "-Wl,-L/nix/store/5jvi65bynl0zmkcwmqi5xqw9rmi9h82w-mingw-w64-x86_64-w64-mingw32-9.0.0/lib" "-Wl,-rpath,/nix/store/5jvi65bynl0zmkcwmqi5xqw9rmi9h82w-mingw-w64-x86_64-w64-mingw32-9.0.0/lib" "-Wl,-rpath-link,/nix/store/5jvi65bynl0zmkcwmqi5xqw9rmi9h82w-mingw-w64-x86_64-w64-mingw32-9.0.0/lib" "-Wl,-L/nix/store/y2rhkkspqcbpmjald1sf1p23vhnliraf-mcfgthreads-x86_64-w64-mingw32-git/lib" "-Wl,-rpath,/nix/store/y2rhkkspqcbpmjald1sf1p23vhnliraf-mcfgthreads-x86_64-w64-mingw32-git/lib" "-Wl,-rpath-link,/nix/store/y2rhkkspqcbpmjald1sf1p23vhnliraf-mcfgthreads-x86_64-w64-mingw32-git/lib" ]

nix-repl> pkgsCross.mingwW64.stdenv.cc.cc.depsTargetTarget         
[ «derivation /nix/store/4mfk2hzwjpk7yv632j5di63bxhm4qrcn-mcfgthreads-x86_64-w64-mingw32-git.drv» ]

However, I don't understand how these flags could possibly apply at cc's runtime; they appear to only be respected by gcc's builder.sh.

bgamari commented 3 years ago

It appears that the problem is that some bit of state is set by gcc's setupHook:

$ nix-shell -A pkgsCross.mingwW64.hello
echo 'int main(void) {}' | NIX_DEBUG=0 $CC -x c -

appears to work.

This seems quite unfortunate and is IMHO this a sign of an abuse of setupHooks as it should always be possible to nix run a toolchain's executables and have something vaguely sensible happen as a result. These paths really should be set by the wrapper if at all possible.

stale[bot] commented 2 years ago

I marked this as stale due to inactivity. → More info

bgamari commented 2 years ago

This is still a problem.

zopsicle commented 1 year ago

The dependency on MCF Gthread is not only a problem with MinGW itself, but also with programs built using MinGW that link with ${pkgsCross.mingwW64.buildPackages.gcc.cc}/x86_64-w64-mingw32/lib/libstdc++.a. They need to be run with mcfgthread-12.dll in WINEPATH otherwise they won’t work.

W1M0R commented 5 months ago

This is also a problem when cross-compiling on Linux using mingw64 and golang (cgo).

I'm using the following nixpkgs revision:

    "nixpkgs": {
        "branch": "nixpkgs-unstable",
        "description": "Nix Packages collection",
        "homepage": "",
        "owner": "NixOS",
        "repo": "nixpkgs",
        "rev": "3305b2b25e4ae4baee872346eae133cf6f611783",
        "sha256": "13zs6sjkpg081l9vvlhn9d59z6spxzjrv5kmh6fxza55ax2zjm6j",
        "type": "tarball",
        "url": "https://github.com/NixOS/nixpkgs/archive/3305b2b25e4ae4baee872346eae133cf6f611783.tar.gz",
        "url_template": "https://github.com/<owner>/<repo>/archive/<rev>.tar.gz"
    },

I'm on gcc (GCC) 13.2.0.

My shell.nix file is:

{ 
  pkgs ? import ./nixpkgs.nix {
    crossSystem = {
      config = "x86_64-w64-mingw32";
      libc = "msvcrt";
    };
  }, 
  ... 
}:

pkgs.callPackage ({ 
    mkShell, 
    go, 
    nodejs_22, 
    windows, 
    pkg-config,
    go-task
  }: 

mkShell rec {

  nativeBuildInputs = [ 
    go 
    go-task
    nodejs_22
    pkg-config
  ];

  buildInputs = [ 
    windows.mingw_w64_headers 
    windows.mcfgthreads
  ];

  GOPATH = "";
  GOWORK = "off";
  GO111MODULE = "on";

   MINGW_W64_HEADERS_SRC = "${windows.mingw_w64_headers}";
  MINGW_W64_HEADERS_INCLUDE_DIR = "${MINGW_W64_HEADERS_SRC}/include";
  MINGW_W64_HEADERS_INCLUDE_EVENT_TOKEN_H = "${MINGW_W64_HEADERS_SRC}/include/eventtoken.h";

  MCFGTHREADS_SRC = "${windows.mcfgthreads}";
  MCFGTHREADS_LIB_DIR = "${windows.mcfgthreads}/lib";
  MCFGTHREADS_BIN_DIR = "${windows.mcfgthreads}/bin";
  MCFGTHREADS_INCLUDE_DIR = "${windows.mcfgthreads.dev}/include";

  XWEBVIEW_INCLUDE_DIR = builtins.toString ./src/xwebview/include;
  XWEBVIEW_INCLUDE_EVENT_TOKEN_H = builtins.toString ./src/xwebview/include/EventToken.h;
}) {}

The output of go env is:

GO111MODULE='on'
GOARCH='amd64'
GOBIN=''
GOCACHE='/home/user/.cache/go-build'
GOENV='/home/user/.config/go/env'
GOEXE='.exe'
GOEXPERIMENT=''
GOFLAGS=''
GOHOSTARCH='amd64'
GOHOSTOS='linux'
GOINSECURE=''
GOMODCACHE='/home/user/go/pkg/mod'
GONOPROXY=''
GONOSUMDB=''
GOOS='windows'
GOPATH='/home/user/go'
GOPRIVATE=''
GOPROXY='https://proxy.golang.org,direct'
GOROOT='/nix/store/1ck6bdqwjjcbkr1772gpi6ba7gkagmv7-go-1.22.3/share/go'
GOSUMDB='sum.golang.org'
GOTMPDIR=''
GOTOOLCHAIN='auto'
GOTOOLDIR='/nix/store/1ck6bdqwjjcbkr1772gpi6ba7gkagmv7-go-1.22.3/share/go/pkg/tool/linux_amd64'
GOVCS=''
GOVERSION='go1.22.3'
GCCGO='gccgo'
GOAMD64='v1'
AR='x86_64-w64-mingw32-ar'
CC='x86_64-w64-mingw32-gcc'
CXX='x86_64-w64-mingw32-g++'
CGO_ENABLED='1'
GOMOD='/home/user/some-app/src/go.mod'
GOWORK='off'
CGO_CFLAGS='-frandom-seed=w372fcw6rb -isystem /nix/store/72m3szv59j74b12dmicmayvvlikh65qc-nodejs-22.2.0/include -isystem /nix/store/m1v13sqd0h9qfvynrj20aqx17d5chkin-gtk+3-3.24.41-dev/include -isystem /nix/store/p9lrs6dpfczcmms0dawplqqiiymmi97w-at-spi2-core-2.52.0-dev/include -isystem /nix/store/ckk16ns9yyy5lk0i1l4xmgghqw055yc2-dbus-1.14.10-dev/include -isystem /nix/store/49j9xzcwvhyb6vvmcdds8wfx54nszq83-expat-2.6.2-dev/include -isystem /nix/store/gdr1ghkakyjfdj8bc6n0virwllm4zpwz-glib-2.80.2-dev/include -isystem /nix/store/qj9byzfvh7dd61kk0aglj7cwqj1xqg6l-zlib-1.3.1-dev/include -isystem /nix/store/1xcnwyx7pdmdq66xdz20fbl2q0arjzrl-libffi-3.4.6-dev/include -isystem /nix/store/z14w63wj0gk97hr06l76d4s723ynhr2k-gettext-0.21.1/include -isystem /nix/store/r717wgkg911wp6spacgbg3w2dyzybvk7-glibc-iconv-2.39/include -isystem /nix/store/ljrz822j7b6db3jnmw1jiafgrm8armcw-cairo-1.18.0-dev/include -isystem /nix/store/s0mcb1kw1a4a9vdvcm8jpsdpn6bqkljm-fontconfig-2.15.0-dev/include -isystem /nix/store/a6yfhfzpmvz8v73796djqk811p4b6wan-freetype-2.13.2-dev/include -isystem /nix/store/5yqz7al0lv1jhkmbka3ghswqk5wlxvq5-bzip2-1.0.8-dev/include -isystem /nix/store/62fdhzhrs5smykxkxvjhw3y6yck2iih4-brotli-1.1.0-dev/include -isystem /nix/store/1rdmf4lap3f82pqdlmrgj1vjs08dk5xw-libpng-apng-1.6.43-dev/include -isystem /nix/store/cy880gzg1h6awfrq7024543vicphg908-pixman-0.43.4/include -isystem /nix/store/h967azc5nfhmxjvncbim3d0mxxb8g0ky-libXext-1.3.6-dev/include -isystem /nix/store/ny34a9migrcin09zwgbkr0ymx72mvlfg-xorgproto-2024.1/include -isystem /nix/store/l04bgrdvkbxq81v7yq53nkmr7f1aiav7-libXau-1.0.11-dev/include -isystem /nix/store/gf6p8dn78x0kscxjjm20zsvgm4rb08pm-libXrender-0.9.11-dev/include -isystem /nix/store/0gxrwp9xnzb5li8i7w3q7qmm0lm808qq-libX11-1.8.9-dev/include -isystem /nix/store/y28z5yg4v9f8vi6mq97qhr8pqmf1aijx-libxcb-1.17.0-dev/include -isystem /nix/store/v76jszybl11j7y8d3ix9jc7a0qznnnmr-fribidi-1.0.13-dev/include -isystem /nix/store/gx938f6w31a0alyqm81c6fp70br4xqqy-gdk-pixbuf-2.42.11-dev/include -isystem /nix/store/l81hdkwh1v709cjxwvdy208476d59488-libtiff-4.6.0-dev/include -isystem /nix/store/cm58jpx9hqzpg0g1azm1pnif0fifk310-libdeflate-1.20/include -isystem /nix/store/50f8859fp7m1kqg56aq5bw9wk4f51gcw-libjpeg-turbo-3.0.3-dev/include -isystem /nix/store/iwfarfldqql8cnhkcm5j9bhb4bbi5giy-xz-5.4.6-dev/include -isystem /nix/store/1s817f9iyszdjkivddb9kjj8xd2kgmbs-gsettings-desktop-schemas-46.0/include -isystem /nix/store/bpmym81g25wkclbl2a468p605zg99yka-libICE-1.1.1-dev/include -isystem /nix/store/bx0aljs94vz98kyzk59xhh6f8f85d5qy-libSM-1.2.4-dev/include -isystem /nix/store/4if9vv75zicybj3zphhmfcb3m1w7i7vh-libXcomposite-0.4.6-dev/include -isystem /nix/store/bg2c3pkvs3p9jfx1gkgq8rh31p3adf8a-libXfixes-6.0.1-dev/include -isystem /nix/store/n2g1zf9x7fya009lvyrlliqbrq2gvgd3-libXcursor-1.2.2-dev/include -isystem /nix/store/9hs5bp8yhwwqgl091b3lp0vwhdy34l10-libXdamage-1.1.6-dev/include -isystem /nix/store/s7wrx0r48c9bb9ilqsrflmbsjmb3cbcv-libXi-1.8.1-dev/include -isystem /nix/store/hgmad4drs0i6n6k3hx071lhhkwdgqwas-libXrandr-1.5.4-dev/include -isystem /nix/store/gqkw1wn30p059dd1qzip7iz8zf810rx6-pango-1.52.2-dev/include -isystem /nix/store/jngq41iw8s1lxmrfxj66jyq9b10a4grd-harfbuzz-8.4.0-dev/include -isystem /nix/store/jbb1dy7fxm43zl66v1hmm8749q0cl88k-graphite2-1.3.14-dev/include -isystem /nix/store/fgvf7jj541gw38ykdsmgvgha1p074p05-libXft-2.3.8-dev/include -isystem /nix/store/3iqksxyj1832ypz89996qw0sf3h6ygwm-libGL-1.7.0-dev/include -isystem /nix/store/smacbfb82wp7ncz2rwac68jd50qxr70a-libglvnd-1.7.0-dev/include -isystem /nix/store/di7vbvn478r2gx1wlfvxvv0ani8fy4qh-wayland-1.22.0-dev/include -isystem /nix/store/q7dc4c37k3mb8c1r2fb169sk211v96kk-libXinerama-1.1.5-dev/include -isystem /nix/store/j5p7ngwqkar1dmvi9sp274gldrh33ssf-cups-2.4.7-dev/include -isystem /nix/store/23d6cba79c6csq1q8hsyakwnvw57z2jl-gmp-with-cxx-6.3.0-dev/include -isystem /nix/store/jikmr73929yzpsrabh35yaaqzli66ys8-webkitgtk-2.44.2+abi=4.0-dev/include -isystem /nix/store/v10iyckj1pml8am4r6q0cjyb0gxqp0ci-libsoup-2.74.3-dev/include -isystem /nix/store/37979sqc7yw9ps0c4xl9jjkhq0w1hw8b-libxml2-2.12.7-dev/include -isystem /nix/store/72m3szv59j74b12dmicmayvvlikh65qc-nodejs-22.2.0/include -isystem /nix/store/m1v13sqd0h9qfvynrj20aqx17d5chkin-gtk+3-3.24.41-dev/include -isystem /nix/store/p9lrs6dpfczcmms0dawplqqiiymmi97w-at-spi2-core-2.52.0-dev/include -isystem /nix/store/ckk16ns9yyy5lk0i1l4xmgghqw055yc2-dbus-1.14.10-dev/include -isystem /nix/store/49j9xzcwvhyb6vvmcdds8wfx54nszq83-expat-2.6.2-dev/include -isystem /nix/store/gdr1ghkakyjfdj8bc6n0virwllm4zpwz-glib-2.80.2-dev/include -isystem /nix/store/qj9byzfvh7dd61kk0aglj7cwqj1xqg6l-zlib-1.3.1-dev/include -isystem /nix/store/1xcnwyx7pdmdq66xdz20fbl2q0arjzrl-libffi-3.4.6-dev/include -isystem /nix/store/z14w63wj0gk97hr06l76d4s723ynhr2k-gettext-0.21.1/include -isystem /nix/store/r717wgkg911wp6spacgbg3w2dyzybvk7-glibc-iconv-2.39/include -isystem /nix/store/ljrz822j7b6db3jnmw1jiafgrm8armcw-cairo-1.18.0-dev/include -isystem /nix/store/s0mcb1kw1a4a9vdvcm8jpsdpn6bqkljm-fontconfig-2.15.0-dev/include -isystem /nix/store/a6yfhfzpmvz8v73796djqk811p4b6wan-freetype-2.13.2-dev/include -isystem /nix/store/5yqz7al0lv1jhkmbka3ghswqk5wlxvq5-bzip2-1.0.8-dev/include -isystem /nix/store/62fdhzhrs5smykxkxvjhw3y6yck2iih4-brotli-1.1.0-dev/include -isystem /nix/store/1rdmf4lap3f82pqdlmrgj1vjs08dk5xw-libpng-apng-1.6.43-dev/include -isystem /nix/store/cy880gzg1h6awfrq7024543vicphg908-pixman-0.43.4/include -isystem /nix/store/h967azc5nfhmxjvncbim3d0mxxb8g0ky-libXext-1.3.6-dev/include -isystem /nix/store/ny34a9migrcin09zwgbkr0ymx72mvlfg-xorgproto-2024.1/include -isystem /nix/store/l04bgrdvkbxq81v7yq53nkmr7f1aiav7-libXau-1.0.11-dev/include -isystem /nix/store/gf6p8dn78x0kscxjjm20zsvgm4rb08pm-libXrender-0.9.11-dev/include -isystem /nix/store/0gxrwp9xnzb5li8i7w3q7qmm0lm808qq-libX11-1.8.9-dev/include -isystem /nix/store/y28z5yg4v9f8vi6mq97qhr8pqmf1aijx-libxcb-1.17.0-dev/include -isystem /nix/store/v76jszybl11j7y8d3ix9jc7a0qznnnmr-fribidi-1.0.13-dev/include -isystem /nix/store/gx938f6w31a0alyqm81c6fp70br4xqqy-gdk-pixbuf-2.42.11-dev/include -isystem /nix/store/l81hdkwh1v709cjxwvdy208476d59488-libtiff-4.6.0-dev/include -isystem /nix/store/cm58jpx9hqzpg0g1azm1pnif0fifk310-libdeflate-1.20/include -isystem /nix/store/50f8859fp7m1kqg56aq5bw9wk4f51gcw-libjpeg-turbo-3.0.3-dev/include -isystem /nix/store/iwfarfldqql8cnhkcm5j9bhb4bbi5giy-xz-5.4.6-dev/include -isystem /nix/store/1s817f9iyszdjkivddb9kjj8xd2kgmbs-gsettings-desktop-schemas-46.0/include -isystem /nix/store/bpmym81g25wkclbl2a468p605zg99yka-libICE-1.1.1-dev/include -isystem /nix/store/bx0aljs94vz98kyzk59xhh6f8f85d5qy-libSM-1.2.4-dev/include -isystem /nix/store/4if9vv75zicybj3zphhmfcb3m1w7i7vh-libXcomposite-0.4.6-dev/include -isystem /nix/store/bg2c3pkvs3p9jfx1gkgq8rh31p3adf8a-libXfixes-6.0.1-dev/include -isystem /nix/store/n2g1zf9x7fya009lvyrlliqbrq2gvgd3-libXcursor-1.2.2-dev/include -isystem /nix/store/9hs5bp8yhwwqgl091b3lp0vwhdy34l10-libXdamage-1.1.6-dev/include -isystem /nix/store/s7wrx0r48c9bb9ilqsrflmbsjmb3cbcv-libXi-1.8.1-dev/include -isystem /nix/store/hgmad4drs0i6n6k3hx071lhhkwdgqwas-libXrandr-1.5.4-dev/include -isystem /nix/store/gqkw1wn30p059dd1qzip7iz8zf810rx6-pango-1.52.2-dev/include -isystem /nix/store/jngq41iw8s1lxmrfxj66jyq9b10a4grd-harfbuzz-8.4.0-dev/include -isystem /nix/store/jbb1dy7fxm43zl66v1hmm8749q0cl88k-graphite2-1.3.14-dev/include -isystem /nix/store/fgvf7jj541gw38ykdsmgvgha1p074p05-libXft-2.3.8-dev/include -isystem /nix/store/3iqksxyj1832ypz89996qw0sf3h6ygwm-libGL-1.7.0-dev/include -isystem /nix/store/smacbfb82wp7ncz2rwac68jd50qxr70a-libglvnd-1.7.0-dev/include -isystem /nix/store/di7vbvn478r2gx1wlfvxvv0ani8fy4qh-wayland-1.22.0-dev/include -isystem /nix/store/q7dc4c37k3mb8c1r2fb169sk211v96kk-libXinerama-1.1.5-dev/include -isystem /nix/store/j5p7ngwqkar1dmvi9sp274gldrh33ssf-cups-2.4.7-dev/include -isystem /nix/store/23d6cba79c6csq1q8hsyakwnvw57z2jl-gmp-with-cxx-6.3.0-dev/include -isystem /nix/store/jikmr73929yzpsrabh35yaaqzli66ys8-webkitgtk-2.44.2+abi=4.0-dev/include -isystem /nix/store/v10iyckj1pml8am4r6q0cjyb0gxqp0ci-libsoup-2.74.3-dev/include -isystem /nix/store/37979sqc7yw9ps0c4xl9jjkhq0w1hw8b-libxml2-2.12.7-dev/include -frandom-seed=6dblp6sqb9 -isystem /nix/store/ghksnwa980zybz0rdrl547007m2cjigf-mcfgthread-x86_64-w64-mingw32-1.6.1-dev/include -isystem /nix/store/23hp6zlr2r7bllqp40x2r8ydf5zy2l2z-mingw-w64-x86_64-w64-mingw32-11.0.1-headers/include -isystem /nix/store/ghksnwa980zybz0rdrl547007m2cjigf-mcfgthread-x86_64-w64-mingw32-1.6.1-dev/include -I/home/user/some-app/src/xwebview/include'
CGO_CPPFLAGS=''
CGO_CXXFLAGS='-frandom-seed=w372fcw6rb -isystem /nix/store/72m3szv59j74b12dmicmayvvlikh65qc-nodejs-22.2.0/include -isystem /nix/store/m1v13sqd0h9qfvynrj20aqx17d5chkin-gtk+3-3.24.41-dev/include -isystem /nix/store/p9lrs6dpfczcmms0dawplqqiiymmi97w-at-spi2-core-2.52.0-dev/include -isystem /nix/store/ckk16ns9yyy5lk0i1l4xmgghqw055yc2-dbus-1.14.10-dev/include -isystem /nix/store/49j9xzcwvhyb6vvmcdds8wfx54nszq83-expat-2.6.2-dev/include -isystem /nix/store/gdr1ghkakyjfdj8bc6n0virwllm4zpwz-glib-2.80.2-dev/include -isystem /nix/store/qj9byzfvh7dd61kk0aglj7cwqj1xqg6l-zlib-1.3.1-dev/include -isystem /nix/store/1xcnwyx7pdmdq66xdz20fbl2q0arjzrl-libffi-3.4.6-dev/include -isystem /nix/store/z14w63wj0gk97hr06l76d4s723ynhr2k-gettext-0.21.1/include -isystem /nix/store/r717wgkg911wp6spacgbg3w2dyzybvk7-glibc-iconv-2.39/include -isystem /nix/store/ljrz822j7b6db3jnmw1jiafgrm8armcw-cairo-1.18.0-dev/include -isystem /nix/store/s0mcb1kw1a4a9vdvcm8jpsdpn6bqkljm-fontconfig-2.15.0-dev/include -isystem /nix/store/a6yfhfzpmvz8v73796djqk811p4b6wan-freetype-2.13.2-dev/include -isystem /nix/store/5yqz7al0lv1jhkmbka3ghswqk5wlxvq5-bzip2-1.0.8-dev/include -isystem /nix/store/62fdhzhrs5smykxkxvjhw3y6yck2iih4-brotli-1.1.0-dev/include -isystem /nix/store/1rdmf4lap3f82pqdlmrgj1vjs08dk5xw-libpng-apng-1.6.43-dev/include -isystem /nix/store/cy880gzg1h6awfrq7024543vicphg908-pixman-0.43.4/include -isystem /nix/store/h967azc5nfhmxjvncbim3d0mxxb8g0ky-libXext-1.3.6-dev/include -isystem /nix/store/ny34a9migrcin09zwgbkr0ymx72mvlfg-xorgproto-2024.1/include -isystem /nix/store/l04bgrdvkbxq81v7yq53nkmr7f1aiav7-libXau-1.0.11-dev/include -isystem /nix/store/gf6p8dn78x0kscxjjm20zsvgm4rb08pm-libXrender-0.9.11-dev/include -isystem /nix/store/0gxrwp9xnzb5li8i7w3q7qmm0lm808qq-libX11-1.8.9-dev/include -isystem /nix/store/y28z5yg4v9f8vi6mq97qhr8pqmf1aijx-libxcb-1.17.0-dev/include -isystem /nix/store/v76jszybl11j7y8d3ix9jc7a0qznnnmr-fribidi-1.0.13-dev/include -isystem /nix/store/gx938f6w31a0alyqm81c6fp70br4xqqy-gdk-pixbuf-2.42.11-dev/include -isystem /nix/store/l81hdkwh1v709cjxwvdy208476d59488-libtiff-4.6.0-dev/include -isystem /nix/store/cm58jpx9hqzpg0g1azm1pnif0fifk310-libdeflate-1.20/include -isystem /nix/store/50f8859fp7m1kqg56aq5bw9wk4f51gcw-libjpeg-turbo-3.0.3-dev/include -isystem /nix/store/iwfarfldqql8cnhkcm5j9bhb4bbi5giy-xz-5.4.6-dev/include -isystem /nix/store/1s817f9iyszdjkivddb9kjj8xd2kgmbs-gsettings-desktop-schemas-46.0/include -isystem /nix/store/bpmym81g25wkclbl2a468p605zg99yka-libICE-1.1.1-dev/include -isystem /nix/store/bx0aljs94vz98kyzk59xhh6f8f85d5qy-libSM-1.2.4-dev/include -isystem /nix/store/4if9vv75zicybj3zphhmfcb3m1w7i7vh-libXcomposite-0.4.6-dev/include -isystem /nix/store/bg2c3pkvs3p9jfx1gkgq8rh31p3adf8a-libXfixes-6.0.1-dev/include -isystem /nix/store/n2g1zf9x7fya009lvyrlliqbrq2gvgd3-libXcursor-1.2.2-dev/include -isystem /nix/store/9hs5bp8yhwwqgl091b3lp0vwhdy34l10-libXdamage-1.1.6-dev/include -isystem /nix/store/s7wrx0r48c9bb9ilqsrflmbsjmb3cbcv-libXi-1.8.1-dev/include -isystem /nix/store/hgmad4drs0i6n6k3hx071lhhkwdgqwas-libXrandr-1.5.4-dev/include -isystem /nix/store/gqkw1wn30p059dd1qzip7iz8zf810rx6-pango-1.52.2-dev/include -isystem /nix/store/jngq41iw8s1lxmrfxj66jyq9b10a4grd-harfbuzz-8.4.0-dev/include -isystem /nix/store/jbb1dy7fxm43zl66v1hmm8749q0cl88k-graphite2-1.3.14-dev/include -isystem /nix/store/fgvf7jj541gw38ykdsmgvgha1p074p05-libXft-2.3.8-dev/include -isystem /nix/store/3iqksxyj1832ypz89996qw0sf3h6ygwm-libGL-1.7.0-dev/include -isystem /nix/store/smacbfb82wp7ncz2rwac68jd50qxr70a-libglvnd-1.7.0-dev/include -isystem /nix/store/di7vbvn478r2gx1wlfvxvv0ani8fy4qh-wayland-1.22.0-dev/include -isystem /nix/store/q7dc4c37k3mb8c1r2fb169sk211v96kk-libXinerama-1.1.5-dev/include -isystem /nix/store/j5p7ngwqkar1dmvi9sp274gldrh33ssf-cups-2.4.7-dev/include -isystem /nix/store/23d6cba79c6csq1q8hsyakwnvw57z2jl-gmp-with-cxx-6.3.0-dev/include -isystem /nix/store/jikmr73929yzpsrabh35yaaqzli66ys8-webkitgtk-2.44.2+abi=4.0-dev/include -isystem /nix/store/v10iyckj1pml8am4r6q0cjyb0gxqp0ci-libsoup-2.74.3-dev/include -isystem /nix/store/37979sqc7yw9ps0c4xl9jjkhq0w1hw8b-libxml2-2.12.7-dev/include -isystem /nix/store/72m3szv59j74b12dmicmayvvlikh65qc-nodejs-22.2.0/include -isystem /nix/store/m1v13sqd0h9qfvynrj20aqx17d5chkin-gtk+3-3.24.41-dev/include -isystem /nix/store/p9lrs6dpfczcmms0dawplqqiiymmi97w-at-spi2-core-2.52.0-dev/include -isystem /nix/store/ckk16ns9yyy5lk0i1l4xmgghqw055yc2-dbus-1.14.10-dev/include -isystem /nix/store/49j9xzcwvhyb6vvmcdds8wfx54nszq83-expat-2.6.2-dev/include -isystem /nix/store/gdr1ghkakyjfdj8bc6n0virwllm4zpwz-glib-2.80.2-dev/include -isystem /nix/store/qj9byzfvh7dd61kk0aglj7cwqj1xqg6l-zlib-1.3.1-dev/include -isystem /nix/store/1xcnwyx7pdmdq66xdz20fbl2q0arjzrl-libffi-3.4.6-dev/include -isystem /nix/store/z14w63wj0gk97hr06l76d4s723ynhr2k-gettext-0.21.1/include -isystem /nix/store/r717wgkg911wp6spacgbg3w2dyzybvk7-glibc-iconv-2.39/include -isystem /nix/store/ljrz822j7b6db3jnmw1jiafgrm8armcw-cairo-1.18.0-dev/include -isystem /nix/store/s0mcb1kw1a4a9vdvcm8jpsdpn6bqkljm-fontconfig-2.15.0-dev/include -isystem /nix/store/a6yfhfzpmvz8v73796djqk811p4b6wan-freetype-2.13.2-dev/include -isystem /nix/store/5yqz7al0lv1jhkmbka3ghswqk5wlxvq5-bzip2-1.0.8-dev/include -isystem /nix/store/62fdhzhrs5smykxkxvjhw3y6yck2iih4-brotli-1.1.0-dev/include -isystem /nix/store/1rdmf4lap3f82pqdlmrgj1vjs08dk5xw-libpng-apng-1.6.43-dev/include -isystem /nix/store/cy880gzg1h6awfrq7024543vicphg908-pixman-0.43.4/include -isystem /nix/store/h967azc5nfhmxjvncbim3d0mxxb8g0ky-libXext-1.3.6-dev/include -isystem /nix/store/ny34a9migrcin09zwgbkr0ymx72mvlfg-xorgproto-2024.1/include -isystem /nix/store/l04bgrdvkbxq81v7yq53nkmr7f1aiav7-libXau-1.0.11-dev/include -isystem /nix/store/gf6p8dn78x0kscxjjm20zsvgm4rb08pm-libXrender-0.9.11-dev/include -isystem /nix/store/0gxrwp9xnzb5li8i7w3q7qmm0lm808qq-libX11-1.8.9-dev/include -isystem /nix/store/y28z5yg4v9f8vi6mq97qhr8pqmf1aijx-libxcb-1.17.0-dev/include -isystem /nix/store/v76jszybl11j7y8d3ix9jc7a0qznnnmr-fribidi-1.0.13-dev/include -isystem /nix/store/gx938f6w31a0alyqm81c6fp70br4xqqy-gdk-pixbuf-2.42.11-dev/include -isystem /nix/store/l81hdkwh1v709cjxwvdy208476d59488-libtiff-4.6.0-dev/include -isystem /nix/store/cm58jpx9hqzpg0g1azm1pnif0fifk310-libdeflate-1.20/include -isystem /nix/store/50f8859fp7m1kqg56aq5bw9wk4f51gcw-libjpeg-turbo-3.0.3-dev/include -isystem /nix/store/iwfarfldqql8cnhkcm5j9bhb4bbi5giy-xz-5.4.6-dev/include -isystem /nix/store/1s817f9iyszdjkivddb9kjj8xd2kgmbs-gsettings-desktop-schemas-46.0/include -isystem /nix/store/bpmym81g25wkclbl2a468p605zg99yka-libICE-1.1.1-dev/include -isystem /nix/store/bx0aljs94vz98kyzk59xhh6f8f85d5qy-libSM-1.2.4-dev/include -isystem /nix/store/4if9vv75zicybj3zphhmfcb3m1w7i7vh-libXcomposite-0.4.6-dev/include -isystem /nix/store/bg2c3pkvs3p9jfx1gkgq8rh31p3adf8a-libXfixes-6.0.1-dev/include -isystem /nix/store/n2g1zf9x7fya009lvyrlliqbrq2gvgd3-libXcursor-1.2.2-dev/include -isystem /nix/store/9hs5bp8yhwwqgl091b3lp0vwhdy34l10-libXdamage-1.1.6-dev/include -isystem /nix/store/s7wrx0r48c9bb9ilqsrflmbsjmb3cbcv-libXi-1.8.1-dev/include -isystem /nix/store/hgmad4drs0i6n6k3hx071lhhkwdgqwas-libXrandr-1.5.4-dev/include -isystem /nix/store/gqkw1wn30p059dd1qzip7iz8zf810rx6-pango-1.52.2-dev/include -isystem /nix/store/jngq41iw8s1lxmrfxj66jyq9b10a4grd-harfbuzz-8.4.0-dev/include -isystem /nix/store/jbb1dy7fxm43zl66v1hmm8749q0cl88k-graphite2-1.3.14-dev/include -isystem /nix/store/fgvf7jj541gw38ykdsmgvgha1p074p05-libXft-2.3.8-dev/include -isystem /nix/store/3iqksxyj1832ypz89996qw0sf3h6ygwm-libGL-1.7.0-dev/include -isystem /nix/store/smacbfb82wp7ncz2rwac68jd50qxr70a-libglvnd-1.7.0-dev/include -isystem /nix/store/di7vbvn478r2gx1wlfvxvv0ani8fy4qh-wayland-1.22.0-dev/include -isystem /nix/store/q7dc4c37k3mb8c1r2fb169sk211v96kk-libXinerama-1.1.5-dev/include -isystem /nix/store/j5p7ngwqkar1dmvi9sp274gldrh33ssf-cups-2.4.7-dev/include -isystem /nix/store/23d6cba79c6csq1q8hsyakwnvw57z2jl-gmp-with-cxx-6.3.0-dev/include -isystem /nix/store/jikmr73929yzpsrabh35yaaqzli66ys8-webkitgtk-2.44.2+abi=4.0-dev/include -isystem /nix/store/v10iyckj1pml8am4r6q0cjyb0gxqp0ci-libsoup-2.74.3-dev/include -isystem /nix/store/37979sqc7yw9ps0c4xl9jjkhq0w1hw8b-libxml2-2.12.7-dev/include -frandom-seed=6dblp6sqb9 -isystem /nix/store/ghksnwa980zybz0rdrl547007m2cjigf-mcfgthread-x86_64-w64-mingw32-1.6.1-dev/include -isystem /nix/store/23hp6zlr2r7bllqp40x2r8ydf5zy2l2z-mingw-w64-x86_64-w64-mingw32-11.0.1-headers/include -isystem /nix/store/ghksnwa980zybz0rdrl547007m2cjigf-mcfgthread-x86_64-w64-mingw32-1.6.1-dev/include -I/home/user/some-app/src/xwebview/include'
CGO_FFLAGS='-O2 -g'
CGO_LDFLAGS='-L/nix/store/0bm4z6dh3v6nnr539xzsak0pn4wccb5l-expat-2.6.2/lib -L/nix/store/jd41k79l3nxq4b7b7yvc0kmcjd3lq7sa-dbus-1.14.10-lib/lib -L/nix/store/lv6nackqis28gg7l2ic43f6nk52hb39g-zlib-1.3.1/lib -L/nix/store/kbg5m7fyi1w23fyfmxjhhzcbd577rpg0-libffi-3.4.6/lib -L/nix/store/z14w63wj0gk97hr06l76d4s723ynhr2k-gettext-0.21.1/lib -L/nix/store/c2v6ycn0sjcpx9ww8x7j4ima6xnpssry-glib-2.80.2/lib -L/nix/store/6rigmq2ycbpgywmq9jjyhdr6vs8k8h8x-at-spi2-core-2.52.0/lib -L/nix/store/xwcf1rw3ackqp2vxms9myf9jq2ny6ynv-bzip2-1.0.8/lib -L/nix/store/jpjmh2325b6k3svvsmhj57wqlph9srdx-brotli-1.1.0-lib/lib -L/nix/store/55kivg8damd3y2c5k7286nvckw8pb2xf-libpng-apng-1.6.43/lib -L/nix/store/c9n99v77q5wrk7dxr4xi16bn1l4cglly-freetype-2.13.2/lib -L/nix/store/azbphnp68h4fkm0fsbird88bn76ggjsh-fontconfig-2.15.0-lib/lib -L/nix/store/cy880gzg1h6awfrq7024543vicphg908-pixman-0.43.4/lib -L/nix/store/8n7i76nx0k6b0zz752lvd3rv8gym39da-libXau-1.0.11/lib -L/nix/store/gbjygp4wz7b5rgayckmqfc00hy34dqfn-libXext-1.3.6/lib -L/nix/store/18kar5zwp16xyppfmigq92xzm1pkcqf1-libxcb-1.17.0/lib -L/nix/store/x9fw7rbdb34gq0f8q750kw344lbv9nk1-libX11-1.8.9/lib -L/nix/store/37bzg32wlrlknwbrsvjr4cxwmjh8dbzl-libXrender-0.9.11/lib -L/nix/store/b9f9c4ml2k6fg0pgc80d9y4a6byqflmp-cairo-1.18.0/lib -L/nix/store/dkg8ygd2z3b3n5fki62z8yii2bh8gv4x-fribidi-1.0.13/lib -L/nix/store/cm58jpx9hqzpg0g1azm1pnif0fifk310-libdeflate-1.20/lib -L/nix/store/pgj3xdvp8hj61wwkcw2k0wfbyr3ni64h-libjpeg-turbo-3.0.3/lib -L/nix/store/lphbn1va4i43fj7f3m9xskf9y86khzf3-xz-5.4.6/lib -L/nix/store/ic5bx78h039m3lfxxb6bl64qlbdxzzj9-libtiff-4.6.0/lib -L/nix/store/k2fmr13zj9rhkr29axhkaizjqn1llxaz-gdk-pixbuf-2.42.11/lib -L/nix/store/alryr2fk5z2n19s72q1yf0r71ych8jml-libICE-1.1.1/lib -L/nix/store/h8j225cl14p2yz55xa76rasfins4540w-libSM-1.2.4/lib -L/nix/store/1jjjvxa4v0qqjhlc9ig3j6ljdlskm2kr-libXfixes-6.0.1/lib -L/nix/store/y16mr4fhn8a8snp5177a6aznq42ci22c-libXcomposite-0.4.6/lib -L/nix/store/53vv8bkh0nvrfifac45dvhhcs3ybywjb-libXcursor-1.2.2/lib -L/nix/store/2y8irckx5v4fav7r7p9ghaz7rbwdmfb2-libXdamage-1.1.6/lib -L/nix/store/8dznd000dbv8kjvq93zwj7b5xf5chf6z-libXi-1.8.1/lib -L/nix/store/2rq584mkybbbvm1ciyams5s2lh8cdq32-libXrandr-1.5.4/lib -L/nix/store/11ms8j8iwn7d94x8q5syrss8hxh0w212-graphite2-1.3.14/lib -L/nix/store/d8sw2gwfjkhigipm6jiqsgknxpjzdzrz-harfbuzz-8.4.0/lib -L/nix/store/0kf3d2yigxk6xbbnc09x42c5as8xgjv8-libXft-2.3.8/lib -L/nix/store/7ammyzfh4i39dqxj3v0rxs21crrxp4nb-pango-1.52.2/lib -L/nix/store/dxp9ffxm50hj300xvzwhsllwgjwxvwpp-libGL-1.7.0/lib -L/nix/store/jz3vvf4nsyirb25rh9dbhksm4gq6wybb-libglvnd-1.7.0/lib -L/nix/store/7rnc20sb0h5zxqm5vims6mvi6gr3iy27-wayland-1.22.0/lib -L/nix/store/g1k5ak1wb3xpsbjarjkmql8zbd1nmym4-libXinerama-1.1.5/lib -L/nix/store/rx6nkd40819acppajq29g1hxa4d9r35f-gmp-with-cxx-6.3.0/lib -L/nix/store/0bp09zmflpq2igy8cm2b83dl0rpmyw90-cups-2.4.7-lib/lib -L/nix/store/6pzxmb82pda01y6zxncdmmp7lhafb75h-gtk+3-3.24.41/lib -L/nix/store/kf7fzax0av9him9m4zcmbqmihh5108wq-libxml2-2.12.7/lib -L/nix/store/1mldrzcgkfpzs56371gj7zpk9zx95bxk-libsoup-2.74.3/lib -L/nix/store/xcj4iy5rcipmigl8ibadwhgwki95gh95-webkitgtk-2.44.2+abi=4.0/lib -L/nix/store/0bm4z6dh3v6nnr539xzsak0pn4wccb5l-expat-2.6.2/lib -L/nix/store/jd41k79l3nxq4b7b7yvc0kmcjd3lq7sa-dbus-1.14.10-lib/lib -L/nix/store/lv6nackqis28gg7l2ic43f6nk52hb39g-zlib-1.3.1/lib -L/nix/store/kbg5m7fyi1w23fyfmxjhhzcbd577rpg0-libffi-3.4.6/lib -L/nix/store/z14w63wj0gk97hr06l76d4s723ynhr2k-gettext-0.21.1/lib -L/nix/store/c2v6ycn0sjcpx9ww8x7j4ima6xnpssry-glib-2.80.2/lib -L/nix/store/6rigmq2ycbpgywmq9jjyhdr6vs8k8h8x-at-spi2-core-2.52.0/lib -L/nix/store/xwcf1rw3ackqp2vxms9myf9jq2ny6ynv-bzip2-1.0.8/lib -L/nix/store/jpjmh2325b6k3svvsmhj57wqlph9srdx-brotli-1.1.0-lib/lib -L/nix/store/55kivg8damd3y2c5k7286nvckw8pb2xf-libpng-apng-1.6.43/lib -L/nix/store/c9n99v77q5wrk7dxr4xi16bn1l4cglly-freetype-2.13.2/lib -L/nix/store/azbphnp68h4fkm0fsbird88bn76ggjsh-fontconfig-2.15.0-lib/lib -L/nix/store/cy880gzg1h6awfrq7024543vicphg908-pixman-0.43.4/lib -L/nix/store/8n7i76nx0k6b0zz752lvd3rv8gym39da-libXau-1.0.11/lib -L/nix/store/gbjygp4wz7b5rgayckmqfc00hy34dqfn-libXext-1.3.6/lib -L/nix/store/18kar5zwp16xyppfmigq92xzm1pkcqf1-libxcb-1.17.0/lib -L/nix/store/x9fw7rbdb34gq0f8q750kw344lbv9nk1-libX11-1.8.9/lib -L/nix/store/37bzg32wlrlknwbrsvjr4cxwmjh8dbzl-libXrender-0.9.11/lib -L/nix/store/b9f9c4ml2k6fg0pgc80d9y4a6byqflmp-cairo-1.18.0/lib -L/nix/store/dkg8ygd2z3b3n5fki62z8yii2bh8gv4x-fribidi-1.0.13/lib -L/nix/store/cm58jpx9hqzpg0g1azm1pnif0fifk310-libdeflate-1.20/lib -L/nix/store/pgj3xdvp8hj61wwkcw2k0wfbyr3ni64h-libjpeg-turbo-3.0.3/lib -L/nix/store/lphbn1va4i43fj7f3m9xskf9y86khzf3-xz-5.4.6/lib -L/nix/store/ic5bx78h039m3lfxxb6bl64qlbdxzzj9-libtiff-4.6.0/lib -L/nix/store/k2fmr13zj9rhkr29axhkaizjqn1llxaz-gdk-pixbuf-2.42.11/lib -L/nix/store/alryr2fk5z2n19s72q1yf0r71ych8jml-libICE-1.1.1/lib -L/nix/store/h8j225cl14p2yz55xa76rasfins4540w-libSM-1.2.4/lib -L/nix/store/1jjjvxa4v0qqjhlc9ig3j6ljdlskm2kr-libXfixes-6.0.1/lib -L/nix/store/y16mr4fhn8a8snp5177a6aznq42ci22c-libXcomposite-0.4.6/lib -L/nix/store/53vv8bkh0nvrfifac45dvhhcs3ybywjb-libXcursor-1.2.2/lib -L/nix/store/2y8irckx5v4fav7r7p9ghaz7rbwdmfb2-libXdamage-1.1.6/lib -L/nix/store/8dznd000dbv8kjvq93zwj7b5xf5chf6z-libXi-1.8.1/lib -L/nix/store/2rq584mkybbbvm1ciyams5s2lh8cdq32-libXrandr-1.5.4/lib -L/nix/store/11ms8j8iwn7d94x8q5syrss8hxh0w212-graphite2-1.3.14/lib -L/nix/store/d8sw2gwfjkhigipm6jiqsgknxpjzdzrz-harfbuzz-8.4.0/lib -L/nix/store/0kf3d2yigxk6xbbnc09x42c5as8xgjv8-libXft-2.3.8/lib -L/nix/store/7ammyzfh4i39dqxj3v0rxs21crrxp4nb-pango-1.52.2/lib -L/nix/store/dxp9ffxm50hj300xvzwhsllwgjwxvwpp-libGL-1.7.0/lib -L/nix/store/jz3vvf4nsyirb25rh9dbhksm4gq6wybb-libglvnd-1.7.0/lib -L/nix/store/7rnc20sb0h5zxqm5vims6mvi6gr3iy27-wayland-1.22.0/lib -L/nix/store/g1k5ak1wb3xpsbjarjkmql8zbd1nmym4-libXinerama-1.1.5/lib -L/nix/store/rx6nkd40819acppajq29g1hxa4d9r35f-gmp-with-cxx-6.3.0/lib -L/nix/store/0bp09zmflpq2igy8cm2b83dl0rpmyw90-cups-2.4.7-lib/lib -L/nix/store/6pzxmb82pda01y6zxncdmmp7lhafb75h-gtk+3-3.24.41/lib -L/nix/store/kf7fzax0av9him9m4zcmbqmihh5108wq-libxml2-2.12.7/lib -L/nix/store/1mldrzcgkfpzs56371gj7zpk9zx95bxk-libsoup-2.74.3/lib -L/nix/store/xcj4iy5rcipmigl8ibadwhgwki95gh95-webkitgtk-2.44.2+abi=4.0/lib -L/nix/store/vvx68rgb5zjnw34as7pqz26nhnrx1wrp-mcfgthread-x86_64-w64-mingw32-1.6.1/lib -L/nix/store/vvx68rgb5zjnw34as7pqz26nhnrx1wrp-mcfgthread-x86_64-w64-mingw32-1.6.1/lib'
PKG_CONFIG='x86_64-w64-mingw32-pkg-config'
GOGCCFLAGS='-m64 -mthreads -Wl,--no-gc-sections -fmessage-length=0 -ffile-prefix-map=/tmp/go-build2817374850=/tmp/go-build -gno-record-gcc-switches'

Some related links:

  1. 156343

  2. 233099

  3. 84754

  4. 97214

  5. 236598

  6. 132340

  7. 116069

  8. 73195

  9. 24984

  10. 107978

  11. 107918

  12. https://github.com/NixOS/nixpkgs/pull/73195#issuecomment-639555319
  13. https://github.com/NixOS/nixpkgs/blob/master/pkgs/development/compilers/gcc/patches/update-mcfgthread-patches.sh
  14. https://github.com/NixOS/nixpkgs/commit/58b98e9a2541a0d031971c53ba7ac27f60ab0468
  15. https://github.com/NixOS/nixpkgs/blob/f33f71f6f690db1a2f0776d6711cf6f6df2db021/pkgs/by-name/dx/dxvk/package.nix#L13
  16. https://github.com/NixOS/nixpkgs/blob/f33f71f6f690db1a2f0776d6711cf6f6df2db021/pkgs/development/compilers/go/1.22.nix#L13
  17. https://github.com/NixOS/nixpkgs/blob/f33f71f6f690db1a2f0776d6711cf6f6df2db021/pkgs/development/compilers/gcc/common/configure-flags.nix#L95
  18. https://github.com/NixOS/nixpkgs/blob/f33f71f6f690db1a2f0776d6711cf6f6df2db021/pkgs/development/compilers/gcc/patches/default.nix#L176
  19. https://gcc-mcf.lhmouse.com/
  20. https://github.com/lhmouse/MINGW-packages/tree/master/mingw-w64-gcc
  21. https://github.com/DavidEGrayson/nixcrpkgs

There is also this, but I'm not sure what to make of it: https://www.scitepress.org/Papers/2021/102379/102379.pdf

image

@Ericson2314 @lhmouse @trofi @angerman @taktoa (Tagging you all since it looks like you made relevant contributions or have a good understanding of the context, but please ignore the message if I made a mistake). Do you have any insight into why this threading library is required (even for the simplest program that does not specifically use threads), and how to disable it. Ideally, I'd like to opt-in to mcfgthreads, or other alternatives (pthreads?), or even none (if that is a possibility). After some investigation, it looks like the threadsCross parameter can potentially be used to control (or disable) the mcfgthreads library, but I'm not sure how to go about setting that value.

trofi commented 5 months ago

cannot find -lmcfgthread

https://github.com/NixOS/nixpkgs/issues/156343 looks most relevant. TL;DR is: nixpkgs does not provide a working cc compiler outside nix-shell or build environment. mingw32 is most visible not to work, but the rest of the compilers also lack vital parts (like library lookup paths and other environment provided by setup hooks) to be safely usable.

trofi commented 5 months ago

-lmcfgthread gets added by gcc's own upstream driver the this threading model is selected at ./configure time with:

gcc/config/mingw/mingw32.h-#if TARGET_USING_MCFGTHREAD
gcc/config/mingw/mingw32.h:#define MCFGTHREAD_SPEC  " -lmcfgthread -lkernel32 -lntdll "
gcc/config/mingw/mingw32.h-#else
gcc/config/mingw/mingw32.h-#define MCFGTHREAD_SPEC  ""
gcc/config/mingw/mingw32.h-#endif

nixpkgs piece that enables it is hidden in pkgs/development/compilers/gcc/common/configure-flags.nix:

      "--enable-threads=${if targetPlatform.isUnix then "posix"
                          else if targetPlatform.isWindows then (threadsCross.model or "win32")
                          else "single"}"

You might want to try win32 or single threading model instead to avoid extra library dependency.

lhmouse commented 5 months ago

@W1M0R

There is also this, but I'm not sure what to make of it: https://www.scitepress.org/Papers/2021/102379/102379.pdf

I have been aware of it. The article is outdated. Since the 2022 refactor, binary files are distributed as GitHub Releases and are not committed to the repo.

A threading library may be required even when there appears to be no multithreading stuff. For example, initialization of local static objects with a constructor has to be thread-safe.

zeorin commented 4 months ago

You might want to try win32 or single threading model instead to avoid extra library dependency.

For anyone who, like I was, is not sure how to do this, I found the following snippet in dxvk's derivation:

  let
    useWin32ThreadModel =
      stdenv:
      overrideCC stdenv (
        stdenv.cc.override (old: {
          cc = old.cc.override {
            threadsCross = {
              model = "win32";
              package = null;
            };
          };
        })
      );
nixos-discourse commented 3 months ago

This issue has been mentioned on NixOS Discourse. There might be relevant details there:

https://discourse.nixos.org/t/statically-compiling-a-windows-binary-with-mingw-that-needs-pthreads/49729/1