Opened 2 years ago
Last modified 2 months ago
#65992 assigned defect
py310-pycryptodome fails to build on 10.5.8: error: #error No routines for aligned memory; error: ‘for’ loop initial declaration used outside C99 mode
Reported by: | barracuda156 | Owned by: | catap (Kirill A. Korinsky) |
---|---|---|---|
Priority: | Normal | Milestone: | |
Component: | ports | Version: | 2.7.2 |
Keywords: | powerpc, leopard, snowleopard | Cc: | |
Port: | py310-pycryptodome, py-pycryptodome |
Description
There are numerous errors of the following kind:
In file included from src/MD2.c:28: src/common.h:179:2: error: #error No routines for aligned memory
And also:
In file included from src/ed25519.c:46: src/common.h:179:2: error: #error No routines for aligned memory src/ed25519.c: In function ‘ed25519_cmp’: src/ed25519.c:267: error: ‘for’ loop initial declaration used outside C99 mode src/ed25519.c:275: error: redefinition of ‘i’ src/ed25519.c:267: error: previous definition of ‘i’ was here src/ed25519.c:275: error: ‘for’ loop initial declaration used outside C99 mode
- S. The port also fails on 10.6 PPC in a same manner.
Attachments (1)
Change History (16)
Changed 2 years ago by barracuda156
comment:1 follow-up: 2 Changed 2 years ago by kencu (Ken)
comment:2 Changed 2 years ago by barracuda156
Replying to kencu:
As step 1 I would:
- add legacysupport
- add
configure.cflags-append -std=c99
For some reason it does not want to pass the flag. Weird. I will return to this.
comment:3 follow-up: 12 Changed 2 years ago by catap (Kirill A. Korinsky)
I'm wondering isn't it enough to setup compiler.c_standard
and compiler.cxx_standard
? Also, keep in mind that MacPorts contains two ports form near the same codebase: pycryptodome and pycryptodomex
comment:4 Changed 2 years ago by kencu (Ken)
the aligned memory functions I added to legacysupport…using a newer gcc would be unexpected to find them without it.
the usual fix for this:
error: ‘for’ loop initial declaration used outside C99 mode
is simply to enable C99 mode…the gcc-4.2 compiler defaults to c89, but gcc7 defaults to C11 so you could use that to get c99 mode if you can’t figure out how to get std=c99 onto the build line. MacPorts dislikes that kind of fix, as you know.
but have to actually try it to see what happens, of course.
comment:5 Changed 2 years ago by kencu (Ken)
Oh, these python ports are hard to manipulate.
Adding legacysupport does nothing, as it is not used even if added:
usr/bin/gcc-4.2 -fno-strict-aliasing -Wsign-compare -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -pipe -Os -arch i386 -isysroot/ -DHAVE_STDINT_H -DPYCRYPTO_LITTLE_ENDIAN -DSYS_BITS=32 -DLTC_NO_ASM -DHAVE_EMMINTRIN_H -DUSE_SSE2 -DGCC_REALIGN -I/opt/local/Library/Frameworks/Python.framework/Versions/3.10/include/python3.10 -c src/raw_ocb.c -o build/temp.macosx-10.5-i386-cpython-310/src/raw_ocb.o -msse2
forcing gcc7 does fix the c99 errors, but the aligned memory issues still happen.
Perhaps we have to use the compiler wrapper PortGroup to get these python ports to obey the extra CFLAGS and LDFLAGS? Let me see...
comment:6 follow-ups: 7 8 9 14 Changed 2 years ago by kencu (Ken)
I personally find that making python ports do your bidding is hard.
I had trouble getting the compiler_wrapper PortGroup to make this work. I suspect the needed linker flags were not available during the testing phase for posix_memalign test file.
In the end, I added PortGroup legacysupport 1.0
and hacked this workaround into the Portfile
livecheck.type none + configure.cc ${configure.cc} -std=c99 -Wl,-lMacportsLegacySupport test.run yes
and it worked, building with the default gcc-4.2:
$ port -v installed py310-pycryptodome The following ports are currently installed: py310-pycryptodome @3.15.0_0 (active) requested_variants='' platform='darwin 9' archs='i386' date='2022-10-15T11:37:45-0700'
and it seemed to do OK on the test suite:
.................................................................................................................................................................................... ---------------------------------------------------------------------- Ran 2707 tests in 134.797s OK
that at least proves that this port can be built. What the elegant fix might be remains to be determined.
comment:7 Changed 23 months ago by barracuda156
Replying to kencu:
I personally find that making python ports do your bidding is hard.
and it seemed to do OK on the test suite:
.................................................................................................................................................................................... ---------------------------------------------------------------------- Ran 2707 tests in 134.797s OKthat at least proves that this port can be built. What the elegant fix might be remains to be determined.
Confirm that it builds with your fix on PPC and tests pass:
Ran 2707 tests in 258.449s OK
comment:8 Changed 23 months ago by barracuda156
Replying to kencu:
Could you/we make a PR with your fix? Or you aren’t yet sure about it?
comment:9 Changed 18 months ago by barracuda156
Replying to kencu:
Let’s merge it, otherwise people are unable to build it: https://forums.macrumors.com/threads/pycryptodomex-leopard-install-yewtube-former-mps-youtube.2386617/
comment:10 follow-ups: 11 13 Changed 3 months ago by metallizer-br
I'm having the same problem trying to build py312-pycrytodome in OSX Tiger for smtube.
comment:11 Changed 2 months ago by garoffoli (garoffoli)
Replying to metallizer-br:
I'm having the same problem trying to build py312-pycrytodome in OSX Tiger for smtube.
I'm having the same issue as metallizer-br with py311-cryptodome in Tiger. It seems that all py3xx-cryptodome packages are broken on PowerPC
comment:12 Changed 2 months ago by ryandesign (Ryan Carsten Schmidt)
Replying to catap:
I'm wondering isn't it enough to setup
compiler.c_standard
andcompiler.cxx_standard
?
Setting compiler.c_standard
or compiler.cxx_standard
tells MacPorts what compiler to use. It doesn't add any flags like -std=…
; that's for the build system to do, or the portfile if the build system doesn't do it.
comment:13 Changed 2 months ago by barracuda156
Replying to metallizer-br:
I'm having the same problem trying to build py312-pycrytodome in OSX Tiger for smtube.
Why smtube
needs that at all? I certainly do not have py312-pycrytodome
installed now, but I have smtube
installed and working.
UPD. Ah, I copied a misspelled version, so grep found nothing. I have a bunch of these ports installed:
36-25% port -v installed | grep pycryptodome py310-pycryptodome @3.12.0_0 requested_variants='' platform='darwin 10' archs='ppc' date='2022-01-12T18:51:59+0800' py310-pycryptodome @3.14.0_0 requested_variants='' platform='darwin 10' archs='ppc' date='2022-02-09T18:27:02+0800' py310-pycryptodome @3.14.1_0 requested_variants='' platform='darwin 10' archs='ppc' date='2022-02-25T18:56:29+0800' py310-pycryptodome @3.15.0_0 requested_variants='' platform='darwin 10' archs='ppc' date='2022-11-15T17:39:02+0800' py310-pycryptodome @3.18.0_0 requested_variants='' platform='darwin 10' archs='ppc' date='2023-08-23T09:17:11+0800' py310-pycryptodome @3.19.0_0 (active) requested_variants='' platform='darwin 10' archs='ppc' date='2024-01-16T15:26:59+0800' py311-pycryptodome @3.18.0_0 requested_variants='' platform='darwin 10' archs='ppc' date='2023-07-09T06:35:39+0800' py311-pycryptodome @3.19.0_0 (active) requested_variants='' platform='darwin 10' archs='ppc' date='2023-12-23T10:13:56+0800' py312-pycryptodome @3.19.0_0 (active) requested_variants='' platform='darwin 10' archs='ppc' date='2024-01-02T13:21:40+0800' py312-pycryptodomex @3.19.0_0 (active) requested_variants='' platform='darwin 10' archs='ppc' date='2024-05-29T21:20:51+0800' py38-pycryptodome @3.12.0_0 requested_variants='' platform='darwin 10' archs='ppc' date='2022-01-12T18:52:39+0800' py38-pycryptodome @3.14.0_0 requested_variants='' platform='darwin 10' archs='ppc' date='2022-02-09T18:25:03+0800' py38-pycryptodome @3.14.1_0 requested_variants='' platform='darwin 10' archs='ppc' date='2022-02-25T18:47:31+0800' py38-pycryptodome @3.19.0_0 (active) requested_variants='' platform='darwin 10' archs='ppc' date='2024-06-11T07:54:58+0800' py39-pycryptodome @3.12.0_0 requested_variants='' platform='darwin 10' archs='ppc' date='2022-01-12T18:51:12+0800' py39-pycryptodome @3.14.0_0 requested_variants='' platform='darwin 10' archs='ppc' date='2022-02-09T18:26:22+0800' py39-pycryptodome @3.14.1_0 requested_variants='' platform='darwin 10' archs='ppc' date='2022-02-25T18:51:58+0800' py39-pycryptodome @3.15.0_0 requested_variants='' platform='darwin 10' archs='ppc' date='2022-11-21T13:56:31+0800' py39-pycryptodome @3.19.0_0 (active) requested_variants='' platform='darwin 10' archs='ppc' date='2024-06-11T08:06:24+0800'
comment:14 Changed 2 months ago by garoffoli (garoffoli)
Replying to kencu:
I personally find that making python ports do your bidding is hard.
I had trouble getting the compiler_wrapper PortGroup to make this work. I suspect the needed linker flags were not available during the testing phase for posix_memalign test file.
In the end, I added
PortGroup legacysupport 1.0
and hacked this workaround into the Portfilelivecheck.type none + configure.cc ${configure.cc} -std=c99 -Wl,-lMacportsLegacySupport test.run yesand it worked, building with the default gcc-4.2:
$ port -v installed py310-pycryptodome The following ports are currently installed: py310-pycryptodome @3.15.0_0 (active) requested_variants='' platform='darwin 9' archs='i386' date='2022-10-15T11:37:45-0700'and it seemed to do OK on the test suite:
.................................................................................................................................................................................... ---------------------------------------------------------------------- Ran 2707 tests in 134.797s OKthat at least proves that this port can be built. What the elegant fix might be remains to be determined.
I tried this workaround with gcc7 on 10.4.11. It still didn't work at all. I need pycryptodome to try out LibreSpot-Python
comment:15 Changed 2 months ago by barracuda156
Well, I can’t test anything on 10.5.
Given that I have the port installed from source, it should build for ppc
at least with the current gcc. I can try reproducing that a bit later.
As step 1 I would:
configure.cflags-append -std=c99