Repository navigation
freeze cannot find Modules/_hacl/libHacl_Hash_*.o #145810
Copy link
Copy link
Open
Labels
buildThe build process and cross-buildThe build process and cross-buildextension-modulesC modules in the Modules dirC modules in the Modules dirtype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error
Description
Bug report
Bug description:
Dear maintainers,
unfortunately, the fix of issue #116043 in Python 3.14 does not fix the problem at all. Now freeze.py adds dependencies to some Modules/_hacl/libHacl_Hash*.o files,
although their functionality is already contained in cpython. The result again ist that linking is not possible:
/usr/bin/x86_64-linux-gnu-ld.bfd: cannot find Modules/_hacl/Hacl_Hash_Blake2s.o: No such file or directory
/usr/bin/x86_64-linux-gnu-ld.bfd: cannot find Modules/_hacl/Hacl_Hash_Blake2b.o: No such file or directory
/usr/bin/x86_64-linux-gnu-ld.bfd: cannot find Modules/_hacl/Lib_Memzero0.o: No such file or directory
/usr/bin/x86_64-linux-gnu-ld.bfd: cannot find Modules/_hacl/Hacl_Hash_Blake2s_Simd128.o: No such file or directory
/usr/bin/x86_64-linux-gnu-ld.bfd: cannot find Modules/_hacl/Hacl_Hash_Blake2b_Simd256.o: No such file or directory
/usr/bin/x86_64-linux-gnu-ld.bfd: cannot find Modules/_hacl/Hacl_Hash_MD5.o: No such file or directory
/usr/bin/x86_64-linux-gnu-ld.bfd: cannot find Modules/_hacl/Hacl_Hash_SHA1.o: No such file or directory
/usr/bin/x86_64-linux-gnu-ld.bfd: cannot find Modules/_hacl/Hacl_Hash_SHA2.o: No such file or directory
/usr/bin/x86_64-linux-gnu-ld.bfd: cannot find Modules/_hacl/Hacl_Hash_SHA3.o: No such file or directory
collect2: error: ld returned 1 exit status
See attached error-log.txtfor the full compilation log. Thus, only again the crude hack creating all these files as empty files helps.
Here the steps to reproduce:
$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu Resolute Raccoon (development branch)
Release: 26.04
Codename: resolute
$ python3 --version
Python 3.14.3
$ cat helloworld.py
#!/usr/bin/python3
import hashlib
print("Hello, World!")
m = hashlib.sha256()
#m = hashlib.sha3_224()
m.update(b"nobody inspects")
print(m.hexdigest())
$ /usr/share/doc/python3.14/examples/freeze/freeze.py -X setuptools -o frozen helloworld.py
$ cd frozen
$ make &> error_log.txt <-- see attachement to this issue
$ mkdir -p Modules/_hacl
$ touch Modules/_hacl/Hacl_Hash_Blake2s.o
$ touch Modules/_hacl/Hacl_Hash_Blake2b.o
$ touch Modules/_hacl/Lib_Memzero0.o
$ touch Modules/_hacl/Hacl_Hash_Blake2s_Simd128.o
$ touch Modules/_hacl/Hacl_Hash_Blake2b_Simd256.o
$ touch Modules/_hacl/Hacl_Hash_MD5.o
$ touch Modules/_hacl/Hacl_Hash_SHA1.o
$ touch Modules/_hacl/Hacl_Hash_SHA2.o
$ touch Modules/_hacl/Hacl_Hash_SHA3.o
$ make
$ ./helloworld
Hello, World!
5880e257e70b83842737244b412a2f282e0f230953027a22104efc615d90d3f9
Many thanks,
Chris
Attachements
error-log.txt
CPython versions tested on:
3.14
Operating systems tested on:
Linux
Reactions are currently unavailable
Pinned by picnixz
Pinned comment options
Can you also expand error_log.txt in a
Details
section please?
Here you go. (I have to use an extra comment, as in one description only 65000 characters are allowed)
x86_64-linux-gnu-gcc -fno-strict-overflow -Wsign-compare -DNDEBUG -g -O2 -Wall -DNDEBUG -g -O2 -Wall -IObjects -IInclude -IPython -I. -I../Include -I/usr/include/python3.14 -I/usr/include/python3.14 -c config.c
x86_64-linux-gnu-gcc -fno-strict-overflow -Wsign-compare -DNDEBUG -g -O2 -Wall -DNDEBUG -g -O2 -Wall -IObjects -IInclude -IPython -I. -I../Include -I/usr/include/python3.14 -I/usr/include/python3.14 -c frozen.c
x86_64-linux-gnu-gcc -fno-strict-overflow -Wsign-compare -DNDEBUG -g -O2 -Wall -DNDEBUG -g -O2 -Wall…Metadata
Metadata
Assignees
Labels
buildThe build process and cross-buildThe build process and cross-buildextension-modulesC modules in the Modules dirC modules in the Modules dirtype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error
Activity
ZeroIntensity commentedon Mar 11, 2026
cc @picnixz
picnixz commentedon Mar 11, 2026
I think I was only aware of the issue for HMAC, which should be fixed but please tell me if using
hmacalso fails. IIRC, we are linking them statically so I don't know why we are trying to find a.o(but maybe hashlib isn't doing it actually). Can you also expanderror_log.txtin a<details>section please? It's easier for people that just read the issue. TiA.I unfortunately don't have time to address this issue for now because of my daily job and my travels. We have quite a lot of issues with the build system because HMAC requires some files to exist and there are also other subtleties due to the configure options and CPUID capabilities.
chris21k commentedon Mar 12, 2026
Here you go. (I have to use an extra comment, as in one description only 65000 characters are allowed)
chris21k commentedon Mar 12, 2026
Actually I do not use anything of
hashlibat all. It was only for demonstration purposes to show that linking anything, neither statically nor dynamically, is necessary also already contained in cpython. You may replace the content of the abovehelloworld.pywith a simpleprint("Hello, World!")and nothing else. You then will get the same error messages from the linker.picnixz commentedon Mar 12, 2026
Ok, so I think what I did in #132438 actually wasn't enough. Previously, we statically linked HACL* but it caused issues with freeze. So we needed to make them dynamic. But it still causes issues! One possible reason I have in mind is that we are not creating a
.sofile that we install when installing Python and this is the root cause of our problems. The reason why I thought it worked is likely because I installed Python in the same directory as the sources so the file was present!However, creating an
.sofile for each of the HACL* is also very hard to properly do it... I need to think about it. I think we should build our own vendored.soor.aof the various HACL* modules we need and use them as if it were regular libraries. A bit like we dompdecimaland others, though all other libraries (that is, only mpdecimal and expat) are statically linked. I really hate linkers.cc @protz @gpshead @encukou @Yhg1s
protz commentedon Mar 12, 2026
I think the solution you describe should not be hard to implement, I'm just somewhat surprised that just statically linking doesn't work. But I don't understand enough about freeze.
protz commentedon Mar 12, 2026
(The upstream build of HACL* does produce a .so and a .a by default, so no issue there)
MichaIng commentedon Mar 16, 2026
Strip `-LModules/_hacl` from sysconfig LDFLAGS (#1011)
Strip `-LModules/_hacl` from sysconfig LDFLAGS (astral-sh#1011)
Strip `-LModules/_hacl` from sysconfig LDFLAGS (astral-sh#1011)