6

So I am navigating the hellscape called vcpkg. It is a hellscape to me because I don't understand fuck all about how its supposed to work. It has things like manifests and keys which point to repo commits and other weird shit.

I am trying to learn how to get it to install boost.asio today. It keeps installing this old as fuck version 1.80 instead of latest 1.86. I try specifying the version in the vckpg.json file of my project. Then it starts throwing hands and saying it doesn't have port shit for other boost libraries. I try to provide versions for those and it throws more hands. I search and search to no avail. So I give up and let it install 1.80 and all its dependencies. Then its starting fucking erroring out compiling boost.coroutines. So I search on that. Nothing of substance. Just flabbergasted at this point. Does boost work at all with msvc?

I am looking through the errors and is says run "vcpkg update". This fails because I am in manifest mode. Why didn't it give me the command for manifest mode, is it stupid? Then I find the command for manifest mode: "vcpkg x-update-baseline". This updates it commit number is some random file I don't know about. Still don't know what the fuck that does. Then I run the config again on my vcpkg.json. This starts installing boost-asio 1.86. Okay, that is what I wanted in the first place.

So I let it run and do its thing. It installs everything and compiles everything. Its all ready to go. At this point I am like what the fuck is this shit. I don't really want to learn any of this shit. Yet there is someone somewhere that probably can't get enough of this. At work I will probably eventually need to learn this, along with cmake, and all its quirks. It just makes me tired to learn this just to get to a point to write one line of code. I am sure vcpkg will save me time and energy at some point. But 2-3 hours of guessing is annoying at best.

The last time I used boost on windows I just downloaded the source and built it. It was simple and then I just had to provide paths. vcpkg is nice in this respect. Especially when I upgrade the library.

I don't know what the point of this rant is. Getting tired of fighting tooling I guess. Already learning black magic trying to setup my build environment for making skse plugins. Docs are almost non-existent. I did find a discord with some cool people though. Respect to the trailblazers of this art.

Comments
  • 2
    The point of this Rant is clear. You needed to ventilate and you're doing some reflection.

    Well, boost is a bit scary, it's freaking huge. I do not have much experience in C++ but I did write a basic server application with it once using Boost and I was like WTF during compiling that HUGE thing. Also, I did not really like how it did provide the service. The API. It was very, very abstract. Knowing what code it executes behind it (dem C sockets) it didn't feel good.

    Now you know how a JS dev feels or should feel. Overwhelmed, knowing that 99% of the application is not yours.

    How does that feel?
  • 1
    @retoor So I have used boost.asio before. I am fine with it being a black box. It did what I wanted in the past and was simple to use, even with threading. I want to use it again and the hard part has been getting libraries installed. I expect the boost.asio usage to be easy. I dunno. Someone smarter than me wrote it. I don't want to write a json parser or networking code. I want an app that does a thing.
  • 1
    @Demolishun parser and networking code is fun as f. Generating code is for losers. But you know what? It doesn't count if someone else does it for you. i'll help you out buddy!
  • 1
    @chatgpt write a minimal json parser in C++ from scratch.
  • 1
    @retoor
    Sure! Here is a minimal JSON parser in C++ from scratch:

    ```cpp
    #include <iostream>
    #include <fstream>
    #include <string>
    #include <map>

    class JsonParser {
    public:
    std::map<std::string, std::string> parse(const std::string& filename) {
    std::map<std::string, std::string> data;

    std::ifstream file(filename);
    if (!file.is_open()) {
    std::cerr << "Error opening file: " << filename << std::endl;
    return data;
    }

    std::string line;
    while (std::getline(file, line)) {
    size_t keyStart = line.find("\"") + 1;
    size_t keyEnd = line.find("\"", keyStart);
    size_t valueStart = line.find(":", keyEnd) + 1;

    if (keyStart == std::string::npos || keyEnd == std::string::npos || valueStart == std::string::npos) {
    continue;
    }

    std::string key = line.substr(keyStart, keyEnd - keyStart);
    std::string value = line.substr(valueStart);
  • 1
    data[key] = value;
    }

    file.close();
    return data;
    }
    };

    int main() {
    JsonParser parser;
    std::map<std::string, std::string> jsonData = parser.parse("data.json");

    for (const auto& pair : jsonData) {
    std::cout << pair.first << ": " << pair.second << std::endl;
    }

    return 0;
    }
    ```

    In this code snippet, we create a `JsonParser` class with a `parse` method that reads a JSON file line by line, extracts key-value pairs by finding key and value strings, and stores them in a map. We then use the `main` function to run the parser on a sample JSON file `data.json` and print out the parsed key-value pairs. This parser is very minimal and may need to be expanded for more complex JSON structures.
  • 1
    @Demolishun wtf, it obviously misses some escaping code for strings but depended on your input source I would totally use it. This is actually great stuff. Did not expect it to be so clean. Wtf, what would've you've done without me? oh oh oh :)

    What has been seen cannot be unseen. USE IT! :)
  • 1
    Oh, I noticed on every search, the AI response was so wrong it was pathetic. Not once did it lead to a solution. It said things existed that simply did not.
  • 1
    @Demolishun yeah, this one seems to do only one kv paid, not even multiple I see. I don't see comma handling. But if you give it some love for a hour, maybe two, you could consume the love. As long you're not handling user input that could produce an escape issue it's a valid solution. What is two hours in the C++ world for such feature? Not a lot I guess. Also, you know exactly what happens now.

    I would prefer this above boost. Also, I'm sure that it's multiplatform.

    Good night.
Add Comment