Nixpkgs: Building open-vm-tools fails with error: Deprecated pre-processor symbol [-Werror]

Created on 18 Oct 2019  路  6Comments  路  Source: NixOS/nixpkgs

Describe the bug
Compilation of open-vm-tools started failing:

fileLogger.c: In function 'FileLoggerLog':
fileLogger.c:351:13: error: Deprecated pre-processor symbol [-Werror]
    g_static_mutex_lock(&logger->lock);
             ^~~~~~~~~~~~~~~~~~~~~~~~~~
fileLogger.c:351:13: error: g_mutex_lock [-Werror]
    g_static_mutex_lock(&logger->lock);
             ^~~~~~~~~~~~~~
fileLogger.c:390:13: error: Deprecated pre-processor symbol [-Werror]
    g_static_mutex_unlock(&logger->lock);
             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
fileLogger.c:390:13: error: g_mutex_unlock [-Werror]
    g_static_mutex_unlock(&logger->lock);
             ^~~~~~~~~~~~~~~~
cc1: all warnings being treated as errors
make[2]: *** [Makefile:510: libGlibUtils_la-fileLogger.lo] Error 1

To Reproduce
Enable vmware guest in configuration.nix

virtualisation.vmware.guest.enable = true;

Expected behavior
Works without errors

Additional context
I tried adding an overlay to use older gcc:

nixpkgs.overlays =
    [ (self: super:
      {
        # override with older gcc
        open-vm-tools = super.open-vm-tools.override { stdenv = super.gcc7Stdenv; };
      })
    ];

but it didn't help.

Metadata

 - system: `"x86_64-linux"`
 - host os: `Linux 4.19.75, NixOS, 20.03pre194293.2436c27541b (Markhor)`
 - multi-user?: `yes`
 - sandbox: `yes`
 - version: `nix-env (Nix) 2.3`
 - channels(alex): `"home-manager"`
 - channels(root): `"nixos-20.03pre196836.1c40ee6fc44, home-manager"`
 - nixpkgs: `/nix/var/nix/profiles/per-user/root/channels/nixos`

Maintainer information:

# a list of nixpkgs attributes affected by the problem
open-vm-tools
# a list of nixos modules affected by the problem
virtualisation.vmware
bug

All 6 comments

They're using a deprecated function in glib

It needs a patch to rewrite to use

It appears that:
https://github.com/NixOS/nixpkgs/blob/master/pkgs/applications/virtualization/open-vm-tools/default.nix
Needs version updated from 10.3.10 to 11.0.1 and hash modified based on that.
Is there a way to create an overlay for that or patch to the NixOS package is the only way?

@ilyaGotfryd It would be best if the package could be updated so everyone can have it fixed, and I believe it isn't extremely straightforward because there's a downstream patch that needs syncing.

You could try the following, which is just applying the aforementioned patch in an overlay.

open-vm-tools = super.open-vm-tools.overrideAttrs (oldAttrs: {
  patches = oldAttrs.patches ++ [ 
    # Remove GLib 2.32 Deprecations 
    (self.fetchpatch {
      url = "https://github.com/vmware/open-vm-tools/commit/a7c141fc5278146b86c71502f60767962b752af7.patch";
      sha256 = self.stdenv.lib.fakeSha256;
    })
  ];
});

@ilyaGotfryd It would be best if the package could be updated so everyone can have it fixed, and I believe it isn't extremely straightforward because there's a downstream patch that needs syncing.

You could try the following, which is just applying the aforementioned patch in an overlay.

open-vm-tools = super.open-vm-tools.overrideAttrs (oldAttrs: {
  patches = oldAttrs.patches ++ [ 
    # Remove GLib 2.32 Deprecations 
    (self.fetchpatch {
      url = "https://github.com/vmware/open-vm-tools/commit/a7c141fc5278146b86c71502f60767962b752af7.patch";
      sha256 = self.stdenv.lib.fakeSha256;
    })
  ];
});

Thank you all for help on this topic.
I am bit struggling to implement your fix.
https://pastebin.com/0D3cSn7g
For some reason it's skipping patch application.
Do you have any advice? Please.
I am new to NixOS

I've used the cflag to ignore deprecation warnings for glib in the meantime https://github.com/NixOS/nixpkgs/commit/8f3297fbf25cf4cfbe2c2abefe61df56324fe85f.

You can apply the same effects of the aforementioned diff like

open-vm-tools = super.open-vm-tools.overrideAttrs (oldAttrs: {
   NIX_CFLAGS_COMPILE = [ "-DGLIB_DISABLE_DEPRECATION_WARNINGS" ];
});

in an overlay.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

langston-barrett picture langston-barrett  路  3Comments

copumpkin picture copumpkin  路  3Comments

ob7 picture ob7  路  3Comments

lverns picture lverns  路  3Comments

grahamc picture grahamc  路  3Comments