5 ms·
Show HN: A glib-like multi-platform C library
- Rochus 4y agoLooks like a really interesting set of libraries (https://github.com/tboox https://github.com/tboox), available under Apache 2 license; also xmake looks interesting; definitely worth a closer look; thanks for sharing.
- AlbertoGP 4y agoYes, although the documentation seems bare-bones, the code looks clean. The xmake package repository files might be useful also for people interested in making their own package manager, or even installing by hand. Here is the package information for autoconf, for instance: https://github.com/xmake-io/xmake-repo/blob/master/packages/a/autoconf/xmake.lua https://github.com/xmake-io/xmake-repo/blob/master/packages/... It has download links, checksums for specific versions, and the Lua syntax seems easy to parse. The package for NanoVG however, does not indicate anywhere that you need the GLEW and GLFW libraries: https://github.com/xmake-io/xmake-repo/blob/master/packages/n/nanovg/xmake.lua https://github.com/xmake-io/xmake-repo/blob/master/packages/...
- danny0z 4y agoXmake is also based on tbox as a c base library.
- AlbertoGP 4y agoI’m trying to compile from source, and since that needs xmake I’m now trying to build it. Following the instructions, after `make build` I get “No rule to make target 'lua/lapi.c', needed by 'lua/lapi.o'. Stop.”. I’m now reading more, and it will probably be some easy thing. My advice would be to have some compact list of steps to get it up and running from source without having to install binaries. I think that would make it easier to try out. I’ll now continue trying to figure out what’s missing.
- danny0z 4y agowe need pull all submodules, you can see https://xmake.io/#/guide/installation?id=installation https://xmake.io/#/guide/installation?id=installation git submodule update --init Or you can download full source code from releases. https://github.com/xmake-io/xmake/releases/download/v2.6.5/xmake-v2.6.5.tar.gz https://github.com/xmake-io/xmake/releases/download/v2.6.5/x...
- AlbertoGP 4y ago> Or you can download full source code from releases. https://github.com/xmake-io/xmake/releases/download/v2.6.5/x https://github.com/xmake-io/xmake/releases/download/v2.6.5/x... Yes, that’s what I did. :-) wget https://github.com/xmake-io/xmake/archive/refs/tags/v2.6.5.tar.gz tar xf v2.6.5.tar.gz cd xmake-2.6.5/ make build
- danny0z 4y agono, it should be `v2.6.5/xmake-v2.6.5.tar.gz` instead of `tags/v2.6.5.tar.gz` https://github.com/xmake-io/xmake/releases/download/v2.6.5/xmake-v2.6.5.tar.gz
- AlbertoGP 4y agoAh, I see. That might be Github’s problem, but the link I used is the one at the bottom of the list labeled “Source code”: https://github.com/xmake-io/xmake/releases/tag/v2.6.5 https://github.com/xmake-io/xmake/releases/tag/v2.6.5 I see that one you mention in the middle of the list, with the name “xmake-v2.6.5.tar.gz”. Please note that this is not a criticism, I’m just telling what can happen when someone tries to compile it. Edit: trying this now: wget https://github.com/xmake-io/xmake/releases/download/v2.6.5/xmake-v2.6.5.tar.gz tar xf xmake-v2.6.5.tar.gz cd xmake make build I get “make: ** No rule to make target 'build'. Stop.”, because there is no `makefile` or `Makefile` in there. Edit 2: I see, the issue is that it does not create a directory `xmake-v2.6.5`, but instead extracts its contents in the current directory, as a “tar bomb”. This works: mkdir xmake-v2.6.5 cd xmake-v2.6.5 wget https://github.com/xmake-io/xmake/releases/download/v2.6.5/xmake-v2.6.5.tar.gz tar xf xmake-v2.6.5.tar.gz make build
- nextaccountic 4y agoHow does the memory library detect use after free?
- camel-cdr 4y agoWhenever I see such libraries, the first thing I check out is their PRNG implementation, and this one must be the worst I've seen so far. (The rest of the library is probably quite good, I'm just talking about the PRNG part) The library has one PRNG, and it is the following: tb_spinlock_enter(&g_lock); g_value = (g_value * 10807 + 1) & 0xffffffff; tb_spinlock_leave(&g_lock); Using this is literally worse than using the rand reference implementation. Also, tb_random_range uses a biased and slow implementation with modulo. (see https://www.pcg-random.org/posts/bounded-rands.html https://www.pcg-random.org/posts/bounded-rands.html for the proper way to do this) I might look into adding a proper PRNG implementation, but I'll recommend a few resources: A lesson of what not to do: https://youtu.be/LDPMpc-ENqY https://youtu.be/LDPMpc-ENqY ("rand() Considered Harmful") Some good modern PRNGs: https://www.pcg-random.org/ https://www.pcg-random.org/, https://prng.di.unimi.it/ https://prng.di.unimi.it/, https://romu-random.org/ https://romu-random.org/ Generating random numbers in a specific range: https://www.pcg-random.org/posts/bounded-rands.html https://www.pcg-random.org/posts/bounded-rands.html