I love github and open source but when you have to install a library that isn’t in your os’s repository, oh boy.

In my current project, I need freetype. It compiles with make and make install. Now it’s in my usr/lib/freetype2 and usr/include/freetype2 directory. The only problem is that the source files expect it to be in usr/lib and usr/include. The only fix is to manually change every include until it matches. You can get creative with find and replace but there is no 1 command fix and no matter what it’s always a lot of work and consumes a lot of time.

While I could sit down and actually do that, I’m just going to have to do the same thing every time I want to compile it on a different distro or on a different system. I’d rather put the files in my source directory so it’ll just compile every time so I only have to do this once.

I’m reasonably sure this isn’t what you’re supposed to do but I’ve shoehorned the last several libraries I needed into my project this way. A shitty hack that I only have to do once is better than a shitty hack I have to do a lot of times.

Is there a better way? It would have been so much easier to make everything have a top level h file but they split it into a lib and src directory which makes everything a huge pain in the ass when it doesn’t work.

    • @PenisDuckCuck9001@lemmynsfw.comOP
      link
      fedilink
      1
      edit-2
      2 months ago

      That worked but now I get a bunch of undefined reference errors. I tried adding the path of the libfreetype.a file to the makefile a few different ways but it’s not changing anything. The line I tried adding everywhere was “-L/usr/lib/libfreetype.a”.

      Edit: actually “-lfreetype” made it work.

      • @PhilipTheBucket@ponder.cat
        link
        fedilink
        English
        12 months ago

        That sounds perfect. Installing the system -devel package and -lfreetype is the right way to do it. Glad you got it working!