vurtun / nuklear

A single-header ANSI C gui library
13.69k stars 1.11k forks source link

simple build instructions #508

Open PaluMacil opened 7 years ago

PaluMacil commented 7 years ago

With all the people using the library, I'm sure it builds just fine for people who use C and MakeFiles frequently, but for those of us who use other languages, could you make some explicit instructions for running make? I read up on make and tried make all on the example but got the following error:

C:\Source\c\nuklear\example [master ≡ +1 ~0 -0 !]> make all
cc -std=c99 -pedantic -O2 -o bin/file_browser file_browser.c -lglfw3 -lopengl32 -lm -lGLU32 -lGLEW32
process_begin: CreateProcess(NULL, cc -std=c99 -pedantic -O2 -o bin/file_browser file_browser.c -lglfw3 -lopengl32 -lm -
lGLU32 -lGLEW32, ...) failed.
make (e=2): The system cannot find the file specified.
make: *** [file_browser] Error 2

Do I need to have certain system env variables set? Additional commandline flags to make? Do I need to clone additional libraries into my gcc's library folder?

My go env and gcc version follow:

C:\Source\c\nuklear\example [master ≡ +1 ~0 -0 !]> go env
set GOARCH=amd64
set GOBIN=C:\Source\Go\bin
set GOEXE=.exe
set GOHOSTARCH=amd64
set GOHOSTOS=windows
set GOOS=windows
set GOPATH=C:\Source\Go
set GORACE=
set GOROOT=C:\Go
set GOTOOLDIR=C:\Go\pkg\tool\windows_amd64
set GCCGO=gccgo
set CC=gcc
set GOGCCFLAGS=-m64 -mthreads -fmessage-length=0 -fdebug-prefix-map=C:\Users\dcwol\AppData\Local\Temp\go-build480049127=/t
mp/go-build -gno-record-gcc-switches
set CXX=g++
set CGO_ENABLED=1
set PKG_CONFIG=pkg-config
set CGO_CFLAGS=-g -O2
set CGO_CPPFLAGS=
set CGO_CXXFLAGS=-g -O2
set CGO_FFLAGS=-g -O2
set CGO_LDFLAGS=-g -O2
C:\Source\c\nuklear\example [master ≡ +1 ~0 -0 !]> gcc -v
Using built-in specs.
COLLECT_GCC=C:\Program Files\mingw-w64\x86_64-7.1.0-posix-seh-rt_v5-rev0\mingw64\bin\gcc.exe
COLLECT_LTO_WRAPPER=C:/Program\ Files/mingw-w64/x86_64-7.1.0-posix-seh-rt_v5-rev0/mingw64/bin/../libexec/gcc/x86_64-w64-mi
ngw32/7.1.0/lto-wrapper.exe
Target: x86_64-w64-mingw32
Configured with: ../../../src/gcc-7.1.0/configure --host=x86_64-w64-mingw32 --build=x86_64-w64-mingw32 --target=x86_64-w64
-mingw32 --prefix=/mingw64 --with-sysroot=/c/mingw710/x86_64-710-posix-seh-rt_v5-rev0/mingw64 --enable-shared --enable-sta
tic --disable-multilib --enable-languages=c,c++,fortran,lto --enable-libstdcxx-time=yes --enable-threads=posix --enable-li
bgomp --enable-libatomic --enable-lto --enable-graphite --enable-checking=release --enable-fully-dynamic-string --enable-v
ersion-specific-runtime-libs --enable-libstdcxx-filesystem-ts=yes --disable-libstdcxx-pch --disable-libstdcxx-debug --enab
le-bootstrap --disable-rpath --disable-win32-registry --disable-nls --disable-werror --disable-symvers --with-gnu-as --wit
h-gnu-ld --with-arch=nocona --with-tune=core2 --with-libiconv --with-system-zlib --with-gmp=/c/mingw710/prerequisites/x86_
64-w64-mingw32-static --with-mpfr=/c/mingw710/prerequisites/x86_64-w64-mingw32-static --with-mpc=/c/mingw710/prerequisites
/x86_64-w64-mingw32-static --with-isl=/c/mingw710/prerequisites/x86_64-w64-mingw32-static --with-pkgversion='x86_64-posix-
seh-rev0, Built by MinGW-W64 project' --with-bugurl=http://sourceforge.net/projects/mingw-w64 CFLAGS='-O2 -pipe -fno-ident
 -I/c/mingw710/x86_64-710-posix-seh-rt_v5-rev0/mingw64/opt/include -I/c/mingw710/prerequisites/x86_64-zlib-static/include
-I/c/mingw710/prerequisites/x86_64-w64-mingw32-static/include' CXXFLAGS='-O2 -pipe -fno-ident -I/c/mingw710/x86_64-710-pos
ix-seh-rt_v5-rev0/mingw64/opt/include -I/c/mingw710/prerequisites/x86_64-zlib-static/include -I/c/mingw710/prerequisites/x
86_64-w64-mingw32-static/include' CPPFLAGS=' -I/c/mingw710/x86_64-710-posix-seh-rt_v5-rev0/mingw64/opt/include -I/c/mingw7
10/prerequisites/x86_64-zlib-static/include -I/c/mingw710/prerequisites/x86_64-w64-mingw32-static/include' LDFLAGS='-pipe
-fno-ident -L/c/mingw710/x86_64-710-posix-seh-rt_v5-rev0/mingw64/opt/lib -L/c/mingw710/prerequisites/x86_64-zlib-static/li
b -L/c/mingw710/prerequisites/x86_64-w64-mingw32-static/lib '
Thread model: posix
gcc version 7.1.0 (x86_64-posix-seh-rev0, Built by MinGW-W64 project)

Thanks!

felipetesc commented 6 years ago

Hello there. It passed some time since You have asked this question, however I decided to write what I have done. To begin I need to make some assumptions, you have written "C:\Source\c\nuklear\example" above so You are using Windows. You have typed "make all", and you asked if You need to add gcc to the system variables, so I'm guessing you want to use gnu tool chain on Windows. What I have done is, first I installed msys2/mingw64. After installing and downloading the all the needed libs using Msys2 terminal, with the command pacman -S "library_name" (to search for a specific lib you can use the command pacman -Ss "the_name_of_the_name"). It's far more easy than setting up Windows and it works. By simply navigating to the folder where the examples are (nuklear/example) I typed make, and it builded for me all the examples. ps: You will need to install several libraries in order to msys2/ming terminal, and if the command make fails, it gives some tips about the missing libs

PaluMacil commented 6 years ago

@felipetesc Thanks for the reply. I appreciate the thoughts and advice.

I'd prefer not to use MSYS2 since I already have 8 versions of mingw-w64 and 2 of TDM on Windows for the different projects I've compiled (a ratio of one compiler for each C project I've looked at), but since developing C on Windows is supposed to be an exercise in annoyance, I suppose I might not have much choice. Using the toolchain outside MSYS2 is still my preference since I feel I'd learn more by figuring out how it works, but I'll see if I can revisit this soon. I don't recall what I was going to use the library for, but if I can figure out a good approach and make a PR to documentation, it might help others on Windows. I actually do very much enjoy Linux and should be able to use MSYS2 comfortably if that's the only route that works for me after my next attempt.