-
Notifications
You must be signed in to change notification settings - Fork 25
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
endian specificity #995
Comments
I believe how this really ends up is:
Bootstrapping the entire system via endian neutral C++ would depend on if bitfields are used. |
@jaykrell I am interested to build it on PowerPC (Big-endian, of course). Can it be bootstrapped from C/C++, without pre-built binary (which may not exist)? |
Sorta, but it has always been difficult to explain. |
I see only little endian, or 64bit big endian bootstraps. |
@jaykrell If there exists a procedure to build it starting from gcc without pre-built cm3 binary, that will be preferable. I wanna make a port for Macports, and using cross-compilation for that purpose it not a workable option. Modula2 builds fine on Darwin ppc – within gcc, starting with nothing. There should be something similar here? |
I used to use cm3 on macppc.. long ago! But I'm sure the code is still in
there. But it required bootstrapping.
…On Mon, Oct 16, 2023, 1:46 AM Sergey Fedorov ***@***.***> wrote:
@jaykrell <https://github.com/jaykrell> If there exists a procedure to
build it starting from gcc without pre-built cm3 binary, that will be
preferable. I wanna make a port for Macports, and using cross-compilation
for that purpose it not a workable option.
Modula2 builds fine on Darwin ppc – within gcc, starting with nothing.
There should be something similar here?
—
Reply to this email directly, view it on GitHub
<#995 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/ABKYNJKX2S6YAHVPED5PGTTX7TX6NAVCNFSM5N72L7CKU5DIOJSWCZC7NNSXTN2JONZXKZKDN5WW2ZLOOQ5TCNZWGQYDAOJZHAYA>
.
You are receiving this because you are subscribed to this thread.Message
ID: ***@***.***>
|
@mikanystrom Do I need anything besides |
You can try this: or this or this from P.S. "Linux" and "le" has been used in naming as tradition. All files are universal |
Sorry: Release 16-50 is specific ... First try cm3-d5.11.9-ZZYYXX-20230928_16-50__cm3-boot-unix64le.7z As alternate variant You can try files from |
P.S.
Are You have PPC or PPC64? I've found: https://raw.githubusercontent.com/macports/macports-ports/master/lang/cm3/Portfile plus https://modula3.elegosoft.com/cm3/cm3-min-POSIX-PPC_DARWIN-5.4.0.tgz |
@VictorMiasnikov Oh wow, thank you very much! The port seems to outdated and broken across the board, but I will probably be able to fix it. P. S. Somehow I missed its existence, maybe searched for a different name. Anyway, all good now, thanks everyone for helping with this. |
You are welcome! I've found and cm3 5.8.6 on https://modula3.elegosoft.com/cm3/releng/download.html P.S. and found it. There is not most modern DARWIN_PPC, but there is SPARC64_SOLARIS I.e. I hope that it be useful... I only going to try install QEMU for non-ARM32 / non-ARM64 / non-AMD64 CPU architectures |
Unfortunately they aren't quite universal. So for "Unix" you'd need 4 bootstraps: LittleEndian32bit, LittleEndian64bit, BigEndian32bit, BigEndian64bit. You can just about ignore all this stuff..64bit little endian is prevalent, but here we are discussing 32bit big endian Mac PowerPC. The endian specificity is due to code breaking down floats into bitfields. |
It is pretty easy to build all these...we just don't quite have the automation setup, sorry. |
@VictorMiasnikov Thank you, this is very helpful. Do you know if I need exactly the same version for bootstrap binary and the main source? The latest Darwin PPC binary seems to be 5.8.6. |
It is hard to explain. Please consider that Gcc is also written in itself, and doesn't "just work", as if by magic. It is just that people provide the binaries for you. In the Modula-3 case, you'd cross build the bootstrap from a working system. The versions do not have to match though in general..if you build in the right order, which we automate. |
If OS does not matter (which sounds surprising to me, but I have no experience with |
And yeah, those older bootstraps should work. |
OS doesn't matter, because all the OS-dependent stuff is in #ifdef'ed C. Do you really not have a little endian 64bit Unix system from which to cross build from a current system? It is the right way to do it. |
Exactly little ? Strange, because this "arm32==x86==ppc32le arm64==amd64==riscv64 sparc64==ppc64be sparc32==ppc32be" contain another information. P.S. In case then really little endian 64bit Unix is good then we can start from cm3-d5.11.9-ZZYYXX-20230928_16-50__cm3-boot-unix64le.7z. After generate bootstrap by boot1.py P.P.S. It looks like, most realistic way is install cm3 on all possible vars of "arm32==x86==ppc32le arm64==amd64==riscv64 sparc64==ppc64be sparc32==ppc32be" with preference "sparc64==ppc64be sparc32==ppc32be" vars. And after this generate bootstrap(s) by boot1.py |
Okay, a lazy approach of merely replacing the version is the portfile did not work:
This |
( Sorry for formatting. I will fix later)
Lets go step by step.
As first step: We should known "where we are?".
Is cm3 5.4.0 or 5.2.6 ( plus/minus) DARWIN_PPC32 binaries good? It's run and work?
Are You have VM on QEMU with OS Solaris?
Are You have computer with OS Linux? With Windows?
|
Bootstrap binary seems perfectly okay:
This is 5.8.6, from the link you shared above. No, I do not have non-macOS systems that are functional. (I tried installing FreeBSD recently, but upstream has broken multicore support in v. 13, and on G4 it will take forever to build anything; in any case, I have no experience with it, so macOS is way easier). |
( Again ugly formating 2023-11-02: it's fixed)
- -
boot1.py DARWIN_PPC
- please run it. Have result file .tar.gz?
- -
} (( 5.8.6, from the link you shared above. ))
I have published to many links -).
Please send to me / to all us direct URL.
- -
As I know J.K. don't have PPC hardware.
I don't have to.
I may be can install Darwin to QEMU, but I am not sure how quick process it is.
- -
You can use x86 hardware as "really good working case / environment".
And run boot1.py DARWIN_PPC on it.
But best use "big endian" hardware...
- -
( Are You see my personal e-mails?)
- -
|
Do it the other way around. First run amd64 or x86 on any system. Windows, Mac, Linux, anything. Then cross to Macppc. Do not favor an old “closer” match. |
Sorry, for formatting and possible intercept (?).
My latest cm3-unixle is good for DARWIN_PPC64 ?
If "yes" then I try prepare cm3-unixle for 32 bit Linux / Unix.
|
@jaykrell Cross-compiling is not an option for Macports. We need to implement a process that works for everyone, not just a hack to make it work locally for me. @VictorMiasnikov I do not think anything |
You must/should start with cross building. |
@jaykrell Why not use existing boot binaries though? I mean, I realize you know better, I just want to understand why it is the case. |
Get cm3 working on some system.
Q: I.e. we can use LE systems?For example I386_NT ?Or even AMD64_NT or AMD64_LINUX?
Then use boot1.py
I can run " boot1.py DARWIN_PPC ".
( I am going to do this on Monday)
|
@VictorMiasnikov So, I have used this above: cm3-bin-min-PPC_DARWIN-5.8.6-REL. It is from your link: https://modula3.elegosoft.com/cm3/releng/download.html The latest one explicitly referring to I used this portfile, replacing versions accordingly (both for bootstrap binary and the source): https://github.com/macports/macports-ports/blob/master/lang/cm3/Portfile |
@VictorMiasnikov UPD. In fact, we do seem to have 5.9.0 for Darwin PPC: https://modula3.elegosoft.com/cm3/snaps/cm3-bin-core-PPC_DARWIN-d5.9.0-powerpc-apple-darwin8.11.0-2012-08-21-21-26-33.tgz |
Thank for answer! |
cm3-boot-PPC_DARWIN-d5.11.9-20231023_11-47.tar.xz P.S. Replaced by |
@VictorMiasnikov Awesome, thank you very much! Initial run of
This is not via portfile. I just manually extracted, cd to top directory and ran make. |
May be simple remove line 721 ?.. |
Removing that line, build proceeded until:
This apparently happens because |
Trashing a duplicate BOOL define, next one is:
P. S. I wonder why these errors do not show up on Linux. |
I going to prepare cm3-boot-PPC_DARWIN-d5.11.9-20231023_15-08.tar.gz with this:
Of course, all this will be temporаry solution P.S. Done. Please see: |
@VictorMiasnikov Here we go:
I had to amend Makefile to use CXX, as it should. With CC it pulls |
( Again formatting... 2023-11-02: it's fixed)
Please send all patches back to me.
I will integrate they to cm3-boot and upgrade rel-se.
|
FIX 2 errors on PPC_DARWIN 1) FIX error on PPC_DARWIN by adding M3_BOOL_H_INCLUDED modula3#995 (comment) = = M3CC.c:9: error: redefinition of typedef ‘BOOL’ m3core.h:46: error: previous declaration of ‘BOOL’ was here make: *** [M3CC.o] Error 1 = = a-la m3-sys\m3gdb\gdb\gdb\m3-bool.h == #ifndef M3_BOOL_H_INCLUDED #define M3_BOOL_H_INCLUDED typedef int BOOL; #define TRUE 1 #define FALSE 0 #endif == 2) FIX error on PPC_DARWIN by adding M3_USOCKET__SOCKLEN_T_H_INCLUDED modula3#995 (comment) = = In file included from CerrnoC.c:6: m3core.h:721: error: redefinition of typedef ‘Usocket__socklen_t’ m3core.h:698: error: previous declaration of ‘Usocket__socklen_t’ was here make: *** [CerrnoC.o] Error 1 = = by preprocessor var M3_USOCKET__SOCKLEN_T_H_INCLUDED : #ifndef M3_USOCKET__SOCKLEN_T_H_INCLUDED #define M3_USOCKET__SOCKLEN_T_H_INCLUDED typedef m3_socklen_t Usocket__socklen_t; #endif
FIX 2 errors on PPC_DARWIN 1) FIX error on PPC_DARWIN by adding M3_BOOL_H_INCLUDED modula3#995 (comment) = = M3CC.c:9: error: redefinition of typedef ‘BOOL’ m3core.h:46: error: previous declaration of ‘BOOL’ was here make: *** [M3CC.o] Error 1 = = a-la m3-sys\m3gdb\gdb\gdb\m3-bool.h == #ifndef M3_BOOL_H_INCLUDED #define M3_BOOL_H_INCLUDED typedef int BOOL; #define TRUE 1 #define FALSE 0 #endif == 2) FIX error on PPC_DARWIN by adding M3_USOCKET__SOCKLEN_T_H_INCLUDED modula3#995 (comment) = = In file included from CerrnoC.c:6: m3core.h:721: error: redefinition of typedef ‘Usocket__socklen_t’ m3core.h:698: error: previous declaration of ‘Usocket__socklen_t’ was here make: *** [CerrnoC.o] Error 1 = = by preprocessor var M3_USOCKET__SOCKLEN_T_H_INCLUDED : #ifndef M3_USOCKET__SOCKLEN_T_H_INCLUDED #define M3_USOCKET__SOCKLEN_T_H_INCLUDED typedef m3_socklen_t Usocket__socklen_t; #endif
FIX 2 errors on PPC_DARWIN 1) FIX error on PPC_DARWIN by adding M3_BOOL_H_INCLUDED modula3#995 (comment) = = M3CC.c:9: error: redefinition of typedef ‘BOOL’ m3core.h:46: error: previous declaration of ‘BOOL’ was here make: *** [M3CC.o] Error 1 = = a-la m3-sys\m3gdb\gdb\gdb\m3-bool.h == #ifndef M3_BOOL_H_INCLUDED #define M3_BOOL_H_INCLUDED typedef int BOOL; #define TRUE 1 #define FALSE 0 #endif == 2) FIX error on PPC_DARWIN by adding M3_USOCKET__SOCKLEN_T_H_INCLUDED modula3#995 (comment) = = In file included from CerrnoC.c:6: m3core.h:721: error: redefinition of typedef ‘Usocket__socklen_t’ m3core.h:698: error: previous declaration of ‘Usocket__socklen_t’ was here make: *** [CerrnoC.o] Error 1 = = by preprocessor var M3_USOCKET__SOCKLEN_T_H_INCLUDED : #ifndef M3_USOCKET__SOCKLEN_T_H_INCLUDED #define M3_USOCKET__SOCKLEN_T_H_INCLUDED typedef m3_socklen_t Usocket__socklen_t; #endif
Please, see |
cm3 does provide interopability of Modula-3 bitfields with C bitfields.
Can we decree that that isn't really guaranteed?
Or at least not on big endian systems?
Or at least not if you build with -boot?
i.e. either little endian always, or -boot implies little endian?
I want "one" bootstrap to be endian neutral,
for the larger target matrix to be covered by fewer/one downloads.
The text was updated successfully, but these errors were encountered: