minecraft-weekend
minecraft-weekend copied to clipboard
musl does not implement qsort_r
There is a typo here: https://github.com/jdah/minecraft-weekend/blob/master/src/util/fmath.c#L21
should be < defined > instead of < define >.
The problem that qsort_r still remains unimplemented.
gcc -o bin/game src/block/air.o src/block/block.o src/block/buttercup.o src/block/clay.o src/block/coal.o src/block/cobblestone.o src/block/copper.o src/block/dirt.o src/block/glass.o src/block/grass.o src/block/gravel.o src/block/lava.o src/block/leaves.o src/block/log.o src/block/pineleaves.o src/block/pinelog.o src/block/planks.o src/block/podzol.o src/block/rose.o src/block/sand.o src/block/shrub.o src/block/snow.o src/block/stone.o src/block/tallgrass.o src/block/torch.o src/block/water.o src/entity/c_blocklook.o src/entity/c_camera.o src/entity/c_control.o src/entity/c_debug.o src/entity/c_light.o src/entity/c_movement.o src/entity/c_physics.o src/entity/c_position.o src/entity/ecs.o src/entity/player.o src/gfx/blockatlas.o src/gfx/renderer.o src/gfx/shader.o src/gfx/texture.o src/gfx/vao.o src/gfx/vbo.o src/gfx/window.o src/ui/crosshair.o src/ui/hotbar.o src/ui/ui.o src/util/camera.o src/util/color.o src/util/direction.o src/util/fmath.o src/world/blockmesh.o src/world/chunk.o src/world/chunkmesh.o src/world/light.o src/world/sky.o src/world/world.o src/main.o src/world/gen/flowergen.o src/world/gen/grassgen.o src/world/gen/noise.o src/world/gen/shrubgen.o src/world/gen/treegen.o src/world/gen/worldgen.o lib/glad/src/glad.o lib/cglm/libcglm.a lib/glfw/src/libglfw3.a lib/noise/libnoise.a -lm -ldl -lpthread
/usr/bin/ld: src/world/world.o: in function `sort_r':
/root/minecraft-weekend/src/world/../util/sort.h:26: undefined reference to `qsort_r'
/usr/bin/ld: /root/minecraft-weekend/src/world/../util/sort.h:26: undefined reference to `qsort_r'
/usr/bin/ld: /root/minecraft-weekend/src/world/../util/sort.h:26: undefined reference to `qsort_r'
/usr/bin/ld: /root/minecraft-weekend/src/world/../util/sort.h:26: undefined reference to `qsort_r'
/usr/bin/ld: /root/minecraft-weekend/src/world/../util/sort.h:26: undefined reference to `qsort_r'
/usr/bin/ld: src/world/world.o:/root/minecraft-weekend/src/world/../util/sort.h:26: more undefined references to `qsort_r' follow
collect2: error: ld returned 1 exit status
make: *** [Makefile:40: game] Error 1
What platform are you on?
and good catch on the #define issue, fixed in 7914e92f0e66cfd644577cee154c314ef5e17a4e.
@jdah https://musl.libc.org/ Musl does not implement qsort_r.
Other than that the game works, I just built it against glibc in chroot and it works. But problem still remains on musl.
Maybe you can use this to implement qsort_r in the code? (didn't test it) https://gist.github.com/izabera/e68927258ad2d29a1586bad276fabcab