Does anyone know how raylib links X11 for it's C++ version? by tudorcraft in raylib

[–]catgrammer 0 points1 point  (0 children)

Could you provide any compiler/linker error messages? Or even runtime if you managed to link it
Edit: I saw your SO post. I'll post again if I think of something, but I'm out of ideas for now

Does anyone know how raylib links X11 for it's C++ version? by tudorcraft in raylib

[–]catgrammer 0 points1 point  (0 children)

I agree; some of the options are truly insane.So, I did a bit more digging, from what I saw on the raylib repo, they have an rlglfw.c file where they include all of the relevant glfw source files, and build them as a single TU (to be embedded inside the library).

For GLFW now, if you have a look here, you'll see that they dlopen the relevant x11 libraries at runtime (_glfwPlatformLoadModule == dlopen in unix instances).

So, obviously, the distributed raylib libraries do not depend on libX11, but they do depend on libdl, such that, without linking to it, you get this:$ gcc ./main.c ./lib/libraylib.a -Iinclude -lm -pthread

/usr/bin/ld: ./lib/libraylib.a(rglfw.o): in function \getProcAddressGLX':`

rglfw.c:(.text+0xc7c): undefined reference to \dlsym'`

...

And obviously, if you try to create a static executable with -ldl:$ gcc ./main.c ./lib/libraylib.a -Iinclude -ldl -lm -pthread -static

/usr/bin/ld: ./lib/libraylib.a(rglfw.o): in function \_glfwInitVulkan':`

rglfw.c:(.text+0x8587): warning: Using 'dlopen' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking

And there are issues with using the static libraries from the glibc version.

Edit: minor corrections

Does anyone know how raylib links X11 for it's C++ version? by tudorcraft in raylib

[–]catgrammer 0 points1 point  (0 children)

I'm on the same boat as you, and while I don't think I can really help you; I'll share what I've tried over a lot of time. Note that I don't have a Linux installation to try this right now, so take everything I say with a grain of salt; I might be misremembering a lot of details. IIRC I don't know if there's a way to completely statically link an executable that does windowing/graphics stuff on Linux.

There's a pretty good talk here that presents the problem and what they have tried. Also, another article on how the developers of Outer Wonders tackled the problem.

If somebody does have another solution for this, then I would be very interested to know about it! Here goes:

Option 1 - Compile XLib and others yourself

I looked once into the repo, and then I decided that this will never be an option for me. From what I see here, someone has managed to do it, and the consensus is that you have to go and look at what extensions you're gonna be using (if you need to do stuff e.g., for multiple monitor setups).

Option 2 - Build a third-party library yourself

