Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pkgsCross.armv7l-hf-multiplatform.talloc fails to build on aarch64 #63043

Closed
Thra11 opened this issue Jun 12, 2019 · 8 comments
Closed

pkgsCross.armv7l-hf-multiplatform.talloc fails to build on aarch64 #63043

Thra11 opened this issue Jun 12, 2019 · 8 comments
Assignees

Comments

@Thra11
Copy link
Member

Thra11 commented Jun 12, 2019

Issue description

pkgsCross.armv7l-hf-multiplatform.talloc fails to build. Very similar output to #62540.

Steps to reproduce

Technical details

nix-build -I nixpkgs=/home/thrall/nixpkgs -E '(import <nixpkgs>{}).pkgsCross.armv7l-hf-multiplatform.talloc'
these derivations will be built:
  /nix/store/vd7xkzz3p040k9ly85n41m9cwsm13vhw-talloc-2.1.14-armv7l-unknown-linux-gnueabihf.drv
building '/nix/store/vd7xkzz3p040k9ly85n41m9cwsm13vhw-talloc-2.1.14-armv7l-unknown-linux-gnueabihf.drv'...
unpacking sources
unpacking source archive /nix/store/vhibvjl3g3rgi9hl0ik068w70gsv02bq-talloc-2.1.14.tar.gz
source root is talloc-2.1.14
setting SOURCE_DATE_EPOCH to timestamp 1531374876 of file talloc-2.1.14/wscript
patching sources
updateAutotoolsGnuConfigScriptsPhase
configuring
configure flags: --cross-compile --cross-execute=/nix/store/879f9z1lry114x7v83zwffg9jwz986a7-bash-4.4-p23/bin/bash\ -c\ \'\'\ -- --prefix=/nix/store/927s5j6fv5zha2x9y25ch61sx5yin5bn-talloc-2.1.14-armv7l-unknown-linux-gnueabihf --enable-talloc-compat1 --bundled-libraries=NONE --builtin-libraries=replace configure
Checking for program gcc or cc           : armv7l-unknown-linux-gnueabihf-gcc 
Checking for program cpp                 : not found 
Checking for program ar                  : armv7l-unknown-linux-gnueabihf-ar 
Checking for program ranlib              : armv7l-unknown-linux-gnueabihf-ranlib 
Checking for gcc                         : ok  
Checking for program git                 : not found 
Check for -MD                            : yes 
Checking for program gdb                 : not found 
Checking for header sys/utsname.h        : yes 
Checking uname sysname type              : Traceback (most recent call last):
  File "buildtools/bin/waf", line 76, in <module>
    Scripting.prepare(t, cwd, VERSION, wafdir)
  File "/build/talloc-2.1.14/third_party/waf/wafadmin/Scripting.py", line 145, in prepare
    prepare_impl(t, cwd, ver, wafdir)
  File "/build/talloc-2.1.14/third_party/waf/wafadmin/Scripting.py", line 135, in prepare_impl
    main()
  File "/build/talloc-2.1.14/third_party/waf/wafadmin/Scripting.py", line 188, in main
    fun(ctx)
  File "/build/talloc-2.1.14/third_party/waf/wafadmin/Scripting.py", line 241, in configure
    conf.sub_config([''])
  File "/build/talloc-2.1.14/third_party/waf/wafadmin/Configure.py", line 237, in sub_config
    self.recurse(k, name='configure')
  File "/build/talloc-2.1.14/third_party/waf/wafadmin/Utils.py", line 656, in recurse
    f(self)
  File "/build/talloc-2.1.14/wscript", line 38, in configure
    conf.RECURSE('lib/replace')
  File "./buildtools/wafsamba/samba_utils.py", line 452, in RECURSE
    return ctx.sub_config(relpath)
  File "/build/talloc-2.1.14/third_party/waf/wafadmin/Configure.py", line 237, in sub_config
    self.recurse(k, name='configure')
  File "/build/talloc-2.1.14/third_party/waf/wafadmin/Utils.py", line 656, in recurse
    f(self)
  File "/build/talloc-2.1.14/third_party/waf/wafadmin/Utils.py", line 743, in wrap
    ret = fun(k)
  File "/build/talloc-2.1.14/lib/replace/wscript", line 28, in configure
    conf.RECURSE('buildtools/wafsamba')
  File "./buildtools/wafsamba/samba_utils.py", line 452, in RECURSE
    return ctx.sub_config(relpath)
  File "/build/talloc-2.1.14/third_party/waf/wafadmin/Configure.py", line 237, in sub_config
    self.recurse(k, name='configure')
  File "/build/talloc-2.1.14/third_party/waf/wafadmin/Utils.py", line 656, in recurse
    f(self)
  File "/build/talloc-2.1.14/third_party/waf/wafadmin/Utils.py", line 743, in wrap
    ret = fun(k)
  File "/build/talloc-2.1.14/lib/replace/../../buildtools/wafsamba/wscript", line 317, in configure
    conf.CHECK_UNAME()
  File "./buildtools/wafsamba/samba_conftests.py", line 452, in CHECK_UNAME
    msg="Checking uname %s type" % v):
  File "./buildtools/wafsamba/samba_autoconf.py", line 456, in CHECK_CODE
    conf.COMPOUND_END(conf.env[define])
  File "./buildtools/wafsamba/samba_autoconf.py", line 69, in COMPOUND_END
    p(result)
  File "/build/talloc-2.1.14/third_party/waf/wafadmin/Configure.py", line 299, in check_message_2
    self.log.write(sr)
