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.

  • @[email protected]
    link
    fedilink
    English
    22 months ago

    I definitely wouldn’t recommend changing every include.

    Can you configure freetype to go straight into /usr/local/lib and /usr/local/include instead, with no freetype/? That would be how I would attack it. Most libraries are going to have a way to configure them to go where you want them to go. GNU Stow can be very useful here to keep things organized.

    What distro are you using that doesn’t have freetype available? That seems strange.

    • @[email protected]
      link
      fedilink
      32 months ago

      Can you configure freetype to go straight into /usr/local/lib and /usr/local/include instead, with no freetype/

      Or create a symlink?

      • @[email protected]
        link
        fedilink
        English
        32 months ago

        That is what GNU Stow does, with a lot of package-management-like helper commands which make it all organized and convenient.

      • @PenisDuckCuck9001OP
        link
        2
        edit-2
        2 months ago

        Actually that worked for this one. Thanks.

        Edit: never mind. I don’t know why it wasn’t giving me errors as first but it started not compiling again. False alarm.

    • @PenisDuckCuck9001OP
      link
      1
      edit-2
      2 months ago

      Void. It’s like arch except that in exchange for stuff breaking less often, it’s just compatible with a lot less stuff. There is no way to get virtual box running at all and the repository is really lackluster. Frankly it’s not a worthwhile tradeoff.

        • @PenisDuckCuck9001OP
          link
          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.

          • @[email protected]
            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!