#libc
Explore tagged Tumblr posts
Text
for my linux friends: how do you pronounce “musl” (like the non-gnu libc) (regardless of how they say you’re supposed to pronounce it)
rbs appreciated for a big sample size :)
4 notes
·
View notes
Text
> g-glitchin,,,,, yezzzsszz, a little seems well w-within mission param-param—guidelines.
> th-th-thank you for leaving me with libc higher than 2.36
1K notes
·
View notes
Text
Linux Distro ideas, again
1. Programs are stored in /apps. The format is /apps/(package)/(version)/(bin, lib, etc).
1a. This eliminates the need for /opt/gnu, as any needed-for-one-package gnu tools can be referenced by their location in /apps instead
1b. This also makes it much easier to write a package manager that can deal with programs, as instead of spending tons of time trying to devise a method to remove installed stuff from that location, you instead just remove the version specified by an option (or the real path of latest).
1c. Speaking of latest, /apps/(program)/latest is a symlink to the latest version of the package, probably can change to the most recently installed, I don't know.
0 notes
Note
Any recommendations/cautions about using Alpine Linux on the desktop? It's always intrigued me and you're the only person I've seen post about it
Alpine is pretty good for desktop, very stable, good security practice, professional development philosophy, broad package availability. You will run into some very obvious pitfalls, although they can mostly be obviated by using some modern applications.
The Alpine wiki is a little sparse and at times can be weirdly focussed, like spending a lot of the installation page talking about the very specific usecase of a diskless install. Nonetheless, it's quite good and should be your first port of call. A lot of the things I'm mentioning here are well covered in the article on Daily Driving for Desktop use. I'm basically just editorializing here.
The installation procedure is command-line only, but pretty straightforward, you run setup-alpine and follow the prompts, assuming you want a basic system. If you need special disk partitioning, you'll usually have to do it yourself. There's a whole whackload of helpers to get you set up, like setup-desktop which will help you install any of 'gnome', 'plasma', 'xfce', 'mate', 'sway', or 'lxqt'. Most of these are called by setup-alpine for you, but not the desktop one. You can call it at any time though.
Most obviously, musl libc, no glibc. Packaged software will work fine. There's a compatibility shim called gcompat that will usually work, but might fall apart on more complicated software expecting glibc, for example I've had no luck running glibc AppImages. For more complex software, Flatpaks are a good option, e.g. Steam runs great on Alpine as a Flatpak, I run the Homestuck Companion Flatpak. Your last ditch is containerization and chroots, which are fortunately really easy to handle, just install podman and Distrobox and you can run anything that won't run on Alpine inside a Fedora or Debian or Whatever container seamlessly with your desktop.
Less obviously: no systemd. Systemd underpins some really common features of modern Linux and not having it around means you have to use a few different tools that are anywhere from comparable to a little worse for some tasks. Packaged applications will work smoothly, just learn the OpenRC invocations, Alpine has a really great wiki. For writing your own services, it's a lot more limited than SystemD, you're not going to have full access to like, udev functionality, instead you get the good but kind of weird eudev system.
If you're mainly installing things from the repos you'll barely notice the difference, other than that every package is split up into three, <package>, <package>-docs, and <package>-dev. This is a container-y thing, to allow Alpine container images to install the smallest possible packageset. If you need man pages you'll have to install them specifically.
Alpine has a very solid main repo, and a community repo that's plenty good, and worth enabling on any desktop system. It'll generally be automatically enabled when you set up a desktop anyway, but just a notice if you're going manual. You can run Stable alpine, which updates every six months, or if you want you can run Edge, which is a rolling release of packages as they get added. Lots of very up-to-date software, and pretty stable as these go. You can go from Stable->Edge pretty easily, going back not so much.
There's also the Testing repo, only available on Edge, which I don't really recommend, especially since apkbuild files are so easy to run if you just need one thing that has most of its dependencies met.
Package management is with APK, which is fast and easy to work with. The wiki page will cover you.
Side note: if you want something more batteries-included, you could look at Postmarket, an Alpine derivative mainly focussed on running on smartphones but that is a pretty capable desktop OS, and which has a fairly friendly setup process. I run this on an ARM Chromebook and it's solid. Installation requires some reading between the lines because it's intended for the weird world of phones, so you'll probably want to follow the PMBootstrap route.
8 notes
·
View notes
Note
Heyy Vera, well im curious for 16, 17 and 24 bc im greedy 🙂↕️ (yay to ficwip questions about your fics 🫂)
Heyy Sophia, thank you for asking🩵
16. What's your favorite title of the year?
I actually really liked "i tried to be good (am i no good?)" which comes from Strangers by Ethel Cain. This was for my vampire Alicent fic and I think it really worked to convey her doubts and religious guilt and her need to be good.
17. Share your favorite opening line
I really like the opening few lines of the above mentioned vampire fic:
"Her stomach twists painfully. She looks spitefully, mournfully at the remnants of the food on the plate. She keeps stuffing it down her throat in the hopes that it will bring satisfaction, but she knows it never will."
24. Did you do anything special to celebrate finishing a fic?
I didn't actually lol. Though I did feel very proud when I finished libc :)
#ask game#my asks#alicent hightower#hotd#my fics#i had a hard time picking a favourite opening line because usually my favourite lines aren't immediately at the start of my works rip#i like this one from the vampire fic though i did cheat and put the first three lines hehe#writing
8 notes
·
View notes
Text
Guys I think unsafe {} loves me back! 🥰
Almost kinda refreshing to get a segfault of baffling origin in Rust
50 notes
·
View notes
Text
this whole time I've been struggling making a decent argument parser and I didn't even realize that "argp" existed, and it was already included in gnu libc lmao
4 notes
·
View notes
Text
Trying to get raylib setup with Odin on an android app. First time messing with android. The recordings so far..
Invalid build type
Invalid build type
Linker error
Linker error
Missing symbol
Linker error
Linker error
Missing symbol
Start building raylib from src
Linker error
Linker error
Folder does not exist
Missing symbol
Fixed
Time to build android again
Cannot have two android_main
Change cmake
Rebuild
Linker error
Library not found
Library not found
Put the library in every single folder
Missing symbol sinf
Mother fucker!
Include -lm?
Yay happy.
Raylib initializing
Segfault libc
Oh FOR FUCKS SAKE! How am i supposed to figure this one out?!
2 notes
·
View notes
Note
forgive me for the questions & any possible inconsistencies or malformations:
how do we compile our symbolic high/low level code into machine language, and how do we find the most efficient method of conversion from symbolic to machine code?
is it possible to include things from asm in C source code?
why do any of the abstractions in C mean anything? how does the compiler translate them?
would it be possible to write and compile a libc in C on a machine which didn't have a precompiled libc? i think the answer is no, so how much peripheral stuff would you need to pull it off?
are these things i could have figured out by just reading the one compiler book with the dragon on the cover?
thanks and apologies.
these are uhh. these are really good questions. like if you're asking these then i think you know way more than you think you do
how do we compile our symbolic high/low level code into machine language?
we do it the natural (only?) way, using parsers, although a bit more technically involved than just a parser. all programming languages are comprised of just keywords (e.g. int, static, enum, if, etc) and operators(+, -, *, %), those are the only reserved terms. everything between them is an identifier (name of variable, struct, etc), so at some level we can just search for the reserved terms and match them, and match whatever is between them as identifiers (var names or whatever). with this, we can tokenize the raw input put it in the context of a defined grammar.
lex is the name of the program that does this. you have simple, defined keywords, and defined operators, and you group them together a few categories (e.g. int, float, long might all fall under the same "variable qualifier" category"). this is tokenization.
those tokens are given to another program, yacc, which deals with it in the context of some context-free defined grammar you've also provided it. this would be a very strict and unambiguous definition of what C code is, defining things like "qualifiers like int and float always proceed an identifier, the addition (+) operator needs two operands, but the ++ (increment by 1) operator only needs one". yacc processes these tokens in the context of the defined grammar, and since those tokens are defined in broad categories, you can start to converge on a method of generating machine code for them.
how do we find the most efficient method of conversion from symbolic to machine code?
ehehehe. ill save this one for later
is it possible to include things from asm in C source code?
yes:
assembly (which translates directly 1-to-1 to machine code) is the only thing a CPU understands, so there has to be a link between the lowest level programming language and assembly at some point. it works about as you'd expect. that asm() block just gets plopped into the ELF right as it appears in the code. there are some features that allow passing C variables in/out of asm() blocks.
why do any of the abstractions in C mean anything? how does the compiler translate them?
hoping above answers this
would it be possible to write and compile a libc in C on a machine which didn't have a precompiled libc? i think the answer is no, so how much peripheral stuff would you need to pull it off?
yes, and in fact, the litmus test that divides "goofy idea some excited kid thought up and posted all over hacker news" and "real programming language" is whether or not that language is bootstrapped, which is whether or not its compiler is written in "itself". e.g. gcc & clang are both C compilers, and they are written in C. bootstrapping is the process of doing this initially. kind of a chicken-and-egg problem, but you just use external things, other languages, or if it is 1970s, direct assembly itself, to create an initial compiler for that language, and the write a compiler for that language in that language, feed it to the intermediate compiler, and bam.
its really hard to do all of this. really hard. lol
are these things i could have figured out by just reading the one compiler book with the dragon on the cover?
idk which one that is
finally...
how do we find the most efficient method of conversion from symbolic to machine code?
so this is kind of an area of debate lol. starting from the bottom, there are some very simple lines of code that directly map to machine code, e.g
a = b + c;
this would just translate to e.g. sparc
add %L1,%L2,%L3 !
if statements would map to branch instructions, etc, etc. pretty straightforward. but there are higher-order optimizations that modern compilers will do, for example, the compiler might see that you write to a variable but never read from it again, and realize since that memory is never read again, you may as well not even bother writing it in the first place, since it won't matter. and then choose to just not include the now-deemed-unnecessary instructions that store whatever values to memory even though you explicitly wrote it in the source code. some of the times this is fine and yields slightly faster code, but other times it results in the buffer you used for your RSA private key not being bzero'd out and me reading it while wearing a balaclava.
34 notes
·
View notes
Text
Nothing encapsulates my misgivings with Docker as much as this recent story. I wanted to deploy a PyGame-CE game as a static executable, and that means compiling CPython and PyGame statically, and then linking the two together. To compile PyGame statically, I need to statically link it to SDL2, but because of SDL2 special features, the SDL2 code can be replaced with a different version at runtime.
I tried, and failed, to do this. I could compile a certain version of CPython, but some of the dependencies of the latest CPython gave me trouble. I could compile PyGame with a simple makefile, but it was more difficult with meson.
Instead of doing this by hand, I started to write a Dockerfile. It's just too easy to get this wrong otherwise, or at least not get it right in a reproducible fashion. Although everything I was doing was just statically compiled, and it should all have worked with a shell script, it didn't work with a shell script in practice, because cmake, meson, and autotools all leak bits and pieces of my host system into the final product. Some things, like libGL, should never be linked into or distributed with my executable.
I also thought that, if I was already working with static compilation, I could just link PyGame-CE against cosmopolitan libc, and have the SDL2 pieces replaced with a dynamically linked libSDL2 for the target platform.
I ran into some trouble. I asked for help online.
The first answer I got was "You should just use PyInstaller for deployment"
The second answer was "You should use Docker for application deployment. Just start with
FROM python:3.11
and go from there"
The others agreed. I couldn't get through to them.
It's the perfect example of Docker users seeing Docker as the solution for everything, even when I was already using Docker (actually Podman).
I think in the long run, Docker has already caused, and will continue to cause, these problems:
Over-reliance on containerisation is slowly making build processes, dependencies, and deployment more brittle than necessary, because it still works in Docker
Over-reliance on containerisation is making the actual build process outside of a container or even in a container based on a different image more painful, as well as multi-stage build processes when dependencies want to be built in their own containers
Container specifications usually don't even take advantage of a known static build environment, for example by hard-coding a makefile, negating the savings in complexity
5 notes
·
View notes
Text
Ok, this is a niche thing to complain about, but it insane to me that the situation with strict aliasing rules in C and C++ has such a monumental mismatch between the standard and what people actually want and need to do:
For a long time, there was no standard-compliant way to alias a piece of memory using two different types.[1] I mean, people did it anyway, but whether you got fucked over by the optimizer was dependent on how you did it, which things were in which translation unit (or I suppose whether someone did LTO), which compiler you used, which compiler-specific attributes or flags you used, and/or luck.
memcpy has (always?) been blessed as a way to bit-cast between types, but, as the name implies, it copies data--there's no way to just ask for a single memory location with two different views onto it, although the compiler may or may not be smart enough to avoid actually copying stuff.
It was only in C11--published in 2011!--, that the popular method of union-based type-punning was finally added to explicitly clarified to be in the standard. This is often good enough for what you want to do, but it's not enough--you can't write a standard-compliant implementation of malloc in C11 (or C17), as far as I can tell![2]
The union trick is not kosher in C++, but they added bit_cast (which is basically type-safe memcpy) in C++20, and they're adding start_lifetime_as in C++23, which I think actually makes it possible to write a standard-compliant malloc? Or do the type-punning you wanted to do to fucking begin with?
There aren't that many super great reasons to start a new project today in C or C++. But if you're writing an operating system or a language runtime or doing embedded programming or whatever, there weren't really any good alternatives for a long time. But these are exactly the situations where you want to alias the same memory via different types! I feel like I am taking crazy pills!
tl;dr -- regular C programmers talking with the people who write the language standard and the optimizers in compilers:
[1]: Someone is going to bring up the thing about char*. You are allowed to alias anything as a char*. This is sufficient if all you want to do is print out the underlying representation or twiddle the bits one at a time, but it's only one way! You can't start with a char* and then alias it as something else. This doesn't get you what you want with type-punning, and it's definitely not enough to make malloc work.
[2]: Yes, really. I think you could make some very trivial malloc implementations (no-op free or just delegating every malloc/free to a system call and never recycling memory) in a standard-compliant way, but otherwise no. I don't see anything C23 that's relevant to the situation. It ironically might be possible to write a standard-compliant malloc in C++ using the new C++23 features though, and I think someone is trying to do this in llvm's in-progress libc.
7 notes
·
View notes
Note
Most satisfying code deletion you've ever done?
i WISH i could say the answer to this was "the fucking page table walker i wrote in bash," except, that fucking monstrosity lives on, and as of somewhat-recently provided an annoyingly-vital function to [stuff], so
(but someone THREATENED to delete it a couple years ago and i was like yes yes PLEASE throw it over the cliff's edge it's SO bad i hate it SO much)
the *funniest* code i've deleted was when an intern accidentally checked the entirety of numpy into a small OSS company's repository and i got to, y'know, undo that fucking action. that intern dominated the addition stats on github for years because, y'know, even ten engineers working full-time is pretty paltry compared to the entirety of numpy
best is probably when i deleted some piece-of-shit memory default memory allocator from a sketchy libc variant for my own far-better memory allocator tho. (we were developing a new OS, it was very greenfield and hipster, etc) i wouldn't say i exactly fought wars for my new allocator—it was mostly a port, all the data supported that my port was better than default, etc—but, man! feels cool to be like Every Block Of Memory Allocated From Here On Out Is Mine (Except For When Graphics People Write Their Own Fancy Custom Allocators But I Ain't Got No Control Over Their Nonsense)
9 notes
·
View notes
Text
@mourning-again-in-america: #you should make sure to try out different libc based distros! musl is almost ready for *gunshots ring out*
i found a transfem who sells a service where you send her your thinkpad and she changes out the bios to libreboot
Instead of using butter for your grilled cheese, you should switch to linux. You can set up a virtual machine to try out various distros to see which ones work best for your needs
23K notes
·
View notes
Text
wqhy my code no compile?
```ifndef stdinclude
define stdinclude iopdfsjopidfspiofjdspiojfds
/stdinclude/
include
include
endif
ifdef DEBUG
define debug printf("your are here %i of %s\ni",line,file)
endif
include
ifndef DEBUG
define debug /do something arbitrary/ int lesbian=0
endif
ifndef random
define random dfklsjladfsjldfslkdfsadfdsklj
/code here/ char* seed(void* gay,void* davoid){int bi=0;while(gay[bi]&&davoid[bi]){ gay[bi]=<<davoid[bi];bi++;};bi=0;/dont do this/while(gay[bi]&&davoid[bi]){davoid[bi]=(char)gay[bi];bi++;};return gay;}; char Random(char* gay,char* trans){char* queer=seed(gay,trans); if (queer[gay[trans[0]]]){return queer[gay[trans[0]]];}; else{return qeueer[random[0]];};}
endif
ifdef random
define unrandom kjadfklskldfsakldfs
char* random(void){return unrandom;}
undef random
endif
int main(int argc;char** argv){ FILE* dykefile=fopen("keysmash","w"0); if(!argv[1]){printf("give me /arguements dumbass/\n";);return argc;} if(!fopen(argv[1],"w")){printf("error opening file: /argv[1]/\n";return argc);} FILE* fagfile=fopen(argv[1],"r");char dyke;char fag;time_t Time; while(!feof(fagfile)){/ignore all that shit and just use libc/ time(Time); srand(Time); dyke=fgetc(fagfile);fag=dyke|rand();fputc(fag,dykefile); } return 666;}
```
#geekblr#c programming#programming humor#programming horror#i swear to god tumblr#markdown hell#JUST LET ME SECAPE MY FUCKING CODE!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
1 note
·
View note
Note
Have you made any more progress on the esp32+sk6812 project? I've got like 90W of wwa strip and a girl who doesn't like overhead lighting coming over next weekend
it's currently in a state where if all you want is to update a single pattern over the network and drive it out to the string, you can do that, and it should work for WWA out of the box since I believe that protocol is identical to RGB.
WiFi is easy to configure, it's in the menuconfig system so you don't have to dig around. Driving GPIO still isn't in menuconfig but it's 15 by default and easy enough to change.
Might need some patching, but the underlying driver library supports RGB, RGBW, and WWA so it should be easy and I'd be up to help you out with that specifically in pretty short order. If you already have an ESP-IDF build environment it should Just Build.
I haven't touched it in a while but basically right now you can either use the web editor or a POST request to push a script up, and you can tell it to run at a specific frame rate. If it can't meet that frame rate it'll fairly gracefully decrease the framerate, and you have access to most of standard Lua because esp-idf implements most of libc. For simple patterns you can probably get in excess of 100 000 updates per second, if you're doing any significant trigonometry I think you're probably limited to ~10 000 updates per second. Divide that by number of LED's to get frame rate maximums.
The things I'd like to do are better support for Lua libraries, some helpers for modular arithmetic and time-of-day/year scheduled operations, a few pattern slots and the ability to switch between pattern slots from scripts or an external API, and a system for registering requests to external HTTP API's that runs on a separate CPU at regular intervals so you can do that without having to mangle your main loop.
5 notes
·
View notes
Note
hey vera <3 answer me 9, 18, 19 or face the consequences 🔪
bonus question: 23 because i know you love yapping and i love your yapping yay
Hey Mariane, put the knife down your name isn't Alicent🩵 (thanks for asking<3)
Warning: spoilers for Fire & Blood and future seasons of HOTD below!
9. What fic made you feel the happiest to work on?
Different ones for different reasons but I will say "i have lived now longer than she did" - the alternate happier ending for libc. This fic made me feel the happiest, because for once the content in there wasn't just tragic. Instead there was a focus on healing, which was extremely nice to focus on after all the pain. Moreover finishing this alternate ending also meant I finished my longest piece of writing and I felt very proud and happy to finish it.
18. Share your favorite ending line
I will choose the ending section of the alternate happy ending mentioned above. I love the way it ties into the theme of historical bias from the show and contrasting that against the truth of the cosmos. The love that Rhaenicent has for each other being so strong that they escaped the narrative and their predetermined deaths in the book.

19. Share your favorite piece of dialogue
I couldn't choose just one piece so you get two pieces, both come from libc. The first one from chapter 3, which I chose because I like these reflections on death and the reference to Lake Mungo:

And this section from chapter 7, because I love Alicent and Aegon's relationship and this is a scene that I planned at the start of writing this fic. So much hinges on it and it is the climax of both of their stories. I look forward to seeing what they do in the show. For now my favourite piece:

23. If you had to choose one, what was THE most satisfying writing moment of your year?
Writing the final section of chapter 5 from libc. It was extremely cathartic for me to write the grieving process through various flashbacks, abstract observations and vivid imaginations of what might have happened. Through all of this I wanted to capture the love Alicent had for Helaena and it really felt like a love letter to their mother-daughter dynamic. So finishing that and seeing my vision come to life for it was the most satisfying writing moment.
#ask game#my asks#alicent hightower#rhaenicent#hotd#hotd spoilers#f&b spoilers#i yapped a lot but i got permission so it's okay <3#writing
6 notes
·
View notes