TypeError: expected a string or other character buffer object
builder for '/nix/store/vd7xkzz3p040k9ly85n41m9cwsm13vhw-talloc-2.1.14-armv7l-unknown-linux-gnueabihf.drv' failed with exit code 1
error: build of '/nix/store/vd7xkzz3p040k9ly85n41m9cwsm13vhw-talloc-2.1.14-armv7l-unknown-linux-gnueabihf.drv' failed

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

 - system: `"aarch64-linux"`
 - host os: `Linux 3.10.104, Ubuntu, 18.04.2 LTS (Bionic Beaver)`
 - multi-user?: `no`
 - sandbox: `yes`
 - version: `nix-env (Nix) 2.2`
 - nixpkgs: `/home/thrall/nixpkgs`
@matthewbauer matthewbauer self-assigned this Jun 12, 2019
@matthewbauer
Copy link
Member

Weirdly I am not getting this anymore:

nix build nixpkgs.pkgsCross.armv7l-hf-multiplatform.talloc

works. can you try again @Thra11. I have no idea why it would be fixed

@Thra11
Copy link
Member Author

Thra11 commented Jun 29, 2019

Still doesn't work for me on current nixpkgs/master. Same error as before.
Do you have any idea what might be causing it, or how I can debug the issue? I wondered if it was trying to query details about the build system, which nix was hiding for the sake of reproducibility, but if that were the case, I'd expect to see it failing more consistently, and not just when cross-compiling.

@matthewbauer
Copy link
Member

I wonder if being on aarch64-linux has something to do with it. Let me test it there...

@stale

This comment has been minimized.

@stale stale bot added the 2.status: stale https://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md label Jun 2, 2020
@Thra11
Copy link
Member Author

Thra11 commented Jun 2, 2020

This still fails, although it now gets a bit further before failing in a different way:

