guillaumechereau / goxel

Goxel: Free and Open Source 3D Voxel Editor
GNU General Public License v3.0
2.8k stars 223 forks source link

"strncpy specified bound 1024 equals destination size" on Fedora #139

Closed 0xADD1E closed 5 years ago

0xADD1E commented 5 years ago

Out of the box, doesn't build on fedora 29 (gcc 8.3.1)

This appears to be related to GCC's handling of -O[3|fast] flags, and can be semi-solved by commenting out lines 63-65 of SConstruct (additional flags to be used in release mode)

Minimal reproduce Dockerfile:

FROM fedora:29
RUN dnf install -y gcc git
RUN dnf install -y scons pkg-config glfw-devel gtk3-devel
RUN git clone https://github.com/guillaumechereau/goxel.git
WORKDIR goxel
RUN make release
CMD bash
guillaumechereau commented 5 years ago

Should be fixed now, thanks. There might be some similar errors though. Please let me know if I can close this bug.

0xADD1E commented 5 years ago

This seems to work great! Thank you!

0xADD1E commented 5 years ago

It appears I spoke too soon. It worked on my local machine but not in the dockerfile. I'm seeing if I can apply similar fixes in https://github.com/0xADD1E/goxel

guillaumechereau commented 5 years ago

I think I will replace most of the strncpy with snprintf, since it's quite easy to make mistake with the former.

swedneck commented 5 years ago

I am affected by this as well, on fedora 29. cycles=0 werror=0 debug=0 seems to fix it.

guillaumechereau commented 5 years ago

@swedneck: this is with the current master branch?

swedneck commented 5 years ago

@guillaumechereau yes, although my error has different numbers:

In file included from src/imgui.cpp:36:
In function ‘void ImStrncpy(char*, const char*, size_t)’,
    inlined from ‘void ImStrncpy(char*, const char*, size_t)’ at src/../ext_src/imgui/imgui.cpp:1017:6,
    inlined from ‘ImGuiTextFilter::ImGuiTextFilter(const char*)’ at src/../ext_src/imgui/imgui.cpp:1656:18:
src/../ext_src/imgui/imgui.cpp:1020:12: error: ‘char* strncpy(char*, const char*, size_t)’ specified bound 256 equals destination size [-Werror=stringop-truncation]
     strncpy(dst, src, count);
     ~~~~~~~^~~~~~~~~~~~~~~~~
In function ‘void ImStrncpy(char*, const char*, size_t)’,
    inlined from ‘bool ImGui::SetDragDropPayload(const char*, const void*, size_t, ImGuiCond)’ at src/../ext_src/imgui/imgui.cpp:1017:6:
src/../ext_src/imgui/imgui.cpp:1020:12: error: ‘char* strncpy(char*, const char*, size_t)’ specified bound 33 equals destination size [-Werror=stringop-truncation]
     strncpy(dst, src, count);
     ~~~~~~~^~~~~~~~~~~~~~~~~
cc1plus: all warnings being treated as errors
scons: *** [src/imgui.o] Error 1
scons: building terminated because of errors.
make: *** [Makefile:8: release] Error 2
guillaumechereau commented 5 years ago

Hi @swedneck, I pushed a small potential fix for this. If you have time could you tell me if the compilation works now?

Cheers.

swedneck commented 5 years ago

@guillaumechereau It works fine now, thanks!