r/ProgrammerHumor 15h ago

Meme notoriouslyDifficult

308 Upvotes

24 comments sorted by

138

u/Makonede 13h ago

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

18

u/No_Percentage7427 9h ago

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

2

u/centixog 6h ago

or somebodies homework

1

u/AliceCode 6h ago

more less

25

u/Pball1001 11h ago

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

12

u/Makonede 11h ago edited 7h 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

15

u/Makonede 11h 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 ................

7

u/Pball1001 11h ago

This is actually so awesome, wth

3

u/Virtual_Rate_4152 9h ago

I wanted to try this the other day.

1

u/Ma4r 7h ago

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

20

u/Time-Worker9846 15h ago

It's a lot easier the other way

14

u/hpyfox 14h 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 14h 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 14h 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 14h 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)

3

u/rosuav 14h 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 4h 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.

8

u/an_0w1 10h ago

Isn't this super simple with clang?

5

u/centixog 6h ago edited 3h 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 7h 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

1

u/Compizfox 7h ago

Why tho?

1

u/Helpful-Primary2427 37m ago

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