...
Checking if compiler accepts -fstack-protector-strong                             : yes 
Checking if compiler accepts -fstack-clash-protection                             : yes 
Checking linker accepts -Wl,-no-undefined                                         : yes 
Checking linker accepts ['-undefined', 'dynamic_lookup']                          : no 
Checking for program 'python3'                                                    : /nix/store/grz0f8gr880c1rff3fnxlll9bdiczy8z-python3-3.7.7/bin/python3 
Checking for program 'python'                                                     : /nix/store/grz0f8gr880c1rff3fnxlll9bdiczy8z-python3-3.7.7/bin/python3 
Checking for program 'python3'                                                    : /nix/store/grz0f8gr880c1rff3fnxlll9bdiczy8z-python3-3.7.7/bin/python3 
Checking for python version >= 3.5.0                                              : 3.7.7 
python-config                                                                     : /nix/store/grz0f8gr880c1rff3fnxlll9bdiczy8z-python3-3.7.7/bin/python3-config 
Asking python-config for pyembed '--cflags --libs --ldflags --embed' flags        : not found 
Asking python-config for pyembed '--cflags --libs --ldflags' flags                : yes 
Testing pyembed configuration                                                     : Could not build a python embedded interpreter 
Testing pyembed configuration                                                     : Could not build a python embedded interpreter 
The configuration failed
(complete log in /build/talloc-2.3.1/bin/config.log)
builder for '/nix/store/qixj974yxnjf0bwf95m2055pl4v9fvnk-talloc-2.3.1-armv7l-unknown-linux-gnueabihf.drv' failed with exit code 1
error: build of '/nix/store/qixj974yxnjf0bwf95m2055pl4v9fvnk-talloc-2.3.1-armv7l-unknown-linux-gnueabihf.drv' failed

@stale stale bot removed the 2.status: stale https://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md label Jun 2, 2020
@Thra11
Copy link
Member Author

Thra11 commented Jun 2, 2020

Here's the config.log.
Relevant section:

---------------------------------------------------------------------------------
Asking python-config for pyembed '--cflags --libs --ldflags --embed' flags
['/nix/store/grz0f8gr880c1rff3fnxlll9bdiczy8z-python3-3.7.7/bin/python3-config', '--cflags', '--libs', '--ldflags', '--embed']
out: Usage: /nix/store/grz0f8gr880c1rff3fnxlll9bdiczy8z-python3-3.7.7/bin/python3-config --prefix|--exec-prefix|--includes|--libs|--cflags|--ldflags|--extension-suffix|--help|--abiflags|--configdir

not found
from /build/talloc-2.3.1: The configuration failed
---------------------------------------------------------------------------------
Asking python-config for pyembed '--cflags --libs --ldflags' flags
['/nix/store/grz0f8gr880c1rff3fnxlll9bdiczy8z-python3-3.7.7/bin/python3-config', '--cflags', '--libs', '--ldflags']
out: -I/nix/store/grz0f8gr880c1rff3fnxlll9bdiczy8z-python3-3.7.7/include/python3.7m -I/nix/store/grz0f8gr880c1rff3fnxlll9bdiczy8z-python3-3.7.7/include/python3.7m  -Wno-unused-result -Wsign-compare  -DNDEBUG -g -fwrapv -O3 -Wall
-lpython3.7m -lpthread -ldl -lcrypt -lncurses -lutil -lm 
 -L/nix/store/grz0f8gr880c1rff3fnxlll9bdiczy8z-python3-3.7.7/lib -lpython3.7m -lpthread -ldl -lcrypt -lncurses -lutil -lm 

Unhandled flag '-Wno-unused-result'
Unhandled flag '-Wsign-compare'
Unhandled flag '-Wall'
yes
---------------------------------------------------------------------------------
Testing pyembed configuration
==>
#define PYTHONDIR "/nix/store/9vmwacvb5yk0dk37ljp3lm7sk4d484wy-talloc-2.3.1-armv7l-unknown-linux-gnueabihf/lib/python3.7/site-packages"
#define PYTHONARCHDIR "/nix/store/9vmwacvb5yk0dk37ljp3lm7sk4d484wy-talloc-2.3.1-armv7l-unknown-linux-gnueabihf/lib/python3.7/site-packages"
#define HAVE_PYEMBED 1


#include <Python.h>
#ifdef __cplusplus
extern "C" {
#endif
	void Py_Initialize(void);
	void Py_Finalize(void);
#ifdef __cplusplus
}
#endif
int main(int argc, char **argv)
{
   (void)argc; (void)argv;
   Py_Initialize();
   Py_Finalize();
   return 0;
}

