Closed domsson closed 2 years ago
Hi @domsson, Interesting. I hadn't tested my wsServer on such old systems yet. That said, I took the opportunity to compile on an Ubuntu 4.10 (glibc 2.3.2) and see what happened.
I found 2 problems:
a) GCC (v3.3.4) did not recognize "-Wextra"
b) undefined reference to 'clock_gettime'
<<< your problem here
and you're right, the fix for this is actually appending '-lrt
', but not to the main Makefile, but to the file/project you want to use. For the 'echo' example, you can append '-lrt
' to the end of the LIB line:
--- examples/echo/Makefile 2022-04-26 14:46:02.708744936 -0300
+++ examples/echo/Makefile.new 2022-04-26 14:46:31.271402752 -0300
@@ -18,7 +18,7 @@
INCLUDE = -I $(WSDIR)/include
CFLAGS = -Wall -O2
CFLAGS += $(INCLUDE) -std=c99 -pthread -pedantic
-LIB = $(WSDIR)/libws.a
+LIB = $(WSDIR)/libws.a -lrt
# Check if verbose examples
ifeq ($(VERBOSE_EXAMPLES), no)
(this also makes me realize that I should rename 'LIB
' to 'LDLIBS
')
However, I would like to avoid adding '-lrt
' to the project, as the Windows, FreeBSD and MacOS builds also work fine without it. Also, this might suggest that wsServer really needs something other than libc and pthreads.
Maybe a check like this fits in the CMakeLists.txt, since my Makefile is more or less Linux-oriented and CMake for maximum portability.
PS: You made my day with your history change in '... but it really isn't that important.' 😂
Don't worry about that. It is with feedback from other users that I can improve this project and know where I should head my efforts.
Thank you for your swift feedback! I'm going to put that to the test today and update here accordingly.
That fixed it!
However, I would like to avoid adding '-lrt' to the project, as the Windows, FreeBSD and MacOS builds also work fine without it. Also, this might suggest that wsServer really needs something other than libc and pthreads.
Completely fine by me. I'll simply adjust the files for the few old machines I have to cater to. Hopefully they'll be updated to a more recent OS in the not too far future. Cheers!
I'm trying to compile wsServer on a somewhat dated server running CentOS and am getting this error when using
make
:My research shows that older glibc versions need the
-lrt
flag for linking but I have to admit that I'm not too good with Makefiles and I wasn't quite sure where it should go in there. Any hints would be appreciated, but it really isn't that important.Here is some info on the machine: