-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Closed
Description
Describe the bug
Compiling and linking zstd on an old Linux system such as CentOS 6 gives the following error when running make:
LINK obj/conf_aec26574c336b900571a5deec4052692/zstd
obj/conf_aec26574c336b900571a5deec4052692/timefn.o: In function `UTIL_getTime':
timefn.c:(.text+0x5e): undefined reference to `clock_gettime'
obj/conf_aec26574c336b900571a5deec4052692/timefn.o: In function `UTIL_clockSpanNano':
timefn.c:(.text+0xb2): undefined reference to `clock_gettime'
obj/conf_aec26574c336b900571a5deec4052692/timefn.o: In function `UTIL_clockSpanMicro':
timefn.c:(.text+0x112): undefined reference to `clock_gettime'
obj/conf_aec26574c336b900571a5deec4052692/timefn.o: In function `UTIL_waitForNextTick':
timefn.c:(.text+0x190): undefined reference to `clock_gettime'
timefn.c:(.text+0x1ca): undefined reference to `clock_gettime'
collect2: ld returned 1 exit status
make[2]: *** [obj/conf_aec26574c336b900571a5deec4052692/zstd] Error 1
make[1]: *** [zstd] Error 2
make[1]: Leaving directory `zstd-1.5.4/programs'
make: *** [zstd-release] Error 2
To Reproduce
Steps to reproduce the behavior:
- Download zstd-1.5.4.tar.gz on CentOS 6
- Extract with
tar xf zstd-1.5.4.tar.gz - cd into zstd-1.5.4 directory: cd zstd-1.5.4
- Run
make - See error
Expected behavior
zstd build process should complete without errors
Desktop (please complete the following information):
- OS: CentOS
- Version 6
- Compiler: gcc version 4.4.7 20120313 (Red Hat 4.4.7-23) (GCC)
- Build system: make --version = GNU Make 3.81
The fix:
In zstd-1.5.4/programs directory I patched Makefile like this:
--- Makefile.orig 2023-02-10 01:41:50.000000000 +0100
+++ Makefile 2023-03-17 18:46:15.742527719 +0100
@@ -159,7 +159,7 @@
@echo "$(LZMA_MSG)"
@echo "$(LZ4_MSG)"
@echo LINK $@
- $(CC) $(FLAGS) $^ $(LDLIBS) -o $@$(EXT)
+ $(CC) $(FLAGS) $^ $(LDLIBS) -lrt -o $@$(EXT)
ifeq ($(HAVE_HASH),1)
SRCBIN_HASH = $(shell cat $(BUILD_DIR)/zstd$(EXT) 2> $(VOID) | $(HASH) | cut -f 1 -d " ")
Metadata
Metadata
Assignees
Labels
No labels