Yamaoto Toshi · 2022-02-14 17:53
Hey lainons.
I'm kind of on an adventure with an M1 build of macOS and my C compiler.
I've successfuly managed to build the native C runtime library `crt0.o` ( `Csu` [https://github.com/apple-oss-distributions/Csu] and headers from `darwin-xnu` [https://github.com/apple/darwin-xnu] are required), but I've discovered that this isn't enough to build static binaries on my machine.
I also need to do a default rebuild of the C standard libraries (`Libc` @ https://github.com/apple-oss-distributions/Libc/tree/Libc-1439.141.1), such that it yields *.o and *.a files.
I have the source code for the libraries, but they don't have a standard compilation script for make.
I might need some help with creating a Makefile for this.
If I can get this done, I think I'll gather all the stuff here for Csu and Libc to github for a repo to build on macOS to help expand programmer and user freedoms on Apple machines.
Y'all interested?
>Pic somewhat related, projects hosted on github, can't complete post without image
SHODAN · 2022-02-14 18:24
>>30117
Oh, one other thing.
I also noticed that the source code for `stdarg` is missing from the repository.
I’ll need to find out where it is.
Marly Krushkhova · 2022-02-14 18:36
>>30119
Okay, it’s in their repo for `gcc`.
I’ll be sure to clone and build it when I get home from work.
Junichi Fujiwara · 2022-02-14 21:10
i guess you could start with a makefile that tries to compile literally all .c/.S files and then figure out by the errors you get what flags to add and what files to exclude.
that file "Libc/Libc.xcodeproj/project.pbxproj": have you already tried opening the project with xcode and see if you can get some info?
>>30120
stdarg is one of the "freestanding headers" which are supposed to be always available for every compiler.
can't help further, don't know much about this kind of things and even less about mac os
Cypher · 2022-02-14 21:42
>>30122
Yea, and I guess they’re all compiled right, Of only have to use `ar $@ $(objects)`[\code] like a normal C programming soykafhead instead of [code]`cc -dynamiclib` like Apple’s designs are sacrosanct or even necessary.
Maybe then we could also freely build and run other compilers, like tcc. I like that one.