Black-Magic-Probe-Book
                                
                                
                                
                                    Black-Magic-Probe-Book copied to clipboard
                            
                            
                            
                        linux compile/runtime issues: _popen and vertex index
I went into some issues when trying to compile / run the sources. Some were solved, some just workarounds:
could not link: "_popen" / "_pclose" were unresolved, was unable to fix this, so I defined TCL_DISABLE_EXEC
It might be a missing library.
When running bmdebug an assertion was raised:
bmdebug: nuklear.c:4560: nk_draw_list_alloc_vertices: Assertion (list->vertex_count < 65535 && "To many verticies for 16-bit vertex indicies. Please read comment above on how to solve this problem")' failed.`
So I did some changes to extend this to uint.
diff --git a/source/Makefile.linux b/source/Makefile.linux
index 28b1865..a073c54 100644
--- a/source/Makefile.linux
+++ b/source/Makefile.linux
@@ -43,7 +43,7 @@ endif
 ####### C compiler
 CL        := gcc
 CC        := gcc -c
-CFLAGS    := -Wall
+CFLAGS    := -Wall -DTCL_DISABLE_EXEC -DNK_UINT_DRAW_INDEX
 INCLUDE   := $(GLFW_INC)
 
 ####### Linker
diff --git a/source/nuklear_glfw_gl2.c b/source/nuklear_glfw_gl2.c
index 6c0d4b1..114e761 100644
--- a/source/nuklear_glfw_gl2.c
+++ b/source/nuklear_glfw_gl2.c
@@ -148,7 +148,7 @@ nk_glfw3_render(enum nk_anti_aliasing AA)
                 (GLint)((glfw.height - (GLint)(cmd->clip_rect.y + cmd->clip_rect.h)) * glfw.fb_scale.y),
                 (GLint)(cmd->clip_rect.w * glfw.fb_scale.x),
                 (GLint)(cmd->clip_rect.h * glfw.fb_scale.y));
-            glDrawElements(GL_TRIANGLES, (GLsizei)cmd->elem_count, GL_UNSIGNED_SHORT, offset);
+            glDrawElements(GL_TRIANGLES, (GLsizei)cmd->elem_count, GL_UNSIGNED_INT, offset);
             offset += cmd->elem_count;
         }
         nk_clear(&glfw.ctx);
prochnor@probook:~/projects/uC/stm32/Black-Magic-Probe-Book/source $ git diff  .
diff --git a/source/Makefile.linux b/source/Makefile.linux
index 28b1865..a073c54 100644
--- a/source/Makefile.linux
+++ b/source/Makefile.linux
@@ -43,7 +43,7 @@ endif
 ####### C compiler
 CL        := gcc
 CC        := gcc -c
-CFLAGS    := -Wall
+CFLAGS    := -Wall -DTCL_DISABLE_EXEC -DNK_UINT_DRAW_INDEX
 INCLUDE   := $(GLFW_INC)
 
 ####### Linker
diff --git a/source/nuklear_glfw_gl2.c b/source/nuklear_glfw_gl2.c
index 6c0d4b1..114e761 100644
--- a/source/nuklear_glfw_gl2.c
+++ b/source/nuklear_glfw_gl2.c
@@ -148,7 +148,7 @@ nk_glfw3_render(enum nk_anti_aliasing AA)
                 (GLint)((glfw.height - (GLint)(cmd->clip_rect.y + cmd->clip_rect.h)) * glfw.fb_scale.y),
                 (GLint)(cmd->clip_rect.w * glfw.fb_scale.x),
                 (GLint)(cmd->clip_rect.h * glfw.fb_scale.y));
-            glDrawElements(GL_TRIANGLES, (GLsizei)cmd->elem_count, GL_UNSIGNED_SHORT, offset);
+            glDrawElements(GL_TRIANGLES, (GLsizei)cmd->elem_count, GL_UNSIGNED_INT, offset);
             offset += cmd->elem_count;
         }
         nk_clear(&glfw.ctx);
Also I added my Dockerfile which I used for build:
FROM ubuntu:24.04
ENV DEBIAN_FRONTEND=noninteractive
RUN apt-get update \
   && apt-get -qq install -y --no-install-recommends \
   	build-essential libbsd-dev libusb-1.0-0-dev libglfw3-dev libfontconfig-dev libgtk-3-dev libglfw3-wayland \
  && apt-get autoremove -y \
    && apt-get clean -y \
    && rm -rf \
        /tmp/* \
        /var/{cache,log}/* \
        /var/lib/apt/lists/*
USER 1001
WORKDIR /workspace
You can than build with
docker run -v $(pwd):/workspace -it --rm yourimage GLFW_LIBNAME=glfw make -f Makefile.linux