Jorge González
Jorge González

Reputation: 31

Error trying to install glibc in WSL: relocation R_X86_64_PC32 against undefined symbol `__GI___open64_nocancel'

When trying to install the latest glibc into my machine provided I executed the "config" executable with flags: ../configure CFLAGS="-O3 -fPIC" --disable-sanity-checks it generates the makefile correctly, although I think disable-sanity-checks will give some errors.

But whenever I try to execute the generated Makefile using make, the console prints the following error:

make[3]: Leaving directory '/mnt/c/Users/SCP173/Downloads/Thread/glib/glibc/elf'
gcc   -nostdlib -nostartfiles -shared -o /mnt/c/Users/SCP173/Downloads/Thread/glib/glibc/glibc-build/elf/ld.so.new                                                                                                \
          -Wl,-z,combreloc -Wl,-z,relro -Wl,--hash-style=both -Wl,-z,defs       \
          /mnt/c/Users/SCP173/Downloads/Thread/glib/glibc/glibc-build/elf/librtld.os -Wl,--version-script=/mnt/c/Users/SCP173/Downloads/Thread/glib/glibc/glibc-build/ld.map
\
          -Wl,-soname=ld-linux-x86-64.so.2                      \
          -Wl,-defsym=_begin=0
/mnt/c/Users/SCP173/Downloads/Thread/glib/glibc/glibc-build/elf/librtld.os: In function `process_envvars':
/mnt/c/Users/SCP173/Downloads/Thread/glib/glibc/elf/rtld.c:2686: undefined reference to `__GI___open64_nocancel'
/usr/bin/ld: /mnt/c/Users/SCP173/Downloads/Thread/glib/glibc/glibc-build/elf/librtld.os: relocation R_X86_64_PC32 against undefined symbol `__GI___open64_nocancel' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: final link failed: Bad value
collect2: error: ld returned 1 exit status

As I said, I tried to add the -fPIC flag but still didn't catch it. And I'm kind of new to .os, .map and other extensions such as those. Am I doing it completely wrong? Or else, how could I compile just that file using gcc instead of passing the flag to the whole make command?

Upvotes: 3

Views: 1943

Answers (1)

Florian Weimer
Florian Weimer

Reputation: 33719

Your file system is not set up correctly. By default, NTFS is case-preserving, but case-insensitive. As far as I understand it, current versions of WSL set up only part of the file system tree in case-sensitive mode. (A previous system-wide configuration is now disregarded.)

Building glibc requires a case-sensitive file system. Please also note that WSL is not a proper development environment for glibc because there are so many test failures due to bugs in the WSL kernel emulation.

Upvotes: 1

Related Questions