c++ – Linking Error On GitHub Action While Not On Local Machine

This is my code, which i re-wrote in C++.

If i run make release or makeeverything compiles Normally and i get some object files in obj folder and csprite ELF.

But if i run the same command on GitHub Actions, it throws linking error, related to GLFW which doesn’t make any sense because i everytime install GLFW on the remote machine before compiling the program.

Error I Get On GitHub Actions:

g++ -Wall -c src/main.cpp -o obj/main.o
g++ -Wall -c lib/glad.c -o obj/glad.o
g++ -Wall -c src/imgui/imgui.cpp -o obj/imgui.o
g++ -Wall -c src/imgui/imgui_impl_opengl3.cpp -o obj/imgui_impl_opengl3.o
g++ -Wall -c src/imgui/imgui_impl_glfw.cpp -o obj/imgui_impl_glfw.o
g++ -Wall -c src/imgui/imgui_draw.cpp -o obj/imgui_draw.o
src/imgui/imgui_impl_glfw.cpp: In constructor ‘ImGui_ImplGlfw_Data::ImGui_ImplGlfw_Data()’:
src/imgui/imgui_impl_glfw.cpp:108:60: warning: ‘void* memset(void*, int, size_t)’ clearing an object of non-trivial type ‘struct ImGui_ImplGlfw_Data’; use assignment or value-initialization instead [-Wclass-memaccess]
  108 |     ImGui_ImplGlfw_Data()   { memset(this, 0, sizeof(*this)); }
      |                                                            ^
src/imgui/imgui_impl_glfw.cpp:88:8: note: ‘struct ImGui_ImplGlfw_Data’ declared here
   88 | struct ImGui_ImplGlfw_Data
      |        ^~~~~~~~~~~~~~~~~~~
