From 4c296f58dff81cabe74ab6ac82e5edfef4e25916 Mon Sep 17 00:00:00 2001 From: Alejandro Angulo Date: Mon, 20 Feb 2023 09:34:25 -0800 Subject: [PATCH] ldb: copy cross fix from tevent Saw the following while building on an x86_64-linux host for an armv6l-linux target: ``` Testing pyembed configuration: Could not build a python embedded interpreter ``` I dug into the config log and this seemed to be cause of the issue: ``` ['armv6l-unknown-linux-gnueabihf-gcc', '-MMD', '-D_GNU_SOURCE=1', '-D_XOPEN_SOURCE_EXTENDED=1', '-g', '-fwrapv', '-O3', '-I/nix/store/0pyymzxf7n0fzpaqnvwv92ab72v3jq8d-python3-3.10.9/include/python3.10', '-I/nix/store/kaiinm7cjirmv4zd3pdqa r23rsypfqlh-libxcrypt-4.4.33/include', '-DNDEBUG', '../../test.c', '-c', '-o/build/ldb-2.6.1/bin/.conf_check_59d3a0a5b9 6e327858e281d280fec4ed/testbuild/default/test.c.1.o'] err: In file included from /nix/store/0pyymzxf7n0fzpaqnvwv92ab72v3jq8d-python3-3.10.9/include/python3.10/Python.h:8, from ../../test.c:432: /nix/store/0pyymzxf7n0fzpaqnvwv92ab72v3jq8d-python3-3.10.9/include/python3.10/pyconfig.h:1480: warning: "SIZEOF_LONG" r edefined 1480 | #define SIZEOF_LONG 8 | ../../test.c:154: note: this is the location of the previous definition 154 | #define SIZEOF_LONG 4 | /nix/store/0pyymzxf7n0fzpaqnvwv92ab72v3jq8d-python3-3.10.9/include/python3.10/pyconfig.h:1504: warning: "SIZEOF_SIZE_T" redefined 1504 | #define SIZEOF_SIZE_T 8 | ../../test.c:156: note: this is the location of the previous definition 156 | #define SIZEOF_SIZE_T 4 | /nix/store/0pyymzxf7n0fzpaqnvwv92ab72v3jq8d-python3-3.10.9/include/python3.10/pyconfig.h:1507: warning: "SIZEOF_TIME_T" redefined 1507 | #define SIZEOF_TIME_T 8 | ../../test.c:170: note: this is the location of the previous definition 170 | #define SIZEOF_TIME_T 4 | /nix/store/0pyymzxf7n0fzpaqnvwv92ab72v3jq8d-python3-3.10.9/include/python3.10/pyconfig.h:1513: warning: "SIZEOF_VOID_P" redefined 1513 | #define SIZEOF_VOID_P 8 | ../../test.c:166: note: this is the location of the previous definition 166 | #define SIZEOF_VOID_P 4 | In file included from /nix/store/0pyymzxf7n0fzpaqnvwv92ab72v3jq8d-python3-3.10.9/include/python3.10/Python.h:50: /nix/store/0pyymzxf7n0fzpaqnvwv92ab72v3jq8d-python3-3.10.9/include/python3.10/pyport.h:746:2: error: #error "LONG_BIT definition appears wrong for platform (bad gcc/glibc config?)." 746 | #error "LONG_BIT definition appears wrong for platform (bad gcc/glibc config?)." | ^~~~~ ``` --- pkgs/development/libraries/ldb/default.nix | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/pkgs/development/libraries/ldb/default.nix b/pkgs/development/libraries/ldb/default.nix index bdd630103e3..234ec77a4a5 100644 --- a/pkgs/development/libraries/ldb/default.nix +++ b/pkgs/development/libraries/ldb/default.nix @@ -63,6 +63,11 @@ stdenv.mkDerivation rec { "--without-ldb-lmdb" ]; + # python-config from build Python gives incorrect values when cross-compiling. + # If python-config is not found, the build falls back to using the sysconfig + # module, which works correctly in all cases. + PYTHON_CONFIG = "/invalid"; + stripDebugList = [ "bin" "lib" "modules" ]; meta = with lib; {