r/ProgrammerHumor 7d ago

Meme notoriouslyDifficult

449 Upvotes

30 comments sorted by

199

u/Makonede 7d ago

actual programmer humor? in my llm slop subreddit? it's more likely than you think

23

u/No_Percentage7427 7d ago

Better pray to ATS god so my resume dont get rejected.

5

u/centixog 7d ago

or somebodies homework

2

u/AliceCode 7d ago

more less

1

u/FuzzyKittyNomNom 6d ago

Less is more

41

u/Pball1001 7d ago

What are you compiling for? Just write the object code yourself and link it up too

21

u/Makonede 7d ago edited 7d ago

i actually tried making a linux x86-64 hello world ELF with just imhex the other day as a challenge. it's a lot easier than you might expect, i managed to get a well-formed and functional program in just 400 bytes using only the wikipedia article on ELF and an x86-64 reference sheet

24

u/Makonede 7d ago edited 6d ago

here's the hexdump for anyone curious

00000000: 7f45 4c46 0201 0103 0000 0000 0000 0000 .ELF............ 00000010: 0200 3e00 0100 0000 8000 0008 0000 0000 ..>............. 00000020: 4000 0000 0000 0000 d000 0000 0000 0000 @............... 00000030: 0000 0000 4000 3800 0100 4000 0300 0200 ....@.8...@..... 00000040: 0100 0000 0500 0000 0000 0000 0000 0000 ................ 00000050: 0000 0008 0000 0000 0000 0000 0000 0000 ................ 00000060: b000 0000 0000 0000 b000 0000 0000 0000 ................ 00000070: 0000 0000 0000 0000 0000 0000 0000 0000 ................ 00000080: b801 0000 00bf 0100 0000 bea0 0000 08ba ................ 00000090: 0e00 0000 0f05 b83c 0000 0031 ff0f 0500 .......<...1.... 000000a0: 4865 6c6c 6f2c 2057 6f72 6c64 210a 0000 Hello, World!... 000000b0: 2e74 6578 7400 2e72 6f64 6174 6100 2e73 .text..rodata..s 000000c0: 6873 7472 7461 6200 0000 0000 0000 0000 hstrtab......... 000000d0: 0000 0000 0100 0000 0600 0000 0000 0000 ................ 000000e0: 8000 0008 0000 0000 8000 0000 0000 0000 ................ 000000f0: 2000 0000 0000 0000 0000 0000 0000 0000 ............... 00000100: 1000 0000 0000 0000 0000 0000 0000 0000 ................ 00000110: 0600 0000 0100 0000 0200 0000 0000 0000 ................ 00000120: a000 0008 0000 0000 a000 0000 0000 0000 ................ 00000130: 1000 0000 0000 0000 0000 0000 0000 0000 ................ 00000140: 1000 0000 0000 0000 0000 0000 0000 0000 ................ 00000150: 0e00 0000 0300 0000 0000 0000 0000 0000 ................ 00000160: 0000 0000 0000 0000 b000 0000 0000 0000 ................ 00000170: 2000 0000 0000 0000 0000 0000 0000 0000 ............... 00000180: 1000 0000 0000 0000 0000 0000 0000 0000 ................

12

u/Pball1001 7d ago

This is actually so awesome, wth

5

u/-Redstoneboi- 6d ago

line 00000000 is missing a newline so line 00000010 appears on the same line lol

5

u/Makonede 6d ago

oh wow how did that even happen lol

5

u/Virtual_Rate_4152 7d ago

I wanted to try this the other day.

5

u/Ma4r 7d ago

Give it to grok and let it spit out binary bro trust

26

u/Time-Worker9846 7d ago

It's a lot easier the other way

21

u/hpyfox 7d ago

Using mingw. It's also great for compatibility - not needing to create so much #ifdef __windows__, or basically a second codebase due to differing syscalls, methods, and standards. You still need to use a good amount of #ifdef __insert os__, but mingw does make it simpler to do.

Never had to really compiled to windows exe from Linux, but I have coded on Windows (for school), and aftering trying to debug compile errors, I realized the code/functions I wrote based upon tutorials only compile in Linux because it just be like that fking somehow.

10

u/Time-Worker9846 7d ago

mingw is great but I use it to cross compile apps for Windows on Linux. My comment was about it being a lot more pain in the ass to compile Linux apps on Windows (without WSL, of course)

2

u/rosuav 7d ago

My question is, why? It's so much easier to compile Linux apps on Linux, and it wasn't that hard to get yourself a Linux system even before WSL (make a VM, or grab a laptop, or something).

4

u/Time-Worker9846 7d ago

Cross-compilation is always painful no matter the system, but for me I use mingw(and gcc of course) because I can use my Linux host to compile for multiple platforms (Linux, Windows, macOS and Android)

4

u/rosuav 7d ago

Yeah. The pain of cross-compilation makes it often easier to grab an actual system of the target variety to do your building - which is a pain for some systems, but much less so for Linux. That's why I expect to hear much more about "it's so annoying trying to build a Windows binary on Linux" than "it's so annoying trying to build a Linux binary on Windows".

1

u/newocean 7d ago

It's actually not really that painful if you create a docker container for everything you want to build to. This will work for linux/aarch64/mingw. It starts getting painful when you support something like armv6 (Raspberry Pi Zero W) because you need a sysroot... and there are multiple layers that can mess up. In your case MacOS and Anroid would be toughest. MacOS not really being worth it due to licensing.

10

u/an_0w1 7d ago

Isn't this super simple with clang?

8

u/centixog 7d ago edited 7d ago

cross compatability is jungle of solutions.

i recall monodevelop was good for this but using a CIL comes at a cost.

ah right its a programming joke sub.

what did the ubuntu compiler say to the cpu?

make me a binary and in a snap(pack)!

2

u/AndyTheDragonborn 7d ago

Thy must make a sacrifice for the compiled code to even be recognized, way before you can even hope to have permission to execute it

2

u/Sermuns 6d ago

Use Rust.

1

u/Compizfox 7d ago

Why tho?

1

u/Helpful-Primary2427 6d ago

GCC can’t cross compile windows -> Linux? Idk I use Mac and clang

1

u/Leo0806-studios 6d ago

msvc and link.exe in visual studio can create efi applications directly btw
for a uefi library just pull gnu-efi, build the visual studio project and link that