g++ -Wall -c src/imgui/imgui_tables.cpp -o obj/imgui_tables.o
g++ -Wall -c src/imgui/imgui_widgets.cpp -o obj/imgui_widgets.o
g++ -lglfw -lm -ldl -I. -std=c++17 -Wall -O2 -DNDEBUG obj/main.o obj/glad.o obj/imgui.o obj/imgui_impl_opengl3.o obj/imgui_impl_glfw.o obj/imgui_draw.o obj/imgui_tables.o obj/imgui_widgets.o -o csprite
/usr/bin/ld: obj/main.o: in function `main':
main.cpp:(.text+0x20415): undefined reference to `glfwCreateStandardCursor'
/usr/bin/ld: main.cpp:(.text+0x20443): undefined reference to `glfwInit'
/usr/bin/ld: main.cpp:(.text+0x20452): undefined reference to `glfwWindowHint'
/usr/bin/ld: main.cpp:(.text+0x20461): undefined reference to `glfwWindowHint'
/usr/bin/ld: main.cpp:(.text+0x20470): undefined reference to `glfwWindowHint'
/usr/bin/ld: main.cpp:(.text+0x2047f): undefined reference to `glfwWindowHint'
/usr/bin/ld: main.cpp:(.text+0x2048e): undefined reference to `glfwWindowHint'
/usr/bin/ld: main.cpp:(.text+0x204b3): undefined reference to `glfwCreateWindow'
/usr/bin/ld: main.cpp:(.text+0x204d6): undefined reference to `glfwMakeContextCurrent'
/usr/bin/ld: main.cpp:(.text+0x204dd): undefined reference to `glfwGetProcAddress'
/usr/bin/ld: main.cpp:(.text+0x2050d): undefined reference to `glfwSetCursor'
/usr/bin/ld: main.cpp:(.text+0x2063e): undefined reference to `glfwSetFramebufferSizeCallback'
/usr/bin/ld: main.cpp:(.text+0x20651): undefined reference to `glfwSetCursorPosCallback'
/usr/bin/ld: main.cpp:(.text+0x20664): undefined reference to `glfwSetMouseButtonCallback'
/usr/bin/ld: main.cpp:(.text+0x20677): undefined reference to `glfwSetScrollCallback'
/usr/bin/ld: main.cpp:(.text+0x2068a): undefined reference to `glfwSetKeyCallback'
/usr/bin/ld: main.cpp:(.text+0x20961): undefined reference to `glfwWindowShouldClose'
/usr/bin/ld: main.cpp:(.text+0x20973): undefined reference to `glfwPollEvents'
/usr/bin/ld: main.cpp:(.text+0x20bb7): undefined reference to `glfwSwapBuffers'
/usr/bin/ld: main.cpp:(.text+0x20bdc): undefined reference to `glfwDestroyWindow'
/usr/bin/ld: main.cpp:(.text+0x20be1): undefined reference to `glfwTerminate'
/usr/bin/ld: obj/main.o: in function `process_input(GLFWwindow*)':
main.cpp:(.text+0x20c6a): undefined reference to `glfwGetMouseButton'
/usr/bin/ld: obj/main.o: in function `key_callback(GLFWwindow*, int, int, int, int)':
main.cpp:(.text+0x21054): undefined reference to `glfwSetWindowShouldClose'
/usr/bin/ld: obj/glad.o: in function `open_gl()':
glad.c:(.text+0x3f): undefined reference to `dlopen'
/usr/bin/ld: glad.c:(.text+0x68): undefined reference to `dlsym'
/usr/bin/ld: obj/glad.o: in function `close_gl()':
glad.c:(.text+0xb1): undefined reference to `dlclose'
/usr/bin/ld: obj/glad.o: in function `get_proc(char const*)':
glad.c:(.text+0x127): undefined reference to `dlsym'
/usr/bin/ld: obj/imgui_impl_opengl3.o: in function `open_libgl':
imgui_impl_opengl3.cpp:(.text+0x1a): undefined reference to `dlopen'
/usr/bin/ld: imgui_impl_opengl3.cpp:(.text+0x51): undefined reference to `dlsym'
/usr/bin/ld: obj/imgui_impl_opengl3.o: in function `close_libgl':
imgui_impl_opengl3.cpp:(.text+0x77): undefined reference to `dlclose'
/usr/bin/ld: obj/imgui_impl_opengl3.o: in function `get_proc':
imgui_impl_opengl3.cpp:(.text+0xd1): undefined reference to `dlsym'
/usr/bin/ld: obj/imgui_impl_glfw.o: in function `ImGui_ImplGlfw_GetClipboardText(void*)':
imgui_impl_glfw.cpp:(.text+0x3f): undefined reference to `glfwGetClipboardString'
/usr/bin/ld: obj/imgui_impl_glfw.o: in function `ImGui_ImplGlfw_SetClipboardText(void*, char const*)':
imgui_impl_glfw.cpp:(.text+0x68): undefined reference to `glfwSetClipboardString'
/usr/bin/ld: obj/imgui_impl_glfw.o: in function `ImGui_ImplGlfw_TranslateUntranslatedKey(int, int)':
imgui_impl_glfw.cpp:(.text+0x698): undefined reference to `glfwGetKeyName'
/usr/bin/ld: obj/imgui_impl_glfw.o: in function `ImGui_ImplGlfw_InstallCallbacks(GLFWwindow*)':
imgui_impl_glfw.cpp:(.text+0xbd5): undefined reference to `glfwSetWindowFocusCallback'
/usr/bin/ld: imgui_impl_glfw.cpp:(.text+0xbf0): undefined reference to `glfwSetCursorEnterCallback'
/usr/bin/ld: imgui_impl_glfw.cpp:(.text+0xc0e): undefined reference to `glfwSetCursorPosCallback'
/usr/bin/ld: imgui_impl_glfw.cpp:(.text+0xc2c): undefined reference to `glfwSetMouseButtonCallback'
/usr/bin/ld: imgui_impl_glfw.cpp:(.text+0xc4a): undefined reference to `glfwSetScrollCallback'
/usr/bin/ld: imgui_impl_glfw.cpp:(.text+0xc68): undefined reference to `glfwSetKeyCallback'
/usr/bin/ld: imgui_impl_glfw.cpp:(.text+0xc86): undefined reference to `glfwSetCharCallback'
/usr/bin/ld: imgui_impl_glfw.cpp:(.text+0xc9d): undefined reference to `glfwSetMonitorCallback'
/usr/bin/ld: obj/imgui_impl_glfw.o: in function `ImGui_ImplGlfw_RestoreCallbacks(GLFWwindow*)':
imgui_impl_glfw.cpp:(.text+0xd3e): undefined reference to `glfwSetWindowFocusCallback'
/usr/bin/ld: imgui_impl_glfw.cpp:(.text+0xd58): undefined reference to `glfwSetCursorEnterCallback'
/usr/bin/ld: imgui_impl_glfw.cpp:(.text+0xd72): undefined reference to `glfwSetCursorPosCallback'
/usr/bin/ld: imgui_impl_glfw.cpp:(.text+0xd8c): undefined reference to `glfwSetMouseButtonCallback'
/usr/bin/ld: imgui_impl_glfw.cpp:(.text+0xda6): undefined reference to `glfwSetScrollCallback'
/usr/bin/ld: imgui_impl_glfw.cpp:(.text+0xdc0): undefined reference to `glfwSetKeyCallback'
/usr/bin/ld: imgui_impl_glfw.cpp:(.text+0xdda): undefined reference to `glfwSetCharCallback'
/usr/bin/ld: imgui_impl_glfw.cpp:(.text+0xded): undefined reference to `glfwSetMonitorCallback'
/usr/bin/ld: obj/imgui_impl_glfw.o: in function `ImGui_ImplGlfw_Init(GLFWwindow*, bool, GlfwClientApi)':
imgui_impl_glfw.cpp:(.text+0xf8f): undefined reference to `glfwSetErrorCallback'
/usr/bin/ld: imgui_impl_glfw.cpp:(.text+0xf9d): undefined reference to `glfwCreateStandardCursor'
/usr/bin/ld: imgui_impl_glfw.cpp:(.text+0xfaf): undefined reference to `glfwCreateStandardCursor'
/usr/bin/ld: imgui_impl_glfw.cpp:(.text+0xfc1): undefined reference to `glfwCreateStandardCursor'
/usr/bin/ld: imgui_impl_glfw.cpp:(.text+0xfd3): undefined reference to `glfwCreateStandardCursor'
/usr/bin/ld: imgui_impl_glfw.cpp:(.text+0xfe5): undefined reference to `glfwCreateStandardCursor'
/usr/bin/ld: obj/imgui_impl_glfw.o:imgui_impl_glfw.cpp:(.text+0xff7): more undefined references to `glfwCreateStandardCursor' follow
/usr/bin/ld: obj/imgui_impl_glfw.o: in function `ImGui_ImplGlfw_Init(GLFWwindow*, bool, GlfwClientApi)':
imgui_impl_glfw.cpp:(.text+0x1041): undefined reference to `glfwSetErrorCallback'
/usr/bin/ld: obj/imgui_impl_glfw.o: in function `ImGui_ImplGlfw_Shutdown()':
imgui_impl_glfw.cpp:(.text+0x118d): undefined reference to `glfwDestroyCursor'
/usr/bin/ld: obj/imgui_impl_glfw.o: in function `ImGui_ImplGlfw_UpdateMouseData()':
imgui_impl_glfw.cpp:(.text+0x11fe): undefined reference to `glfwGetWindowAttrib'
/usr/bin/ld: imgui_impl_glfw.cpp:(.text+0x124e): undefined reference to `glfwSetCursorPos'
/usr/bin/ld: imgui_impl_glfw.cpp:(.text+0x127b): undefined reference to `glfwGetCursorPos'
/usr/bin/ld: obj/imgui_impl_glfw.o: in function `ImGui_ImplGlfw_UpdateMouseCursor()':
imgui_impl_glfw.cpp:(.text+0x1319): undefined reference to `glfwGetInputMode'
/usr/bin/ld: imgui_impl_glfw.cpp:(.text+0x1367): undefined reference to `glfwSetInputMode'
/usr/bin/ld: imgui_impl_glfw.cpp:(.text+0x13ae): undefined reference to `glfwSetCursor'
/usr/bin/ld: imgui_impl_glfw.cpp:(.text+0x13c7): undefined reference to `glfwSetInputMode'
/usr/bin/ld: obj/imgui_impl_glfw.o: in function `ImGui_ImplGlfw_UpdateGamepads()':
imgui_impl_glfw.cpp:(.text+0x1461): undefined reference to `glfwGetGamepadState'
/usr/bin/ld: obj/imgui_impl_glfw.o: in function `ImGui_ImplGlfw_NewFrame()':
imgui_impl_glfw.cpp:(.text+0x1a2e): undefined reference to `glfwGetWindowSize'
/usr/bin/ld: imgui_impl_glfw.cpp:(.text+0x1a48): undefined reference to `glfwGetFramebufferSize'
/usr/bin/ld: imgui_impl_glfw.cpp:(.text+0x1ac3): undefined reference to `glfwGetTime'
collect2: error: ld returned 1 exit status
make: *** [Makefile:34: csprite] Error 1
Error: Process completed with exit code 2.

Leave a Comment