cococry / todo

Simple, suckless GUI task management utility written in C with libleif
Apache License 2.0
124 stars 13 forks source link

Buffer Overflow. Hi, i'm getting small error while running. looking for help #1

Open aatmprakash opened 5 months ago

aatmprakash commented 5 months ago

image

I tried this size_t bytesRead = fread(buffer, 1, fileSize, file); if (bytesRead != fileSize) { fprintf(stderr, "Error reading file\n"); // Handle the error, for example by freeing resources and returning an error code fclose(file); free(buffer); return -1; }

brmarkus commented 5 months ago

From the screenshot it looks like it could not link the application as the linker found multiple main symbols - have you modified the source code todo.c? So the linker failed to create the application. You selected y to start the application - using the checked-in executable from Github "https://github.com/cococry/todo/blob/main/todo" and not the built executable...

From within the "todo" repo, you can check with git status and/or git diff . what has changed... Looks like you modified the todo.c file...

You have addressed the compiler-warning from the "leif" repository (which is a warning only)?

brmarkus commented 5 months ago

When I run the executable from this repo, then I get a SIGSEGV - the pre-built application is looking for a font-file under /usr/share/todo/fonts/, where the Makefile copies them to /usr/share/todo/. But you mentioned a different error. Maybe it is a problem from the make process: the linker failed to create the executable, making make to fail and abort, not continuing to copy the other resources in the following sudo make install step (https://github.com/cococry/todo/blob/main/Makefile#L12)? The setup.sh script doesn't check for error-codes.

aatmprakash commented 5 months ago

i just triedd to run simple code some time error says buffer overflow or << leif.c:1047:3: warning: ignoring return value of ‘fread’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 1047 | fread(buffer, 1, fileSize, file); >>

image

aatmprakash commented 5 months ago

Even if i;m not doing something with code just try to install lief grom it says that

image

i also try to debug some code in lief which i shared lief repo

aatmprakash commented 5 months ago

even i just clone git clone https://github.com/cococry/todo cd todo ./setup.sh

it through same error on load function and after asked y or n to run . y- buffer size overflow

brmarkus commented 5 months ago

The last screenshot looks better - no linker error, only a compiler warning (ignoring return value of fread() method). Do you have a debugger installed, like gdb? And try to get either a coredump file (for post-mortem analysis) or run the debugger, start the application and see what callstack can be seen when the buffer overflow happens? Are you sure there are no other code-changes, or have you changed the font-files or the icon file? An earlier run of todo might have corrupted the serialized tasks in the persistent file.

When you call "sudo make uninstall" then the persistent task-file, fonts, icon and application (and desktop file) would be deleted. Then call "make && sudo make install" again from the todo repo folder.

PerHac13 commented 3 months ago

Also facing same issue as @aatmprakash did the clone of repo of cococry todo followed the setup is giving the same buffer overflow error even decrease the window size to 800 600

``

include <GLFW/glfw3.h>

include <leif/leif.h>

include

include

void error_callback(int error, const char* description) { fprintf(stderr, "GLFW Error: %s\n", description); }

int main(void) { printf("Program started\n"); fflush(stdout);

glfwSetErrorCallback(error_callback);

if (!glfwInit()) {
    fprintf(stderr, "Failed to initialize GLFW\n");
    return -1;
}
printf("GLFW initialized\n");
fflush(stdout);

// Specify OpenGL version
glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);
glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 0);
glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_ANY_PROFILE);

// Try a smaller window size
GLFWwindow* window = glfwCreateWindow(800, 600, "Task Management App", NULL, NULL);
if (!window) {
    fprintf(stderr, "Failed to create GLFW window\n");
    glfwTerminate();
    return -1;
}
printf("GLFW window created\n");
fflush(stdout);

glfwMakeContextCurrent(window);
printf("OpenGL context made current\n");
fflush(stdout);

printf("Initializing leif...\n");
fflush(stdout);
lf_init_glfw(800, 600, window);
printf("leif initialized\n");
fflush(stdout);

while (!glfwWindowShouldClose(window)) {
    glClear(GL_COLOR_BUFFER_BIT);
    glClearColor(0.1f, 0.1f, 0.1f, 1.0f);

    printf("Starting leif frame\n");
    fflush(stdout);
    lf_begin();

    printf("Drawing text\n");
    fflush(stdout);
    lf_text("Task Management App");
    lf_text("1. Add Task");
    lf_text("2. View Tasks");
    lf_text("3. Exit");

    printf("Ending leif frame\n");
    fflush(stdout);
    lf_end();

    glfwPollEvents();
    glfwSwapBuffers(window);

    printf("Frame completed\n");
    fflush(stdout);
}

