Linking failure, -lglfw missing

I tried my best to follow official documentation and failed. So this isn’t my lazyness, I am seriously struggling.

I am trying to install GLFW 3.4 because it has wayland support. I use debian and it only supplies GLFW 3.3 so I need to compile my own. (I tried the package called glfw-wayland but that didn’t go well as my window didn’t even open.)

I got the glfw-3.4.zip, extracted the contents to ./glfw-3.4
then I ran cmake -S . -B ./build -D GLFW_BUILD_X11=0
this should generate the makefiles for glfw in the directory ./glfw-3.4/build. Finally I ran cd build and make to compile. No errors appeared.
I open the directory and there was nothing inside, I was expecting something like glfw.dll or glfw.lib to appear but there was nothing.

To see if it was placed in the regular path I just needed it compile my project. The documentation asked me to add -I./glfw-3.4/include/ this piece of code for the header file, it worked fine. I now I am left at the part where it says /usr/bin/ld: cannot find -lglfw: No such file or directory

Now there is two options, either the compilation failed or the library is at an unknown location. Either way there official documentation doesn’t tell me how to proceed.

UPDATE 1:

Someone told me to use sudo make install that indeed was a good idea and now I get

gcc -std=c17 -Wall -Wextra -Wpedantic -Wconversion -Warith-conversion -g -o vtest real.c -I/usr/local/include -L/usr/local/lib -lglfw3 -lvulkan -ldl -lpthread -lX11 -lXxf86vm -lXrandr -lXi
/usr/bin/ld: /usr/local/lib/libglfw3.a(x11_monitor.c.o): undefined reference to symbol 'round@@GLIBC_2.2.5'
/usr/bin/ld: /lib/x86_64-linux-gnu/libm.so.6: error adding symbols: DSO missing from command line

I wonder why it’s so broken

Building applications on Linux systems with make can be a bit of a pain, I would recommend taking a look at either using pkg-config as per our build guide or using CMake like in this GLFW CMake Starter.

I fixed it, -lm flag was needed after -glfw3 not before. I am writing this incase it helps someone in the future.