C/C++ build systems

all of this looks great, so what's wrong with it? what is the better option, if any?
and no, I don't want to use rust.

Thalidomide Vintage Ad Shirt $22.14

DMT Has Friends For Me Shirt $21.68

Thalidomide Vintage Ad Shirt $22.14

  1. 4 weeks ago
    Anonymous

    It's more complex than it needs to be in 80% of cases.
    You could just use Makefiles, maybe automake if you have a fairly complex system.
    CMake is like buying an industrial scale CNC machine because you wanted to make a pipe. Someone out there will want the industrial machine, but you probably don't need it.

    • 4 weeks ago
      Anonymous

      makefiles are so easy to use I don't understand why midwits complain, even if you have to support 3 different compilers, it's a matter of merely changing CFLAGS and few others, two relevant compilers work with same exact flags, while another one which is a remain of abortion can be accustomed to if you really need to support windows without cross compiling using mingw

      • 4 weeks ago
        Anonymous

        It's because they do have some strange syntax.
        Something like $(OBJ): %.o: %.c isn't totally clear until you get that % is just a glob match like *, and X: y: z means "in X, all patters that match y can be taken from patterns that match z"
        Trying to explain it simply now, I'm even having trouble. That's why people avoid makefiles.

        • 4 weeks ago
          Anonymous

          >strange syntax
          is a thing in every unknown language, not relevant
          If you want to talk about strange syntax, I created self contained
          >config.hpp.mk
          files before that can be included in a Makefile which contains entire template + target for it, here's an example:
          TEMPLATE_I := ${lastword ${MAKEFILE_LIST}}
          TEMPLATE_O := ${basename ${TEMPLATE_I}}

          define TEMPLATE_TEXT
          // DO NOT EDIT THIS FILE - IT WAS AUTOGENERATED BY ${shell make -v | head -n1} FROM ${TEMPLATE_I}

          #define VERSION "${shell git describe --tags --long --dirty --always 2>/dev/null}"
          endef

          ${TEMPLATE_O}: ${TEMPLATE_I} .git
          @echo "Template ${TEMPLATE_I}: ${TEMPLATE_O}"
          ${file > $@,${TEMPLATE_TEXT}}

          Using it is just a matter of:

          all: config.hpp .WAIT mybinary

          include config.hpp.mk

          Now that's magic, I guess, and very very strange to someone who doesn't know why I would do this at all, do I give a frick though?

          • 4 weeks ago
            Anonymous

            You asked why, I told you why.
            Makefiles are the best, they are fast and simple, most people will never need more, but those are the reasons people avoid them. They simply do not understand.

          • 4 weeks ago
            Anonymous

            being moronic is a very poor argument, but I guess it only makes sense in this brown world

          • 4 weeks ago
            Anonymous

            >why is this thing
            >here's why
            >FRICK YOU IDIOT
            I think you might be moronic.

          • 4 weeks ago
            Anonymous

            >>here's why
            once again
            >I'm moronic
            is not an argument

          • 4 weeks ago
            Anonymous

            I now know you are moronic.

      • 4 weeks ago
        Anonymous

        makefiles are awful for anything beyond a toy project.

        • 4 weeks ago
          Anonymous

          Try not to be too shocked when you see what IDEs do when you press the "build" button.

      • 4 weeks ago
        Anonymous

        The build language is as complex as the programming language.
        >and no, I don't want to use rust.
        picrel. Or maybe try zig, I've heard it can build C++

        Makefiles are enough. You literally cannot prove me wrong.

        Linking to libraries that could be in different places on different computers is painful with makefiles

        • 4 weeks ago
          Anonymous

          >Linking to libraries that could be in different places on different computers is painful with makefiles
          pkg-config

          • 4 weeks ago
            Anonymous

            Ok, so what happens if dependency isn't in the distro repos or doesn't give 2 shits about pkg-config?

          • 4 weeks ago
            Anonymous

            you add it as vendor library and make a custom solution to include it and build if needed.
            If they don't care about pkg-config the project likely won't fit into any other build system as is.

      • 4 weeks ago
        Anonymous

        it's always feels like voodoo making flags work when you're learning. I don't really know why I shouldn't just use gcc from terminal for most projects, but I haven't worked in a group before

    • 4 weeks ago
      Anonymous

      >CMake is like buying an industrial scale CNC machine because you wanted to make a pipe.
      As if `make` isn't the same thing with its dependence on POSIX utilities to do anything. Just install a whole OS userland to build my small program bro, what's the big deal?

      • 4 weeks ago
        Anonymous

        How do you built? Do you have a flash drive that boots into gcc? In fact, since most POSIX systems come with make(1), it takes MORE effort to not use make than to just type make.

        • 4 weeks ago
          Anonymous

          Not everyone wants to be vendor locked to an OS who's design hasn't changed since the 70s, and one criticized by its own authors later. Imposing this on yourself and your users is moronic when you don't have to.

          >install
          the idea is it's already installed, if not you're not the target audience

          If you're writing something strictly for yourself that's fine, but I think most people intend on other people to use software that they publish instead of just slapping a "works on my machine" sticker on it.
          It's embarrassing when you see people writing and distributing makefiles that hardly work across distros of the same lineage let alone other systems or versions. Defeats the whole point of publishing a project if you can't build and execute it, and removes the portability benefit C intended to solve in the first place.

          • 4 weeks ago
            Anonymous

            >vendor locked to an OS
            >PORTABLE OPERATING SYSTEM INTERFACE
            you microsoftgays needs to be culled

          • 4 weeks ago
            Anonymous

            This "Unix was a mistake" meme is pure cancer. As usual 95% of the morons using it can't quote any reasons beyond the ones they've learned by rote.

          • 4 weeks ago
            Anonymous

            What does Microsoft have to do with this at all besides being one of many other OS vendors.
            POSIX is a mess and the P in it should be revoked, clearly.

            This "Unix was a mistake" meme is pure cancer. As usual 95% of the morons using it can't quote any reasons beyond the ones they've learned by rote.

            Reminder Unix's own authors published the Plan 9 papers and more critiquing the problems with Unix's design. Unix is a great first iteration, but here we are half a century later and people are still pretending like we don't need to advance in the OS space.

      • 4 weeks ago
        Anonymous

        >install
        the idea is it's already installed, if not you're not the target audience

    • 4 weeks ago
      Anonymous

      Everyone else is using that same industrial CNC machine and if you use another machine your pipes will be very hard to use with anything else.
      This immediately becomes a problem when you try to build anything nontrivial.

      • 4 weeks ago
        Anonymous

        >everyone else
        Many C projects still just build with a makefile

        • 4 weeks ago
          Anonymous

          Yeah and they're a pain to use as submodules because of it

  2. 4 weeks ago
    Anonymous

    Makefiles are enough. You literally cannot prove me wrong.

    • 4 weeks ago
      Anonymous

      >nocoder

  3. 4 weeks ago
    Anonymous

    If its just you solo deving a project or all your devs use the same hardware/ os you are insane to not just use Make. Otherwise suffer through CMake.

  4. 4 weeks ago
    Anonymous

    Because microsoft of course had to steer the dev environment to their tools like Visual Studio which require their own snowflake configurations. But even then the right thing to do is to maintain both the virgin homosexual build system (windows) and the unbeatable chad simplicity (makefiles) beacuse the alternatives like CMAKE are just plain fricking cancer.

    tldr: simple makefiles or you are doing something (very) wrong

  5. 4 weeks ago
    Anonymous

    Makefiles are the answer. OP, you can delete this thread now.

  6. 4 weeks ago
    Anonymous

    makefile or BTFO

  7. 4 weeks ago
    Anonymous

    ``cat *.[ch] > compile.c && gcc compile.c```

    • 4 weeks ago
      Anonymous

      Black person you don't need to compile headers, they're included, unlike your father.

  8. 4 weeks ago
    Anonymous

    all of them will be replaced by python scripts

    • 4 weeks ago
      Anonymous

      which version though?

      • 4 weeks ago
        Anonymous

        2.7 actually. You don't need anything else.

        • 4 weeks ago
          Anonymous

          >2.7
          The version without security support?
          I bet you think wearing crotchless panties increases your anal security too.

          • 4 weeks ago
            Anonymous

            >being connected to a network on your dev box

      • 4 weeks ago
        Anonymous

        you have to be perfectly capable of maintaining python 2 yourself to post here

  9. 4 weeks ago
    Anonymous

    >Makefile
    all you need, gpt-3 is good at making those
    >CMake
    maybe if you write new sqlite or something

  10. 4 weeks ago
    Anonymous

    Having the R word in your post guarantees it will not be seen by C/C++ programmers who might have given you a real answer

  11. 4 weeks ago
    Anonymous

    the problem starts once it fails which it does quite often. Its often not a problem with cmake itself but due to shitty docs and the x number of ways to solve a problem. Like adding llvm to your project sounds easy just use llvmconfig or whatever right? Turns outs most projects somehow frick it up and it becomes a massive pain in the ass. Then you will have to become a cmake expert and a c++ expert and a linux linking expert or whatever windows uses.
    Its a mess that shits itself regularly googling stuff helps a lot but google itself has gotten so fricking bad that finding that one solution to your problem is hard. Its a magic box it takes years to understand and then it will still frick you over. Its not hard just a pain in the ass.
    meson isn't any better all c++ build systems fricking suck and the other anon is right plain makefile are superior but writing that is garbage. I never understood why D/rust/nim build system just work I guess no headers makes it easier.

  12. 4 weeks ago
    Anonymous

    C/C++ is shit. Meanwhile water is wet. Use Go.

  13. 4 weeks ago
    Anonymous

    Make actually forces you understand your dependency graph for a C project. No one has ever actually needed a dynamic build system.

    • 4 weeks ago
      Anonymous

      I don't really see the benefit in that. if I have a circular dependency, I want my build tool to say "you have a circular dependency, dummy. fix your shit." but otherwise I don't give a shit what my dependency graph looks like

      • 4 weeks ago
        Anonymous

        You either pay up front with less confusion with Make, or use a dynamic build system until it finally breaks and then want kys trying figure out wtf is going on. When hand Make breaks you should know exactly how to fix it.

  14. 4 weeks ago
    Anonymous

    How can someone know how to program in C but need a separate build system. I can literally make my own from a c executable and a text file if I need to, or a bash/batch script

    • 4 weeks ago
      Anonymous

      Have you ever developed a C/C++ project with 10+ libraries and 6+ output executables? Are you over the age of 30?

      • 4 weeks ago
        Anonymous

        You are experienced enough to know about build systems, but clearly not experienced enough to know how and why they are an unnecessary complication most of the time.

        This is the textbook example of a midwit post.

        • 4 weeks ago
          Anonymous

          Why are they unneccesary complications most of the time?
          t. never used a build system

          • 4 weeks ago
            Anonymous

            How would you ever know the size of a char without a bunch of macros?

          • 4 weeks ago
            Anonymous

            POSIX guarantees it is 8 bits, I don't support non-POSIX systems :^)

          • 4 weeks ago
            Anonymous

            >they arent using VS2008 and rewriting code made for 2013+

            frickign pleb tier ass coders
            you can't even last a day without auto and its sad
            yes this post is 5% satire

          • 4 weeks ago
            Anonymous

            This unironically is why people say we need autoconf.

            Remember openssl wrote code to implement support for big endian x64 "for portability".

          • 4 weeks ago
            Anonymous

            nta
            but make is fricking trash

            .c=.o? >@ >$? implicit variables?
            wildcard functions duplicating what you get in shell?
            and all this nonsense for a script that checks modification dates on object files.

            the only reasons i use make are:
            a) i already learned to use that crap so its less effort to continue using it than writing a builder that makes sense
            b) its a standard. an asinine one, but standard nonetheless

            using a product for these reasons doesnt make that product a good one.

  15. 4 weeks ago
    Anonymous

    Cmake + vcpkg makes c++ so much more enjoyable it's insane. The setup can be a little annoying but after that it's great. Downside is the docs kinda suck. No there isn't anything better.

  16. 4 weeks ago
    Anonymous

    Just use Make.

    >b-but windoze
    Windows is single-handedly the reason we have a million shitty "build systems", and, ironically, proprietary embedded Windows IDEs use Make with MinGW/Cygwin under the hood anyway.

  17. 4 weeks ago
    Anonymous

    autotools is so superior to cmake it's not even funny

  18. 4 weeks ago
    Anonymous

    Ironically CMake has the same issue as C/C++, it has a ton of legacy shit which still exists for the sake of backwards compatibility but it actually has much better options available. If you do everything with target_link_libraries, it will make your life so much simpler.

    Once modules become widespread, it will make managing C++ projects way easier. CMake already has support for them. You should start moving to modules already.

    • 4 weeks ago
      Anonymous

      >Once modules become widespread
      how do sepplesgays spout pure cope like this and not feel foolish

  19. 4 weeks ago
    Anonymous

    >c/c++ is great the way it is you're just not good enough, so use a different language
    >creates rust fixing a lot, but not all issues
    >Noooo you're not supposed to make a language that fixes the bad parts about the thing I like. Now I'm no longer part of a special boys club that can do niche stuff few other languages do

    • 4 weeks ago
      Anonymous

      Rust builds only work well when you're dealing with Rust-only projects, but when you're linking together with C code it becomes a massive shit.

  20. 4 weeks ago
    Anonymous

    ACTUAL QUESTION HERE

    The only big complexity I see is downloading and maintaining dependencies.
    I admittedly don't know much c++, the lack of a build manager being one of the gatekeepers.

    In go, java, whatever, I just declare a list of dependencies I want in some file, and use either built in tools (in the case of go) or a build tool to download dependencies and compile my project into x executables. It's dead simple and the tools are written in java / go.
    I had a look at cmake and conan. Conan looked nice but then I saw it had python and I vomited. NEVER. CMAKE was ridiculously complex since I had to actually link every header file and the difference in projects made it hard.

    The absolute simplest way I've found to manage dependencies is to simple clone the dependencies (if it's a git project), add them in an ignore directory, and add the header file into g++ as a parameter.

    ALL I WANT TO DO IS

    GIT CLONE (PROJECT)
    MAKE
    WAIT
    RUN EXECUTABLE(s) IN ./BUILD

    • 4 weeks ago
      Anonymous

      Very few C++ projects use Conan in my experience, most people either use pkg-config/find_package and expect you to have the dependencies already installed (usually through your distro's package manager). The other solution is to include the dependency as a git submodule which is probably what you want.

      • 4 weeks ago
        Anonymous

        Yeah, I've come to like the idea of using git as a dependency repository.

        But there's no tool that does this as far as I know. Maybe I should make it myself if it doesn't exist. Declare a list of dependencies in the root project, run my build tool, read the file, get the dependencies and generate a g++ command.

        • 4 weeks ago
          Anonymous

          CMake can do that though. You have to download the dependencies yourself, but they will provide a CMake target that you can declare as a dependency

          • 4 weeks ago
            Anonymous

            >You have to download the dependencies yourself,
            well that's the part that sucks.

            Getting new people started on a project really helps contribution, and not to mention yourself when you need to "start over" for whatever reason.

  21. 4 weeks ago
    Anonymous

    a batch/shell file that compiles as little units as possible.

  22. 4 weeks ago
    Anonymous

    anons simping for makefiles don't realize that even makefiles are complete bloat for most small sized projects.

    literally just do a jumbo/unity build. it requires absolutely nothing but your compiler.

    /* build.c */
    #include "util.c"
    #include "app.c"

    And now you just do `gcc build.c`. things are really just that simple if you want it to be.

    • 4 weeks ago
      Anonymous

      you still need to link/check availability of external dependencies unless you have zero dependencies

    • 4 weeks ago
      Anonymous

      terrible idea. if your app gets even a little complicated stuffing everything into one file BEFORE compilation is going to be a headache.

  23. 4 weeks ago
    Anonymous

    >so what's wrong with it?
    Insanely shit documentation, fricked syntax.
    >what is the better option, if any?
    Meson

    • 4 weeks ago
      Anonymous

      >Insanely shit documentation
      https://cliutils.gitlab.io/modern-cmake/

  24. 4 weeks ago
    Anonymous

    After some brief resarch, I've found that perhaps meson+wrapdb is the closest to an easy build system for c++.

  25. 4 weeks ago
    Anonymous

    I don't get how any DevOps people tolerate their job. I have to use C++ with Conan and CMake that then feeds into whatever GitLab's ci-cd pipeline. I dread having to figure out why something on the pipeline is failing, why a test didn't run, or why something didn't package and upload to Artifactory or Nexus or whatever. Some other teams use other stuff like Jenkins and Ninja or whatever. Never had to work on any large projects outside of C++, so can't comment on it.

    Makes me wonder how other languages with built in build stuff are to work with in a large corpo environment.

  26. 4 weeks ago
    Anonymous

    make
    meson
    if you don't like one, pick the other

  27. 4 weeks ago
    Anonymous

    xmake looks promising

  28. 4 weeks ago
    Anonymous

    IQfy NEETcels have never had a job and it shows

Your email address will not be published. Required fields are marked *