This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: Python 3.7.4 does not build on Raspbian Buster with optimizations
Type: compile error Stage: resolved
Components: Build Versions: Python 3.7
process
Status: closed Resolution: out of date
Dependencies: Superseder:
Assigned To: Nosy List: DNSGeek, benjamin.peterson, christian.heimes, iritkatriel, kal.sze
Priority: normal Keywords:

Created on 2019-07-15 01:46 by kal.sze, last changed 2022-04-11 14:59 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
python-build.20190711104717.24526.log kal.sze, 2019-07-15 01:46 Build log
Messages (8)
msg347948 - (view) Author: Kal Sze (kal.sze) Date: 2019-07-15 01:46
Like the title says.

Tried building with these `configure` options:

    --enable-optimizations \
    --with-lto \
    --enable-shared \
    --enable-loadable-sqlite-extensions \
    --enable-ipv6 \
    --with-system-expat \
    --with-system-ffi \
    --with-system-libmpdec \
    --with-doc-strings \
    --with-pymalloc \
    --with-c-locale-coercion \
    --with-ensurepip=upgrade

And `CFLAGS="-O3 -march=native"`

But got this error message:

```
/usr/bin/ld: ./libpython3.7m.so: undefined reference to `__gcov_pow2_profiler_atomic'
/usr/bin/ld: ./libpython3.7m.so: undefined reference to `__gcov_average_profiler_atomic'
collect2: error: ld returned 1 exit status
make[3]: *** [Makefile:733: Programs/_testembed] Error 1
make[3]: Leaving directory '/tmp/python-build.20190712163526.2762/Python-3.7.4'
make[2]: *** [Makefile:521: build_all_generate_profile] Error 2
make[2]: Leaving directory '/tmp/python-build.20190712163526.2762/Python-3.7.4'
make[1]: *** [Makefile:497: profile-gen-stamp] Error 2
make[1]: Leaving directory '/tmp/python-build.20190712163526.2762/Python-3.7.4'
make: *** [Makefile:509: profile-run-stamp] Error 2
```
msg348402 - (view) Author: Thomas Knox (DNSGeek) Date: 2019-07-24 19:06
Any update on this? This is biting me too.

I've tested on a Raspberry Pi 3B+, a 4B and a Zero W all running buster. All of them exhibit this same behavior.

Also, this same error is preventing Python 2.7.16 from compiling on the same hardware.
msg348834 - (view) Author: Kal Sze (kal.sze) Date: 2019-08-01 03:13
I looked at my build log again.

The very first line that jumps out as abnormal is this:

    /usr/bin/ld: /usr/bin/ld: DWARF error: invalid abstract instance DIE ref

A quick DuckDuckGoing suggests that this *may* be related to a broken version of binutils: https://lists.gnu.org/archive/html/bug-binutils/2018-07/msg00150.html

The current, most up-to-date version of binutils in Raspbian Stretch is this:

    $ dpkg -l binutils
    Desired=Unknown/Install/Remove/Purge/Hold
    | Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend
    |/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
    ||/ Name           Version        Architecture Description
    +++-==============-==============-============-==========================================
    ii  binutils       2.31.1-16+rpi1 armhf        GNU assembler, linker and binary utilities

A quick grep of the output of `apt changelog binutils` doesn't mention the bug number (23425).

I don't know what conclusion to draw.
msg348835 - (view) Author: Kal Sze (kal.sze) Date: 2019-08-01 03:14
Sorry, I meant most up-to-date version of binutils in Raspbian *Buster* in my previous message.
msg348836 - (view) Author: Benjamin Peterson (benjamin.peterson) * (Python committer) Date: 2019-08-01 03:45
Presumably dropping --enable-optimizations will fix this problem.
msg348843 - (view) Author: Kal Sze (kal.sze) Date: 2019-08-01 08:09
Yes, removing --enable-optimizations and keeping all other configure options allows me to build.

However, I think most people *do* want optimizations, especially because the Raspberry Pi itself already isn't very fast.
msg410439 - (view) Author: Irit Katriel (iritkatriel) * (Python committer) Date: 2022-01-12 23:03
Closed issue38204 as a duplicate of this. I don't know whether the problem still exists in current python versions.
msg410485 - (view) Author: Christian Heimes (christian.heimes) * (Python committer) Date: 2022-01-13 12:01
./configure --enable-optimizations && make is passing for 3.9 branch on Raspbian Buster with latest updates. I tested it on one of my Raspberry Pi 3 Model B Rev 1.2 in the morning. Python 3.7 and 3.8 are in security fix-only mode and therefore no longer in scope.
History
Date User Action Args
2022-04-11 14:59:18adminsetgithub: 81776
2022-01-13 12:01:10christian.heimessetstatus: open -> closed

nosy: + christian.heimes
messages: + msg410485

resolution: out of date
stage: resolved
2022-01-12 23:04:07iritkatriellinkissue38204 superseder
2022-01-12 23:03:25iritkatrielsetnosy: + iritkatriel

messages: + msg410439
title: Python 3.7.4 does not build on Raspbian Buster -> Python 3.7.4 does not build on Raspbian Buster with optimizations
2019-08-01 08:09:28kal.szesetmessages: + msg348843
2019-08-01 03:45:48benjamin.petersonsetnosy: + benjamin.peterson
messages: + msg348836
2019-08-01 03:14:15kal.szesetmessages: + msg348835
2019-08-01 03:13:21kal.szesetmessages: + msg348834
2019-07-24 19:06:01DNSGeeksetnosy: + DNSGeek
messages: + msg348402
2019-07-15 01:46:39kal.szecreate