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.

  • lurch (he/him)@sh.itjust.works
    link
    fedilink
    arrow-up
    8
    ·
    2 months ago

    i don’t. i install the dev package of my distro and didn’t run into a case where it’s not available yet. also, i make fake packages for my project with only dependencies, to install those things, so i can uninstall that fake package when i don’t need the project any more and don’t have to keep track what dev deps on my system are still required

    • PhilipTheBucket@ponder.cat
      link
      fedilink
      English
      arrow-up
      4
      ·
      2 months ago

      i don’t. i install the dev package of my distro

      I think you cracked the code. I was really curious what distribution this person was using that didn’t have freetype, but missing installing the -dev package makes perfect sense and I definitely remember doing that and tearing my hair out trying to figure out why I couldn’t compile some thing that needed dev headers.

      OP, install libfreetype-dev or its equivalent on your system. 90% chance that fixes it.

  • PhilipTheBucket@ponder.cat
    link
    fedilink
    English
    arrow-up
    2
    ·
    2 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.

    • hedgehog@ttrpg.network
      link
      fedilink
      arrow-up
      3
      ·
      2 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?

      • PhilipTheBucket@ponder.cat
        link
        fedilink
        English
        arrow-up
        3
        ·
        2 months ago

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

      • PenisDuckCuck9001@lemmynsfw.comOP
        link
        fedilink
        arrow-up
        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.

    • PenisDuckCuck9001@lemmynsfw.comOP
      link
      fedilink
      arrow-up
      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.

        • PenisDuckCuck9001@lemmynsfw.comOP
          link
          fedilink
          arrow-up
          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
            arrow-up
            1
            ·
            2 months ago

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