printf("Cleaning up...\n");
fflush(stdout);

glfwDestroyWindow(window);
glfwTerminate();

printf("Program ended successfully\n");
fflush(stdout);

return 0;

} ``

i am getting this as output Program started GLFW initialized GLFW window created OpenGL context made current Initializing leif... *** buffer overflow detected ***: terminated ./dev.sh: line 12: 13971 Aborted (core dumped) ./a.out

so i believe there in a issue with leif or my device btw i am using ubuntu 22.04 is this compatible with this version??

brmarkus commented 3 months ago

Do you have a chance to check with a debugger (run the application in a debugger, e.g. gdb), or run a post-mortem analysis by looking into the created core dump file (when building the application with debug infos enabled)? The callstack might simply show e.g. a call to strcpy() where the destination buffer is smaller than what shall be copied into. Could be loading a wrong font-file (e.g. a different font than this application was made for; a different version of the font, using an unexpected config-option and the application might miss more detailed error-handling or input-parameter-checks).

Part of the console log says terminated ./dev.sh: line 12 - is that your script file dev.sh?

PerHac13 commented 3 months ago

ya dev.sh just run following command

gcc task_Management_App.c -Wall -lGL -lGLU -lglut -lGLEW -lglfw -lX11 -lXxf86vm -lXrandr -lpthread -lXi -ldl -lXinerama -lXcursor -lleif -lclipboard -lm -lxcb

that is i created it for easier to build

ok i will try to use gdb then let you know

Khant-Nyar commented 1 month ago

what about this ?

image

 *  Executing task: C/C++: gcc build active file 

