Nixpkgs: Some builds fail with invalid gcc flag "-Xarch_x86_64" (Linux+CMake+PCH)

Created on 8 Aug 2020  路  10Comments  路  Source: NixOS/nixpkgs

Describe the bug

Building of tdesktop-2.2.0 (Telegram Desktop) on my NixOS unstable system fails with the message:

g++: error: unrecognized command line option '-Xarch_x86_64'; did you mean '-march=x86-64'?

Notify maintainers

@primeos @abbradar

Metadata

  • system: "x86_64-linux"
  • host os: Linux 5.7.12, NixOS, 20.09.git.4254de4a41f (Nightingale)
  • multi-user?: yes
  • sandbox: yes
  • version: nix-env (Nix) 2.3.7
  • channels(root): "nixos-20.09pre237279.8e2b14aceb1"
  • nixpkgs: /nix/var/nix/profiles/per-user/root/channels/nixos

Maintainer information:

# a list of nixpkgs attributes affected by the problem
attribute: tdesktop
# a list of nixos modules affected by the problem
module:
bug

Most helpful comment

I've pushed e7987936c1b28b0de3d774731bc26cde47c24c44 as a temporary quick-fix for the tdesktop build.

All 10 comments

Failing Hydra build: https://hydra.nixos.org/build/124793339

This is most likely due to the same problem as in https://github.com/NixOS/nixpkgs/pull/93761#issuecomment-670463209 and should affect multiple packages.

From the investigation of @orivej it seems to be caused by a recent CMake update (#93886).

Yes, I expect that all CMake packages that use target_precompile_headers are affected. (Very few I suppose, since this feature was added in CMake 3.16.) Currently I'm bisecting CMake.

@orivej I had a quick look at the Git history of CMake and https://gitlab.kitware.com/cmake/cmake/-/commit/f593b354da2e9637e9b869688934f0ba2544ebed?expanded=1#6c9f77aa6e8d69a3b0b3ddcff14fb5312faa7b5a_2457_2469 seems like a good candidate.

Anyway, thanks a lot for investigating this :heart: :)

So I guess a quick workaround might be to only add the CMAKE_OSX_* variables (especially CMAKE_OSX_ARCHITECTURES) on macOS builds?

And according to https://cmake.org/cmake/help/latest/variable/CMAKE_OSX_ARCHITECTURES.html it should also be a CMake bug as it states:

This variable is ignored on platforms other than Apple.

I've pushed e7987936c1b28b0de3d774731bc26cde47c24c44 as a temporary quick-fix for the tdesktop build.

The fix for this issue was just merged into CMake master: https://gitlab.kitware.com/cmake/cmake/-/merge_requests/5118

Let's keep this open for anyone else stumbling such issues, until staging is merged to channels.

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

https://discourse.nixos.org/t/installing-audacity/8575/2

Was this page helpful?
0 / 5 - 0 ratings

Related issues

edolstra picture edolstra  路  3Comments

matthiasbeyer picture matthiasbeyer  路  3Comments

spacekitteh picture spacekitteh  路  3Comments

chris-martin picture chris-martin  路  3Comments

copumpkin picture copumpkin  路  3Comments