How can I modify this package to use gcc7?

I’m trying to patchelf a binary that I believe requires Qt 5.14 to be compiled with gcc7. I cloned this repository which has a derivation for Qt 5.14. I tried creating an overlay

# overlay.nix
self: super:
{
  qt514.qtbase = super.qt514.qtbase.override {
    stdenv = self.gcc7Stdenv;
  };
}

and getting a library path with

nix-instantiate --eval -E 'with import ./. { overlays = [ (import ./overlay.nix) ]; }; lib.makeLibraryPath [ qt514.qtbase ]'

but I get an error saying ‘newScope missing’.

What’s the correct approach here?

So you think that the binary cares what version of gcc compiled Qt 5.14 ? I don’t think it’s possible for a binary to know that, nor it should influence it’s usage of the library.

Okay when I use Qt 5.14 as it’s defined in @petabyteboy’s nixpkgs fork and patchelf the binary I’m trying to run, I get this error

<binary>: symbol lookup error: <binary> undefined symbol: _ZdlPvm, version Qt_5

When I searched online before, I somehow got the impression that this error had something to do with compiling the ELF file and the Qt dependency with different versions of gcc. This stackoverflow question suggests that it has something to do with differences in the way the two files were compiled, but not necessarily that it’s about gcc versions. I might have been wrong about gcc versions being the cause of the error, but if it helps, when I run strings -a <binary> | grep -i gcc I get the line GCC: (Ubuntu ... ) 7.4.0.

@petabyteboy Do you know what attribute of what package I have to override in order to add "-fno-sized-deallocation" to QMAKE_CXXFLAGS for the compilation of qt514.qtbase (in your qt514 fork)?

Hi there!
I don’t know for sure how to achieve this. I am not even sure if qtbase is built with qmake, isn’t qmake part of qtbase? You could try using overrideAttrs to add your options to NIX_CFLAGS_COMPILE.
I wish you good luck with running this binary, it might prove challenging.

Gotcha, thanks for the response!