Starting build...
/usr/bin/gcc -fdiagnostics-color=always -g /home/khant-nyar/Documents/ctest/todos/todo.c -o /home/khant-nyar/Documents/ctest/todos/todo
/usr/bin/ld: /tmp/ccpi0RCh.o: in function `resizecb':
/home/khant-nyar/Documents/ctest/todos/todo.c:102:(.text+0x33): undefined reference to `lf_resize_display'
/usr/bin/ld: /home/khant-nyar/Documents/ctest/todos/todo.c:103:(.text+0x4c): undefined reference to `glViewport'
/usr/bin/ld: /tmp/ccpi0RCh.o: in function `rendertopbar':
/home/khant-nyar/Documents/ctest/todos/todo.c:109:(.text+0x7d): undefined reference to `lf_push_font'
/usr/bin/ld: /home/khant-nyar/Documents/ctest/todos/todo.c:111:(.text+0x91): undefined reference to `lf_get_theme'
/usr/bin/ld: /home/khant-nyar/Documents/ctest/todos/todo.c:112:(.text+0x132): undefined reference to `lf_push_style_props'
/usr/bin/ld: /home/khant-nyar/Documents/ctest/todos/todo.c:113:(.text+0x145): undefined reference to `lf_text'
/usr/bin/ld: /home/khant-nyar/Documents/ctest/todos/todo.c:114:(.text+0x14f): undefined reference to `lf_pop_style_props'
/usr/bin/ld: /home/khant-nyar/Documents/ctest/todos/todo.c:116:(.text+0x159): undefined reference to `lf_pop_font'
/usr/bin/ld: /home/khant-nyar/Documents/ctest/todos/todo.c:124:(.text+0x18b): undefined reference to `lf_get_theme'
/usr/bin/ld: /home/khant-nyar/Documents/ctest/todos/todo.c:129:(.text+0x270): undefined reference to `lf_push_style_props'
/usr/bin/ld: /home/khant-nyar/Documents/ctest/todos/todo.c:130:(.text+0x2a3): undefined reference to `lf_set_ptr_x_absolute'
/usr/bin/ld: /home/khant-nyar/Documents/ctest/todos/todo.c:133:(.text+0x2ad): undefined reference to `lf_set_line_should_overflow'
/usr/bin/ld: /home/khant-nyar/Documents/ctest/todos/todo.c:134:(.text+0x2dd): undefined reference to `_lf_button_fixed_loc'
/usr/bin/ld: /home/khant-nyar/Documents/ctest/todos/todo.c:137:(.text+0x2f6): undefined reference to `lf_set_line_should_overflow'
/usr/bin/ld: /home/khant-nyar/Documents/ctest/todos/todo.c:139:(.text+0x300): undefined reference to `lf_pop_style_props'
/usr/bin/ld: /tmp/ccpi0RCh.o: in function `renderfilters':
/home/khant-nyar/Documents/ctest/todos/todo.c:152:(.text+0x358): undefined reference to `lf_get_theme'
/usr/bin/ld: /home/khant-nyar/Documents/ctest/todos/todo.c:162:(.text+0x44f): undefined reference to `lf_push_font'
/usr/bin/ld: /home/khant-nyar/Documents/ctest/todos/todo.c:167:(.text+0x465): undefined reference to `lf_get_ptr_x'
/usr/bin/ld: /home/khant-nyar/Documents/ctest/todos/todo.c:168:(.text+0x4bc): undefined reference to `lf_push_style_props'
/usr/bin/ld: /home/khant-nyar/Documents/ctest/todos/todo.c:169:(.text+0x4db): undefined reference to `lf_set_cull_end_x'
/usr/bin/ld: /home/khant-nyar/Documents/ctest/todos/todo.c:170:(.text+0x4f6): undefined reference to `lf_set_cull_end_y'
/usr/bin/ld: /home/khant-nyar/Documents/ctest/todos/todo.c:171:(.text+0x500): undefined reference to `lf_set_no_render'
/usr/bin/ld: /home/khant-nyar/Documents/ctest/todos/todo.c:173:(.text+0x53c): undefined reference to `_lf_button_loc'
/usr/bin/ld: /home/khant-nyar/Documents/ctest/todos/todo.c:175:(.text+0x55b): undefined reference to `lf_unset_cull_end_x'
/usr/bin/ld: /home/khant-nyar/Documents/ctest/todos/todo.c:176:(.text+0x565): undefined reference to `lf_unset_cull_end_y'
/usr/bin/ld: /home/khant-nyar/Documents/ctest/todos/todo.c:177:(.text+0x56f): undefined reference to `lf_set_no_render'
/usr/bin/ld: /home/khant-nyar/Documents/ctest/todos/todo.c:178:(.text+0x579): undefined reference to `lf_get_ptr_x'
/usr/bin/ld: /home/khant-nyar/Documents/ctest/todos/todo.c:181:(.text+0x5d8): undefined reference to `lf_set_ptr_x_absolute'
/usr/bin/ld: /home/khant-nyar/Documents/ctest/todos/todo.c:184:(.text+0x5e2): undefined reference to `lf_set_line_should_overflow'
/usr/bin/ld: /home/khant-nyar/Documents/ctest/todos/todo.c:194:(.text+0x686): undefined reference to `lf_push_style_props'
/usr/bin/ld: /home/khant-nyar/Documents/ctest/todos/todo.c:195:(.text+0x6ba): undefined reference to `_lf_button_loc'
/usr/bin/ld: /home/khant-nyar/Documents/ctest/todos/todo.c:198:(.text+0x6d5): undefined reference to `lf_pop_style_props'
/usr/bin/ld: /home/khant-nyar/Documents/ctest/todos/todo.c:201:(.text+0x6f8): undefined reference to `lf_set_line_should_overflow'
/usr/bin/ld: /home/khant-nyar/Documents/ctest/todos/todo.c:202:(.text+0x702): undefined reference to `lf_pop_style_props'
/usr/bin/ld: /home/khant-nyar/Documents/ctest/todos/todo.c:203:(.text+0x70c): undefined reference to `lf_pop_font'
/usr/bin/ld: /tmp/ccpi0RCh.o: in function `renderentries':
/home/khant-nyar/Documents/ctest/todos/todo.c:208:(.text+0x76e): undefined reference to `lf_get_ptr_x'
/usr/bin/ld: /home/khant-nyar/Documents/ctest/todos/todo.c:208:(.text+0x7c0): undefined reference to `lf_get_ptr_y'
/usr/bin/ld: /home/khant-nyar/Documents/ctest/todos/todo.c:208:(.text+0x7f6): undefined reference to `lf_get_ptr_x'
/usr/bin/ld: /home/khant-nyar/Documents/ctest/todos/todo.c:208:(.text+0x817): undefined reference to `lf_get_ptr_y'
/usr/bin/ld: /home/khant-nyar/Documents/ctest/todos/todo.c:208:(.text+0x860): undefined reference to `_lf_div_begin_loc'
/usr/bin/ld: /home/khant-nyar/Documents/ctest/todos/todo.c:223:(.text+0x937): undefined reference to `lf_get_ptr_y'
/usr/bin/ld: /home/khant-nyar/Documents/ctest/todos/todo.c:225:(.text+0x95b): undefined reference to `lf_get_ptr_y'
/usr/bin/ld: /home/khant-nyar/Documents/ctest/todos/todo.c:225:(.text+0x978): undefined reference to `lf_set_ptr_y_absolute'
/usr/bin/ld: /home/khant-nyar/Documents/ctest/todos/todo.c:226:(.text+0x982): undefined reference to `lf_get_ptr_x'
/usr/bin/ld: /home/khant-nyar/Documents/ctest/todos/todo.c:226:(.text+0x99b): undefined reference to `lf_set_ptr_x_absolute'
/usr/bin/ld: /home/khant-nyar/Documents/ctest/todos/todo.c:227:(.text+0x9d5): undefined reference to `lf_get_ptr_x'
/usr/bin/ld: /home/khant-nyar/Documents/ctest/todos/todo.c:227:(.text+0x9f6): undefined reference to `lf_get_ptr_y'
/usr/bin/ld: /home/khant-nyar/Documents/ctest/todos/todo.c:227:(.text+0xa16): undefined reference to `lf_hovered'
/usr/bin/ld: /home/khant-nyar/Documents/ctest/todos/todo.c:228:(.text+0xa24): undefined reference to `lf_mouse_button_went_down'
/usr/bin/ld: /home/khant-nyar/Documents/ctest/todos/todo.c:239:(.text+0xb00): undefined reference to `lf_rect'
/usr/bin/ld: /home/khant-nyar/Documents/ctest/todos/todo.c:243:(.text+0xb52): undefined reference to `lf_rect'
/usr/bin/ld: /home/khant-nyar/Documents/ctest/todos/todo.c:247:(.text+0xba1): undefined reference to `lf_rect'
/usr/bin/ld: /home/khant-nyar/Documents/ctest/todos/todo.c:253:(.text+0xbb3): undefined reference to `lf_set_ptr_y_absolute'
/usr/bin/ld: /home/khant-nyar/Documents/ctest/todos/todo.c:256:(.text+0xbc7): undefined reference to `lf_get_theme'
/usr/bin/ld: /home/khant-nyar/Documents/ctest/todos/todo.c:259:(.text+0xcbc): undefined reference to `lf_push_style_props'
/usr/bin/ld: /home/khant-nyar/Documents/ctest/todos/todo.c:260:(.text+0xd03): undefined reference to `_lf_image_button_loc'
/usr/bin/ld: /home/khant-nyar/Documents/ctest/todos/todo.c:264:(.text+0xd42): undefined reference to `lf_pop_style_props'
/usr/bin/ld: /home/khant-nyar/Documents/ctest/todos/todo.c:267:(.text+0xd56): undefined reference to `lf_get_theme'
/usr/bin/ld: /home/khant-nyar/Documents/ctest/todos/todo.c:270:(.text+0xe4f): undefined reference to `lf_push_style_props'
/usr/bin/ld: /home/khant-nyar/Documents/ctest/todos/todo.c:271:(.text+0xec6): undefined reference to `_lf_checkbox_loc'
/usr/bin/ld: /home/khant-nyar/Documents/ctest/todos/todo.c:274:(.text+0xeee): undefined reference to `lf_pop_style_props'
/usr/bin/ld: /home/khant-nyar/Documents/ctest/todos/todo.c:277:(.text+0xef8): undefined reference to `lf_get_ptr_x'
/usr/bin/ld: /home/khant-nyar/Documents/ctest/todos/todo.c:278:(.text+0xf15): undefined reference to `lf_text'
/usr/bin/ld: /home/khant-nyar/Documents/ctest/todos/todo.c:280:(.text+0xf24): undefined reference to `lf_set_ptr_x_absolute'
/usr/bin/ld: /home/khant-nyar/Documents/ctest/todos/todo.c:281:(.text+0xf2e): undefined reference to `lf_get_ptr_y'
/usr/bin/ld: /home/khant-nyar/Documents/ctest/todos/todo.c:281:(.text+0xf4a): undefined reference to `lf_get_theme'
/usr/bin/ld: /home/khant-nyar/Documents/ctest/todos/todo.c:281:(.text+0xf90): undefined reference to `lf_set_ptr_y_absolute'
/usr/bin/ld: /home/khant-nyar/Documents/ctest/todos/todo.c:283:(.text+0xfa4): undefined reference to `lf_get_theme'
/usr/bin/ld: /home/khant-nyar/Documents/ctest/todos/todo.c:286:(.text+0x1071): undefined reference to `lf_push_style_props'
/usr/bin/ld: /home/khant-nyar/Documents/ctest/todos/todo.c:287:(.text+0x1084): undefined reference to `lf_push_font'
/usr/bin/ld: /home/khant-nyar/Documents/ctest/todos/todo.c:288:(.text+0x1097): undefined reference to `lf_text'
/usr/bin/ld: /home/khant-nyar/Documents/ctest/todos/todo.c:289:(.text+0x10a1): undefined reference to `lf_pop_font'
/usr/bin/ld: /home/khant-nyar/Documents/ctest/todos/todo.c:290:(.text+0x10ab): undefined reference to `lf_pop_style_props'
/usr/bin/ld: /home/khant-nyar/Documents/ctest/todos/todo.c:295:(.text+0x111c): undefined reference to `lf_set_ptr_x_absolute'
/usr/bin/ld: /home/khant-nyar/Documents/ctest/todos/todo.c:296:(.text+0x1126): undefined reference to `lf_set_line_should_overflow'
/usr/bin/ld: /home/khant-nyar/Documents/ctest/todos/todo.c:298:(.text+0x113a): undefined reference to `lf_get_theme'
/usr/bin/ld: /home/khant-nyar/Documents/ctest/todos/todo.c:301:(.text+0x1227): undefined reference to `lf_push_style_props'
/usr/bin/ld: /home/khant-nyar/Documents/ctest/todos/todo.c:302:(.text+0x1259): undefined reference to `lf_set_image_color'
/usr/bin/ld: /home/khant-nyar/Documents/ctest/todos/todo.c:303:(.text+0x12a0): undefined reference to `_lf_image_button_loc'
/usr/bin/ld: /home/khant-nyar/Documents/ctest/todos/todo.c:309:(.text+0x1308): undefined reference to `lf_unset_image_color'
/usr/bin/ld: /home/khant-nyar/Documents/ctest/todos/todo.c:310:(.text+0x1312): undefined reference to `lf_set_line_should_overflow'
/usr/bin/ld: /home/khant-nyar/Documents/ctest/todos/todo.c:311:(.text+0x131c): undefined reference to `lf_pop_style_props'
/usr/bin/ld: /home/khant-nyar/Documents/ctest/todos/todo.c:314:(.text+0x1326): undefined reference to `lf_next_line'
/usr/bin/ld: /home/khant-nyar/Documents/ctest/todos/todo.c:318:(.text+0x136d): undefined reference to `lf_text'
/usr/bin/ld: /home/khant-nyar/Documents/ctest/todos/todo.c:321:(.text+0x1377): undefined reference to `lf_div_end'
/usr/bin/ld: /tmp/ccpi0RCh.o: in function `initwin':
/home/khant-nyar/Documents/ctest/todos/todo.c:327:(.text+0x13a8): undefined reference to `glfwInit'
/usr/bin/ld: /home/khant-nyar/Documents/ctest/todos/todo.c:334:(.text+0x13e1): undefined reference to `glfwCreateWindow'
/usr/bin/ld: /home/khant-nyar/Documents/ctest/todos/todo.c:335:(.text+0x13f7): undefined reference to `glfwMakeContextCurrent'
/usr/bin/ld: /home/khant-nyar/Documents/ctest/todos/todo.c:336:(.text+0x1410): undefined reference to `glfwSetFramebufferSizeCallback'
/usr/bin/ld: /home/khant-nyar/Documents/ctest/todos/todo.c:337:(.text+0x1431): undefined reference to `lf_init_glfw'
/usr/bin/ld: /tmp/ccpi0RCh.o: in function `initui':
/home/khant-nyar/Documents/ctest/todos/todo.c:343:(.text+0x1471): undefined reference to `lf_load_font'
/usr/bin/ld: /home/khant-nyar/Documents/ctest/todos/todo.c:344:(.text+0x14e3): undefined reference to `lf_load_font'
/usr/bin/ld: /home/khant-nyar/Documents/ctest/todos/todo.c:349:(.text+0x1555): undefined reference to `lf_get_theme'
/usr/bin/ld: /home/khant-nyar/Documents/ctest/todos/todo.c:351:(.text+0x1586): undefined reference to `lf_free_font'
/usr/bin/ld: /home/khant-nyar/Documents/ctest/todos/todo.c:352:(.text+0x15a4): undefined reference to `lf_load_font'
/usr/bin/ld: /home/khant-nyar/Documents/ctest/todos/todo.c:354:(.text+0x1624): undefined reference to `lf_color_brightness'
/usr/bin/ld: /home/khant-nyar/Documents/ctest/todos/todo.c:356:(.text+0x1659): undefined reference to `lf_set_theme'
/usr/bin/ld: /home/khant-nyar/Documents/ctest/todos/todo.c:367:(.text+0x16d9): undefined reference to `lf_load_texture'
/usr/bin/ld: /home/khant-nyar/Documents/ctest/todos/todo.c:368:(.text+0x170a): undefined reference to `lf_load_texture'
/usr/bin/ld: /home/khant-nyar/Documents/ctest/todos/todo.c:369:(.text+0x173b): undefined reference to `lf_load_texture'
/usr/bin/ld: /tmp/ccpi0RCh.o: in function `terminate':
/home/khant-nyar/Documents/ctest/todos/todo.c:386:(.text+0x182e): undefined reference to `lf_terminate'
/usr/bin/ld: /home/khant-nyar/Documents/ctest/todos/todo.c:389:(.text+0x183d): undefined reference to `lf_free_font'
/usr/bin/ld: /home/khant-nyar/Documents/ctest/todos/todo.c:390:(.text+0x184c): undefined reference to `lf_free_font'
/usr/bin/ld: /home/khant-nyar/Documents/ctest/todos/todo.c:394:(.text+0x186a): undefined reference to `glfwDestroyWindow'
/usr/bin/ld: /home/khant-nyar/Documents/ctest/todos/todo.c:395:(.text+0x186f): undefined reference to `glfwTerminate'
/usr/bin/ld: /tmp/ccpi0RCh.o: in function `renderdashboard':
/home/khant-nyar/Documents/ctest/todos/todo.c:400:(.text+0x188e): undefined reference to `lf_next_line'
/usr/bin/ld: /home/khant-nyar/Documents/ctest/todos/todo.c:402:(.text+0x18a2): undefined reference to `lf_next_line'
/usr/bin/ld: /tmp/ccpi0RCh.o: in function `rendernewtask':
/home/khant-nyar/Documents/ctest/todos/todo.c:409:(.text+0x18dd): undefined reference to `lf_push_font'
/usr/bin/ld: /home/khant-nyar/Documents/ctest/todos/todo.c:411:(.text+0x18f1): undefined reference to `lf_get_theme'
/usr/bin/ld: /home/khant-nyar/Documents/ctest/todos/todo.c:413:(.text+0x19a2): undefined reference to `lf_push_style_props'
/usr/bin/ld: /home/khant-nyar/Documents/ctest/todos/todo.c:414:(.text+0x19b5): undefined reference to `lf_text'
/usr/bin/ld: /home/khant-nyar/Documents/ctest/todos/todo.c:415:(.text+0x19bf): undefined reference to `lf_pop_style_props'
/usr/bin/ld: /home/khant-nyar/Documents/ctest/todos/todo.c:416:(.text+0x19c9): undefined reference to `lf_pop_font'
/usr/bin/ld: /home/khant-nyar/Documents/ctest/todos/todo.c:419:(.text+0x19d3): undefined reference to `lf_next_line'
/usr/bin/ld: /home/khant-nyar/Documents/ctest/todos/todo.c:423:(.text+0x19e2): undefined reference to `lf_push_font'
/usr/bin/ld: /home/khant-nyar/Documents/ctest/todos/todo.c:424:(.text+0x19f1): undefined reference to `lf_text'
/usr/bin/ld: /home/khant-nyar/Documents/ctest/todos/todo.c:425:(.text+0x19fb): undefined reference to `lf_pop_font'
/usr/bin/ld: /home/khant-nyar/Documents/ctest/todos/todo.c:427:(.text+0x1a05): undefined reference to `lf_next_line'
/usr/bin/ld: /home/khant-nyar/Documents/ctest/todos/todo.c:428:(.text+0x1a19): undefined reference to `lf_get_theme'
/usr/bin/ld: /home/khant-nyar/Documents/ctest/todos/todo.c:438:(.text+0x1b93): undefined reference to `lf_push_style_props'
/usr/bin/ld: /home/khant-nyar/Documents/ctest/todos/todo.c:439:(.text+0x1bb5): undefined reference to `_lf_input_text_loc'
/usr/bin/ld: /home/khant-nyar/Documents/ctest/todos/todo.c:440:(.text+0x1bbf): undefined reference to `lf_pop_style_props'
/usr/bin/ld: /home/khant-nyar/Documents/ctest/todos/todo.c:443:(.text+0x1bc9): undefined reference to `lf_next_line'
/usr/bin/ld: /home/khant-nyar/Documents/ctest/todos/todo.c:445:(.text+0x1bd3): undefined reference to `lf_next_line'
/usr/bin/ld: /home/khant-nyar/Documents/ctest/todos/todo.c:450:(.text+0x1be2): undefined reference to `lf_push_font'
/usr/bin/ld: /home/khant-nyar/Documents/ctest/todos/todo.c:451:(.text+0x1bf1): undefined reference to `lf_text'
/usr/bin/ld: /home/khant-nyar/Documents/ctest/todos/todo.c:452:(.text+0x1bfb): undefined reference to `lf_pop_font'
/usr/bin/ld: /home/khant-nyar/Documents/ctest/todos/todo.c:454:(.text+0x1c05): undefined reference to `lf_next_line'
/usr/bin/ld: /home/khant-nyar/Documents/ctest/todos/todo.c:461:(.text+0x1c19): undefined reference to `lf_get_theme'
/usr/bin/ld: /home/khant-nyar/Documents/ctest/todos/todo.c:466:(.text+0x1d0e): undefined reference to `lf_push_style_props'
/usr/bin/ld: /home/khant-nyar/Documents/ctest/todos/todo.c:467:(.text+0x1d63): undefined reference to `_lf_dropdown_menu_loc'
/usr/bin/ld: /home/khant-nyar/Documents/ctest/todos/todo.c:468:(.text+0x1d71): undefined reference to `lf_pop_style_props'
/usr/bin/ld: /home/khant-nyar/Documents/ctest/todos/todo.c:477:(.text+0x1dd5): undefined reference to `lf_get_theme'
/usr/bin/ld: /home/khant-nyar/Documents/ctest/todos/todo.c:483:(.text+0x1ef2): undefined reference to `lf_push_style_props'
/usr/bin/ld: /home/khant-nyar/Documents/ctest/todos/todo.c:484:(.text+0x1f00): undefined reference to `lf_set_line_should_overflow'
/usr/bin/ld: /home/khant-nyar/Documents/ctest/todos/todo.c:485:(.text+0x1f2a): undefined reference to `lf_get_theme'
/usr/bin/ld: /home/khant-nyar/Documents/ctest/todos/todo.c:485:(.text+0x1f66): undefined reference to `lf_set_ptr_x_absolute'
/usr/bin/ld: /home/khant-nyar/Documents/ctest/todos/todo.c:486:(.text+0x1f8b): undefined reference to `lf_button_dimension'
/usr/bin/ld: /home/khant-nyar/Documents/ctest/todos/todo.c:486:(.text+0x1fae): undefined reference to `lf_get_theme'
/usr/bin/ld: /home/khant-nyar/Documents/ctest/todos/todo.c:486:(.text+0x1feb): undefined reference to `lf_set_ptr_y_absolute'
/usr/bin/ld: /home/khant-nyar/Documents/ctest/todos/todo.c:489:(.text+0x2018): undefined reference to `_lf_button_fixed_loc'
/usr/bin/ld: /home/khant-nyar/Documents/ctest/todos/todo.c:490:(.text+0x2030): undefined reference to `lf_key_went_down'
/usr/bin/ld: /home/khant-nyar/Documents/ctest/todos/todo.c:511:(.text+0x2148): undefined reference to `lf_input_field_unselect_all'
/usr/bin/ld: /home/khant-nyar/Documents/ctest/todos/todo.c:513:(.text+0x2152): undefined reference to `lf_set_line_should_overflow'
/usr/bin/ld: /home/khant-nyar/Documents/ctest/todos/todo.c:514:(.text+0x215c): undefined reference to `lf_pop_style_props'
/usr/bin/ld: /home/khant-nyar/Documents/ctest/todos/todo.c:518:(.text+0x2166): undefined reference to `lf_next_line'
/usr/bin/ld: /home/khant-nyar/Documents/ctest/todos/todo.c:520:(.text+0x217a): undefined reference to `lf_get_theme'
/usr/bin/ld: /home/khant-nyar/Documents/ctest/todos/todo.c:528:(.text+0x227f): undefined reference to `lf_push_style_props'
/usr/bin/ld: /home/khant-nyar/Documents/ctest/todos/todo.c:529:(.text+0x228d): undefined reference to `lf_set_line_should_overflow'
/usr/bin/ld: /home/khant-nyar/Documents/ctest/todos/todo.c:531:(.text+0x2301): undefined reference to `lf_set_ptr_y_absolute'
/usr/bin/ld: /home/khant-nyar/Documents/ctest/todos/todo.c:532:(.text+0x2310): undefined reference to `lf_set_ptr_x_absolute'
/usr/bin/ld: /home/khant-nyar/Documents/ctest/todos/todo.c:534:(.text+0x2333): undefined reference to `_lf_image_button_loc'
/usr/bin/ld: /home/khant-nyar/Documents/ctest/todos/todo.c:537:(.text+0x234c): undefined reference to `lf_set_line_should_overflow'
/usr/bin/ld: /home/khant-nyar/Documents/ctest/todos/todo.c:538:(.text+0x2356): undefined reference to `lf_pop_style_props'
/usr/bin/ld: /tmp/ccpi0RCh.o: in function `main':
/home/khant-nyar/Documents/ctest/todos/todo.c:913:(.text+0x3690): undefined reference to `lf_color_to_zto'
/usr/bin/ld: /home/khant-nyar/Documents/ctest/todos/todo.c:915:(.text+0x36b1): undefined reference to `glClear'
/usr/bin/ld: /home/khant-nyar/Documents/ctest/todos/todo.c:916:(.text+0x36d5): undefined reference to `glClearColor'
/usr/bin/ld: /home/khant-nyar/Documents/ctest/todos/todo.c:918:(.text+0x36e9): undefined reference to `_lf_begin_loc'
/usr/bin/ld: /home/khant-nyar/Documents/ctest/todos/todo.c:921:(.text+0x37ab): undefined reference to `_lf_div_begin_loc'
/usr/bin/ld: /home/khant-nyar/Documents/ctest/todos/todo.c:933:(.text+0x37dd): undefined reference to `lf_div_end'
/usr/bin/ld: /home/khant-nyar/Documents/ctest/todos/todo.c:934:(.text+0x37e7): undefined reference to `lf_end'
/usr/bin/ld: /home/khant-nyar/Documents/ctest/todos/todo.c:936:(.text+0x37ec): undefined reference to `glfwPollEvents'
/usr/bin/ld: /home/khant-nyar/Documents/ctest/todos/todo.c:937:(.text+0x37fb): undefined reference to `glfwSwapBuffers'
/usr/bin/ld: /home/khant-nyar/Documents/ctest/todos/todo.c:914:(.text+0x380a): undefined reference to `glfwWindowShouldClose'
collect2: error: ld returned 1 exit status

