devaskim
devaskim

Reputation: 559

Wrong version of GLIBC on Oracle Linux 8

I need to rebuild patched version of rocksaw library. Here is the source code on Github.

On Ubuntu 22 both build process and test program run as expected. The problem occurs on Oracle Linux 8, I got the following error after successful build ON THE SAME MACHINE:

[root@localhost lib]# ldd librocksaw.so
./librocksaw.so: /lib64/libc.so.6: version `GLIBC_2.34' not found (required by ./librocksaw.so)
        linux-vdso.so.1 (0x00007ffd686b5000)
        libc.so.6 => /lib64/libc.so.6 (0x00007f4522793000)
        /lib64/ld-linux-x86-64.so.2 (0x00007f4522b58000)

The installed version of Glib is 2.28

[root@localhost lib]# ldd --version
ldd (GNU libc) 2.28

Here is Makefile

UNAME  := $(shell uname)
CYGWIN := $(findstring CYGWIN,$(UNAME))
DARWIN := $(findstring Darwin,$(UNAME))

CC       = gcc
SHARED   = -shared
CFLAGS   = -Wall -O2 -pipe -D_REENTRANT
WINSOCK  = ws2_32
EXTRA_LDFLAGS  =
EXTRA_CPPFLAGS =
LDFLAGS  = $(EXTRA_LDFLAGS)
CPPFLAGS = $(EXTRA_CPPFLAGS)
LIBNAME  = librocksaw
LIBEXTENSION = so

ifeq ($(DARWIN),Darwin)
  JAVA_INCDIR  = $(JAVA_HOME)/include
  LIBEXTENSION = jnilib
  CPPFLAGS += -I$(JAVA_INCDIR)
  LDFLAGS += -dynamiclib -noprebind -single_module -framework JavaVM
  SHARED =
else
  ifeq ($(CYGWIN),CYGWIN)
    override CC += -mno-cygwin
    CPPFLAGS += -D__int64="long long"
    LDFLAGS += -Wl,--kill-at -l$(WINSOCK)
    JDK_HOME := $(shell cygpath $(JDK_HOME))
    LIBNAME      = rocksaw
    LIBEXTENSION = dll
  endif

  JAVA_INCDIR      = $(JDK_HOME)/include
  JAVA_INCDIR_PLAF = $(dir $(wildcard $(JAVA_INCDIR)/*/jni_md.h))
  CPPFLAGS += -I$(JAVA_INCDIR) -I$(JAVA_INCDIR_PLAF)
  CFLAGS += -ansi -pthread -fPIC -DPIC
endif

SRC := $(shell find . -name "*.cpp" -print)
OBJ := $(SRC:%.cpp=%.o)

CLEAN_EXTENSIONS = o $(LIBEXTENSION)

LIBROCKSAW = $(LIBNAME).$(LIBEXTENSION)

all: $(LIBROCKSAW)

%.o: %.cpp
    $(CC) $(CFLAGS) $(CPPFLAGS) -c $< -o $@

$(LIBROCKSAW): $(OBJ)
    $(CC) $(SHARED) -o $@ $^ $(LDFLAGS)

clean:
    for extension in $(CLEAN_EXTENSIONS); do \
        find . -name "*.$$extension" | xargs rm -f ; \
    done
    find . -name "*~" | xargs rm -f

I don't understand who and when links another version of Glib during the build. Maybe it somehow relates to Java because this library includes both java and native build artifacts, doesn't it?

Any thoughts?

Upvotes: 0

Views: 1088

Answers (1)

Employed Russian
Employed Russian

Reputation: 213879

The problem occurs on Oracle Linux 8, I got the following error after successful build ON THE SAME MACHINE:

It's likely that you didn't build this librocksaw.so on the same Oracle Linux 8 machine -- possibly you copied objects from another machine, and didn't do make clean to actually rebuild the library.

To see which actual libc.so.6 you used at link time, you can add -Wl,-t to the link line and re-link librocksaw.so. If this shows that you used the system libc.so.6, then this librocksaw.so will work.

If you have another copy of libc.so.6 somewhere else, remove that copy -- it's shouldn't be on the Oracle Linux machine in the first place.

I don't understand who and when links another version of Glib during the build.

The glib and GLIBC are completely separate projects, the former has nothing to do with your problem.

Upvotes: 1

Related Questions