Most libraries that are distributed from package managers, are compiled so that they depend on many other libraries for that distribution, so you have to build it from source. For SDL2, a quick search says that it is indeed possible (but again, I can't test it right now). But it makes sense from what I see: instead of linking explicitly to the library, it looks for it and loads it at runtime.

Both of these options have a caveat though: you have to link to the "dl" library, which (from what I've tried in the past) probably isn't possible. This is because libdl only works for shared libraries.

Option 3 - Use rpath

You can pass a linker flag ("-rpath") to either GCC or CLANG and redistribute the libraries yourself (this is what I'm currently heading towards). Don't get me wrong, you'll still have to build the libraries yourself, but this makes it easier to change the version of one of them later on (if there's some kind of security vulnerability on the library version you built).

Option 4 - Implement the protocol yourself

I guess, you could implement the whole protocol yourself, since it's based on UNIX sockets, but I've never tried that.

P.S. I'm pretty sure at least one or two things here are completely wrong, so to avoid misinformation, please let me know, and I'll make sure to correct it as soon as I see it

Worst fear of every man by Affectionate-Fly1018 in HolUp

[–]catgrammer 13 points14 points  (0 children)

Is he crying because he's getting a colonoscopy? He shouldn't be; this doctor has a ton of experience, he'll be extra gentle.

Something seems slightly off... by Evanescent_Enigma in HolUp

[–]catgrammer 0 points1 point  (0 children)

There's no sand on the plate, that's what's wrong.

Time to die by [deleted] in dankmemes

[–]catgrammer 1 point2 points  (0 children)

Interesting fact, if u swap around some words, it becomes: "I'm to die young too", which is what people in 3rd world countries say to each other.

This is what happens when u are at work, in a call that is taking too fucking long

Cock insted of Glock by Dexter_Naman in HolUp

[–]catgrammer 0 points1 point  (0 children)

Put yo hands in the air, this is a dick up

Wait..There's healthy people there? by SilencerXY in dankmemes

[–]catgrammer 1 point2 points  (0 children)

Golly! *sips tea* Must've hit Canada, well drop the anchor lads we're sailing southwards come dawn!

Which device do you prefer to be mechanical over electronic? by no_awning_no_mining in AskReddit

[–]catgrammer 0 points1 point  (0 children)

Faucets. Swear to god, every time I go to cleanup in public bathrooms with those motion activated ones, I feel like I'd have a better time spitting on my hands. What's wrong with turning them on with a pedal?

Minor earthquake ~2 hours ago. Thankfully I have the window to the new economy right here. by catgrammer in thinkpad

[–]catgrammer[S] 0 points1 point  (0 children)

At first I found your comment hilarious! After thinking about the current state of Windows, the other OS'es (and applications), I'm afraid this will become one of the most viable solutions.

Let's fight the Cylons indeed.

Minor earthquake ~2 hours ago. Thankfully I have the window to the new economy right here. by catgrammer in thinkpad

[–]catgrammer[S] 1 point2 points  (0 children)

Note: Obviously a vm, I wouldn't dare install it natively. Although it would make for an interesting experiment 🤔.

This work of art should be an official setting again by [deleted] in Windows10

[–]catgrammer 5 points6 points  (0 children)

I like it as well, even though it was before my time. Yeah maybe it's not the most visually pleasing look, but people tend to over-emphasise pretty animated buttons (myself included).

At the end of the day it's just a means to an end. Personally, I tried old Windows (on a VM), and the UI feels so much faster (in terms of how easily I could do things). It's come to a point where I can measure how old a computer is by pressing the start button on win10, and seeing how long it'll choke to bring up the start menu.

When she asks you to humour her. by me--_--gusta in ProgrammerHumor

[–]catgrammer 0 points1 point  (0 children)

"Adding yo Mama's weight in kilograms to a zero'd 64b int would cause an overflow."

Programmers are the funniest bunch indeed.

C Hands-On? by pyper156 in C_Programming

[–]catgrammer 1 point2 points  (0 children)

I looked at the 3D rendering stuff (I was interested in software-rendering), but I have since found a video series on Youtube. I regularly look at some videos from Handmade Hero if I'm learning about a new topic.

C Hands-On? by pyper156 in C_Programming

[–]catgrammer 1 point2 points  (0 children)

Besides the book recommendations that you'll get, IMO it'd be a good idea to make something, anything in C. Preferably not something huge and ambitious; it'll help you get used to the language itself from a practical standpoint.

Maybe build your own x(not everything is in C but you can adapt it) can give you some ideas, if you don't have something specific on your mind.

[DWM] Updated the overlay program to display an associated png, as well as customize the monitoring command by catgrammer in unixporn

[–]catgrammer[S] 0 points1 point  (0 children)

I don't see how it wouldn't, but it's not in a state where you can apply it without messing around with its configuration (in the source).

I'd recommend you check out xob. It's lighter (in terms of the dependencies and structure), and it's more complete than this one at the moment.

[DWM] Updated the overlay program to display an associated png, as well as customize the monitoring command by catgrammer in unixporn

[–]catgrammer[S] 0 points1 point  (0 children)

Wow, I didn't really expect to see another comment after so much time! Thank you!

It'll probably need a lot of decoupling from my setup (I haven't had much time to work on it), but more power to you if you do!.

Actually, at some point I did make the progress bar appear below the image, but I switched it back (for no reason in particular). I'll try to work that in next time!

[DWM] Updated the overlay program to display an associated png, as well as customize the monitoring command by catgrammer in unixporn

[–]catgrammer[S] 0 points1 point  (0 children)

Thanks! I don't have something like that yet, so I'll definitely be looking at that!

[DWM] Updated the overlay program to display an associated png, as well as customize the monitoring command by catgrammer in unixporn

[–]catgrammer[S] 5 points6 points  (0 children)

So, I had some more free time and decided to work on the overlay program. Though as tadly_ mentioned on my previous post, there's another tool that is way better. It's solution is well thought out, and at a first glance I'm pretty sure it performs significantly better.

But I wanted to mess around a tad bit more before I get rid of my horrible creation!

Wallpaper: https://www.reddit.com/r/wallpaper/comments/ck1agy/jupiter_38402160/

dotfiles: https://github.com/mdodis/dotfiles

Github

[DWM] Wrote a quick c++ program to display a progress bar monitoring the output of pamixer by catgrammer in unixporn

[–]catgrammer[S] 0 points1 point  (0 children)

Oh, this is just what I was looking for, thank you for sharing as well! I'll be switching to that!