Build finished with error(s).

 *  The terminal process failed to launch (exit code: -1). 
 *  Terminal will be reused by tasks, press any key to close it.
brmarkus commented 1 month ago

Can you describe what you did, please? Have you tried to use the pre-built executable?

What does the listing of linker errors show?

Have you used the setup.sh script?

Have you created your own makefile? The Makefile of this project contains the needed libraries to link: LIBS=-lglfw -lleif -lclipboard -lm -lGL -lxcb.

Khant-Nyar commented 1 month ago

Can you describe what you did, please? Have you tried to use the pre-built executable?

What does the listing of linker errors show?

Have you used the setup.sh script?

Have you created your own makefile? The Makefile of this project contains the needed libraries to link: LIBS=-lglfw -lleif -lclipboard -lm -lGL -lxcb.

i did sudo ./setup.sh some of the lib can't install and script exist so i manually install in the code of Makefile then i run with vscode debuger see that msg .test base in can use but gui can't open with that bufferoverflow

here is vs-code runner file

{
    "tasks": [
        {
            "type": "cppbuild",
            "label": "C/C++: gcc build active file",
            "command": "/usr/bin/gcc",
            "args": [
                "-fdiagnostics-color=always",
                "-g",
                "${file}",
                "-o",
                "${fileDirname}/${fileBasenameNoExtension}"
            ],
            "options": {
                "cwd": "${fileDirname}"
            },
            "problemMatcher": [
                "$gcc"
            ],
            "group": {
                "kind": "build",
                "isDefault": true
            },
            "detail": "Task generated by Debugger."
        }
    ],
    "version": "2.0.0"
}
PerHac13 commented 1 month ago

Yep i tried to resolve this issue but got nowhere While i setup new machinne on arch where it working fine

I conclude in my personal opinion that it causing some linking issue by lief in ubuntu machine if you figure it out share a short summary how you fix this? I will appreciate it

Khant-Nyar commented 1 month ago

Yep i tried to resolve this issue but got nowhere While i setup new machinne on arch where it working fine

I conclude in my personal opinion that it causing some linking issue by lief in ubuntu machine if you figure it out share a short summary how you fix this? I will appreciate it

it seen like lclipboard depend on xcb but i link to run with -lxcb it don't show error in compile but can't open the output file it show buffer overflow detected : terminated [1] 456562 IOT instruction (core dumped) ./output