<==
[1/2] Compiling �[32mbin/.conf_check_e31dcabadd947986d27cff2fef60f6d7/test.c�[0m

['armv7l-unknown-linux-gnueabihf-gcc', '-MMD', '-D_GNU_SOURCE=1', '-D_XOPEN_SOURCE_EXTENDED=1', '-g', '-fwrapv', '-O3', '-I/nix/store/grz0f8gr880c1rff3fnxlll9bdiczy8z-python3-3.7.7/include/python3.7m', '-DNDEBUG', '../../test.c', '-c', '-o/build/talloc-2.3.1/bin/.conf_check_e31dcabadd947986d27cff2fef60f6d7/testbuild/default/test.c.1.o']
err: In file included from /nix/store/grz0f8gr880c1rff3fnxlll9bdiczy8z-python3-3.7.7/include/python3.7m/Python.h:63,
                 from ../../test.c:6:
/nix/store/grz0f8gr880c1rff3fnxlll9bdiczy8z-python3-3.7.7/include/python3.7m/pyport.h:699:2: error: #error "LONG_BIT definition appears wrong for platform (bad gcc/glibc config?)."
  699 | #error "LONG_BIT definition appears wrong for platform (bad gcc/glibc config?)."
      |  ^~~~~

from /build/talloc-2.3.1: Test does not build: Traceback (most recent call last):
  File "/build/talloc-2.3.1/third_party/waf/waflib/Configure.py", line 595, in run_build
    bld.compile()
  File "/build/talloc-2.3.1/third_party/waf/waflib/Build.py", line 355, in compile
    raise Errors.BuildError(self.producer.error)
waflib.Errors.BuildError: Build failed
 -> task in 'testprog' failed with exit status 1 (run with -v to display more information)

Could not build a python embedded interpreter
from /build/talloc-2.3.1: The configuration failed
---------------------------------------------------------------------------------
Testing pyembed configuration
==>
#define PYTHONDIR "/nix/store/9vmwacvb5yk0dk37ljp3lm7sk4d484wy-talloc-2.3.1-armv7l-unknown-linux-gnueabihf/lib/python3.7/site-packages"
#define PYTHONARCHDIR "/nix/store/9vmwacvb5yk0dk37ljp3lm7sk4d484wy-talloc-2.3.1-armv7l-unknown-linux-gnueabihf/lib/python3.7/site-packages"
/* #undef HAVE_PYEMBED */


#include <Python.h>
#ifdef __cplusplus
extern "C" {
#endif
	void Py_Initialize(void);
	void Py_Finalize(void);
#ifdef __cplusplus
}
#endif
int main(int argc, char **argv)
{
   (void)argc; (void)argv;
   Py_Initialize();
   Py_Finalize();
   return 0;
}

<==
[1/2] Compiling �[32mbin/.conf_check_d1fed7471d6ac2da10deb855f2d4095e/test.c�[0m

['armv7l-unknown-linux-gnueabihf-gcc', '-MMD', '-D_GNU_SOURCE=1', '-D_XOPEN_SOURCE_EXTENDED=1', '-g', '-fwrapv', '-O3', '-I/nix/store/grz0f8gr880c1rff3fnxlll9bdiczy8z-python3-3.7.7/include/python3.7m', '-DNDEBUG', '../../test.c', '-c', '-o/build/talloc-2.3.1/bin/.conf_check_d1fed7471d6ac2da10deb855f2d4095e/testbuild/default/test.c.1.o']
err: In file included from /nix/store/grz0f8gr880c1rff3fnxlll9bdiczy8z-python3-3.7.7/include/python3.7m/Python.h:63,
                 from ../../test.c:6:
/nix/store/grz0f8gr880c1rff3fnxlll9bdiczy8z-python3-3.7.7/include/python3.7m/pyport.h:699:2: error: #error "LONG_BIT definition appears wrong for platform (bad gcc/glibc config?)."
  699 | #error "LONG_BIT definition appears wrong for platform (bad gcc/glibc config?)."
      |  ^~~~~

from /build/talloc-2.3.1: Test does not build: Traceback (most recent call last):
  File "/build/talloc-2.3.1/third_party/waf/waflib/Configure.py", line 595, in run_build
    bld.compile()
  File "/build/talloc-2.3.1/third_party/waf/waflib/Build.py", line 355, in compile
    raise Errors.BuildError(self.producer.error)
waflib.Errors.BuildError: Build failed
 -> task in 'testprog' failed with exit status 1 (run with -v to display more information)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "./buildtools/wafsamba/samba_waf18.py", line 176, in check
    ret = self.run_build(*k, **kw)
  File "/build/talloc-2.3.1/third_party/waf/waflib/Configure.py", line 317, in fun
    return f(*k, **kw)
  File "/build/talloc-2.3.1/third_party/waf/waflib/Configure.py", line 598, in run_build
    self.fatal(ret)
  File "/build/talloc-2.3.1/third_party/waf/waflib/Context.py", line 495, in fatal
    raise self.errors.ConfigurationError(msg, ex=ex)
waflib.Errors.ConfigurationError: Test does not build: Traceback (most recent call last):
  File "/build/talloc-2.3.1/third_party/waf/waflib/Configure.py", line 595, in run_build
    bld.compile()
  File "/build/talloc-2.3.1/third_party/waf/waflib/Build.py", line 355, in compile
    raise Errors.BuildError(self.producer.error)
waflib.Errors.BuildError: Build failed
 -> task in 'testprog' failed with exit status 1 (run with -v to display more information)

(complete log in /build/talloc-2.3.1/bin/config.log)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/build/talloc-2.3.1/third_party/waf/waflib/Tools/python.py", line 361, in check_python_headers
    conf.test_pyembed(xx)
  File "./buildtools/wafsamba/samba_utils.py", line 66, in fun
    return f(*k, **kw)
  File "/build/talloc-2.3.1/third_party/waf/waflib/Tools/python.py", line 242, in test_pyembed
    features='%s %sprogram pyembed' % (mode, mode))
  File "./buildtools/wafsamba/samba_utils.py", line 66, in fun
    return f(*k, **kw)
  File "./buildtools/wafsamba/samba_waf18.py", line 182, in check
    self.fatal('The configuration failed')
  File "/build/talloc-2.3.1/third_party/waf/waflib/Context.py", line 495, in fatal
    raise self.errors.ConfigurationError(msg, ex=ex)
waflib.Errors.ConfigurationError: The configuration failed
(complete log in /build/talloc-2.3.1/bin/config.log)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/build/talloc-2.3.1/third_party/waf/waflib/Configure.py", line 595, in run_build
    bld.compile()
  File "/build/talloc-2.3.1/third_party/waf/waflib/Build.py", line 355, in compile
    raise Errors.BuildError(self.producer.error)
waflib.Errors.BuildError: Build failed
 -> task in 'testprog' failed with exit status 1 (run with -v to display more information)

Could not build a python embedded interpreter
from /build/talloc-2.3.1: The configuration failed

Here's a samba bug report which looks like a very similar issue. Comment says, "Looks like the test tries to link against the host version of libpython3.7.a, instead of the target version."

@Thra11
Copy link
Member Author

Thra11 commented Jun 20, 2020

So my understanding of the problem so far is that because python is in nativeBuildInputs, it gets the native/build version of python. When it checks whether pyembed works, it calls the native python-config binary to get include paths, linker flags and so on. As a result, it then tries to build a binary using the cross toolchain, while including native headers, which fails because some type, LONG_BIT isn't the same width. (Is it possible that some build+host platforms happen to have enough matching types to pass this assertion?)

If we move python to buildInputs, it fails even earlier, as it can't find python in the path. Assuming it could find the host python and python-config, there is no guarantee that it will be able to execute them on the build machine to get the correct flags. This leads me to believe that you can't just "trick it" into getting the pyembed flags for the host platform: either waf or python-config needs to know we're cross compiling, and where the host python is. From the logs, it looks like waf is being passed --cross-compile.

A workaround is to add --disable-python to wafConfigureFlags when cross compiling.

@Thra11 Thra11 changed the title pkgsCross.armv7l-hf-multiplatform.talloc fails to build pkgsCross.armv7l-hf-multiplatform.talloc fails to build on aarch64 Oct 2, 2020
@FRidh
Copy link
Member

FRidh commented Nov 19, 2020

Fixed with #98915.

@FRidh FRidh closed this as completed Nov 19, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants