make curl with different glibc version: unresolved GLIBC_PRIVATE [duplicate] - gcc

This question already has answers here:
Multiple glibc libraries on a single host
(11 answers)
Closed 7 years ago.
The distribution glibc version is 2.11.3. I compiled the version 2.22 into /usr/glibc/.
Running make for a new curl version 7.46 I receive this errors:
/usr/glibc/lib/libpthread.so.0: undefined reference to `__mktemp#GLIBC_PRIVATE'
/usr/glibc/lib/libpthread.so.0: undefined reference to `__tfind#GLIBC_PRIVATE'
/usr/glibc/lib/libpthread.so.0: undefined reference to `__tdelete#GLIBC_PRIVATE'
/usr/glibc/lib/libpthread.so.0: undefined reference to `__twalk#GLIBC_PRIVATE'
/usr/glibc/lib/libpthread.so.0: undefined reference to `__call_tls_dtors#GLIBC_PRIVATE'
/usr/glibc/lib/libpthread.so.0: undefined reference to `__madvise#GLIBC_PRIVATE'
/usr/glibc/lib/libpthread.so.0: undefined reference to `memcpy#GLIBC_2.14'
/usr/glibc/lib/libpthread.so.0: undefined reference to `__getrlimit#GLIBC_PRIVATE'
/usr/glibc/lib/libresolv.so.2: undefined reference to `__sendmmsg#GLIBC_PRIVATE'
/usr/glibc/lib/libpthread.so.0: undefined reference to `__ctype_init#GLIBC_PRIVATE'
/usr/glibc/lib/libpthread.so.0: undefined reference to `__h_errno#GLIBC_PRIVATE'
/usr/glibc/lib/libpthread.so.0: undefined reference to `__tsearch#GLIBC_PRIVATE'
/usr/glibc/lib/libpthread.so.0: undefined reference to `__libc_vfork#GLIBC_PRIVATE'
I am convinced it must be a problem because of the new glibc version but my linux knowledge is too weak to provide the correct path to the new glibc version.
What am I doing wrong? Thx!

There were several issues:
glibc 2.22 - distribution version is 2.11.3
openssl 1.0.2f - distribution version is 0.9.8j [from 2009!]
curl 7.46.0 - distribution version is 7.19.7
libmemcached with active sasl version from distribution
I am using all these libraries in my CUDA project and due the fact I wanted to update all these libraries to the newest version these steps were to do:
glibc: build into /usr/glibc
openssl: build into /usr/glibc/openssl-curl/. Before run export $LDFLAGS=-L/usr/glibc/lib
curl: run ./configure --prefix=/usr/glibc/openssl-curl/ --with-ssl=/usr/glibc/openssl-curl/ --disable-ldap - very important: $LDFLAGS must be empty when running configure because the script adds the value to $LD_LIBRARY_PATH and due the version mismatch of the new glibc and the distribution version all programs crash with segmentation fault. Before make run again export $LDFLAGS=-L/usr/glibc/lib.
For my project I had also to rebuild libmemcached with the new glibc version with this command: ./configure --prefix=/usr/local/libmemcached --disable-sasl
In CUDA I have to set the path to the new libraries and now all works. It is also very important the linker options -Wl,--rpath=/usr/glibc/lib and -Wl,--dynamic-linker=/usr/glibc/lib/ld-linux-x86-64.so.2 are set in order the new glibc version is loaded.
For my linux system I must not add in /etc/ld.so.conf the path /usr/glibc/lib otherwise the whole system crashes.

Related

MSYS2 + mingw refuses to compile 64-bit vim for Windows

I was following the guide in https://github.com/vim/vim/blob/master/src/INSTALLpc.txt
(Section 2 - Msys2 with MinGW)
I've installed msys2 and ran it through the mingw64 file in the msys64 directory, installed all dependencies, etc. I got until 2.4
2.4.
I navigated to the SRC folder of the vim 8.1 installation and ran the command, but I got this error when I run make -f Make_ming.mak GUI=no
$ make -f Make_ming.mak
g++ -I. -Iproto - ..[omitted].. -luuid
C:/tools/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.3.0/../../../../x86_64-w64-mingw32/bin/ld.exe: gobjx86-64/buffer.o:buffer.c:(.text+0xf01): undefined reference to `python3_buffer_free'
C:/tools/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.3.0/../../../../x86_64-w64-mingw32/bin/ld.exe: gobjx86-64/eval.o:eval.c:(.text+0xea4): undefined reference to `set_ref_in_python3'
C:/tools/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.3.0/../../../../x86_64-w64-mingw32/bin/ld.exe: gobjx86-64/evalfunc.o:evalfunc.c:(.text+0x4505): undefined reference to `python3_enabled'
C:/tools/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.3.0/../../../../x86_64-w64-mingw32/bin/ld.exe: gobjx86-64/evalfunc.o:evalfunc.c:(.text+0x6990): undefined reference to `do_py3eval'
C:/tools/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.3.0/../../../../x86_64-w64-mingw32/bin/ld.exe: gobjx86-64/evalfunc.o:evalfunc.c:(.text+0x7bd2): undefined reference to `do_py3eval'
C:/tools/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.3.0/../../../../x86_64-w64-mingw32/bin/ld.exe: gobjx86-64/ex_cmds2.o:ex_cmds2.c:(.text+0x277d): undefined reference to `ex_py3file'
C:/tools/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.3.0/../../../../x86_64-w64-mingw32/bin/ld.exe: gobjx86-64/ex_cmds2.o:ex_cmds2.c:(.text+0x2891): undefined reference to `ex_py3'
C:/tools/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.3.0/../../../../x86_64-w64-mingw32/bin/ld.exe: gobjx86-64/ex_cmds2.o:ex_cmds2.c:(.text+0x28a1): undefined reference to `ex_py3do'
C:/tools/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.3.0/../../../../x86_64-w64-mingw32/bin/ld.exe: gobjx86-64/ex_docmd.o:ex_docmd.c:(.rdata+0x4fa8): undefined reference to `ex_py3'
C:/tools/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.3.0/../../../../x86_64-w64-mingw32/bin/ld.exe: gobjx86-64/ex_docmd.o:ex_docmd.c:(.rdata+0x4fc8): undefined reference to `ex_py3do'
C:/tools/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.3.0/../../../../x86_64-w64-mingw32/bin/ld.exe: gobjx86-64/ex_docmd.o:ex_docmd.c:(.rdata+0x4fe8): undefined reference to `ex_py3'
C:/tools/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.3.0/../../../../x86_64-w64-mingw32/bin/ld.exe: gobjx86-64/ex_docmd.o:ex_docmd.c:(.rdata+0x5008): undefined reference to `ex_py3file'
C:/tools/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.3.0/../../../../x86_64-w64-mingw32/bin/ld.exe: gobjx86-64/main.o:main.c:(.text+0x2785): undefined reference to `python3_end'
C:/tools/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.3.0/../../../../x86_64-w64-mingw32/bin/ld.exe: gobjx86-64/window.o:window.c:(.text+0x569a): undefined reference to `python3_window_free'
C:/tools/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.3.0/../../../../x86_64-w64-mingw32/bin/ld.exe: gobjx86-64/window.o:window.c:(.text+0x6117): undefined reference to `python3_tabpage_free'
collect2.exe: error: ld returned 1 exit status
make: *** [Make_cyg_ming.mak:1042: gvim.exe] Error 1
I am slowly losing my mind, I've spent 3 days trying to get this to compile. I've also tried approaches with windows-native mingw32 (chocolatey), tried cross-compiling from WSL ubuntu, compiling inside of msys2 instead of mingw64 terminal.. The purpose of this is to eventually compile a specific version of vim (8.1) with a specific version of python (3.7).
Here is what is installed on my msys:
$ pacman -Qqe
base
base-devel
filesystem
mingw-w64-x86_64-binutils
mingw-w64-x86_64-crt-git
mingw-w64-x86_64-gcc
mingw-w64-x86_64-gcc-ada
mingw-w64-x86_64-gcc-fortran
mingw-w64-x86_64-gcc-libgfortran
mingw-w64-x86_64-gcc-libs
mingw-w64-x86_64-gcc-objc
mingw-w64-x86_64-gdb
mingw-w64-x86_64-gdb-multiarch
mingw-w64-x86_64-headers-git
mingw-w64-x86_64-libgccjit
mingw-w64-x86_64-libmangle-git
mingw-w64-x86_64-libwinpthread-git
mingw-w64-x86_64-make
mingw-w64-x86_64-pkgconf
mingw-w64-x86_64-tools-git
mingw-w64-x86_64-winpthreads-git
mingw-w64-x86_64-winstorecompat-git
msys2-runtime
and the locations/versions of my compilers
C:\tools\msys64\mingw64\bin\mingw32-make.exe
C:\tools\msys64\mingw64\bin\gcc.exe
C:\tools\msys64\mingw64\bin\g++.exe
I most often refuse to request help unless I am extremely desperate and out of options, so I apologize if this question was written poorly or difficult to understand.
It seems that in Python 3.9, _Py_DEC_REFTOTAL was removed completely without any substitute. Thread (redhat.com). It will not build certain versions of vim. I installed Python3.6 through chocolatey, and everything compiled and linked perfectly.
For future reference, first install a version of python3 that works
(choco install python --version=3.6.7)
then use this in mingw64 shell in src folder of vim:
> mingw32-make -f Make_ming.mak PYTHON3=C:/Python36
PYTHON3_HOME=C:/Python36 PYTHON3INC=-IC:/Python36/include DYNAMIC_PYTHON3=yes
PYTHON3_VER=36 DYNAMIC_PYTHON3_DLL=libpython36.dll
STATIC_STDCPLUS=yes

Compilation error: Undefined reference to

I'm working on a C program for getting events from Udev. The program has been compiled and tested on a host running Debian (With GCC 4.7.2-5).
Recently, switched to Ubuntu 12.04 LTS (With GCC 4.6.3). The same program fails to compile and halts during the linking phase.
automounter_main.c:(.text+0xd4e): undefined reference to `udev_new'
automounter_main.c:(.text+0xe02): undefined reference to `udev_device_new_from_devnum'
automounter_main.c:(.text+0xeb0): undefined reference to `udev_device_new_from_syspath'
automounter_main.c:(.text+0xf63): undefined reference to `udev_device_get_sysattr_list_entry'
automounter_main.c:(.text+0xf77): undefined reference to `udev_list_entry_get_name'
automounter_main.c:(.text+0xf85): undefined reference to `udev_device_get_sysattr_value'
automounter_main.c:(.text+0x100a): undefined reference to `udev_device_get_sysattr_value'
automounter_main.c:(.text+0x1055): undefined reference to `udev_device_get_sysattr_value'
automounter_main.c:(.text+0x1078): undefined reference to `udev_list_entry_get_next'
automounter_main.c:(.text+0x108c): undefined reference to `udev_device_get_parent'
automounter_main.c:(.text+0x1118): undefined reference to `udev_device_unref'
automounter_main.c:(.text+0x1122): undefined reference to `udev_unref'
The following steps were taken, but nothing seems to work.
Install all packages related to udev (udev, libudev-dev, libudev0). All the packages are reported to be the latest.
Create a Symlink in /usr/lib pointing the correct udev library.
Upgraded libc package
Symlink was verified using:
$ ls -l libudev*
lrwxrwxrwx 1 root root 39 Nov 27 15:57 libudev.so -> /lib/x86_64-linux-gnu/libudev.so.0.13.0)
Kindly help me find a way to resolve this error.
Thanks in advance.
My guess would be that you need to move -ludev to the end of the linking command line.

Error while compiling Mono Source Tree on CentOS - 6.X

I want to install a latest Mono version on my CentOS (i686). As there is no ready to use binary distribution I tried to pull the latest Mono Source 3.2.3 from here. After pulling the source, I extracted it, change directory to it and tried below sequence of commands -
[root#localhost mono-3.2.3]# ./configure
No problems reported
[root#localhost mono-3.2.3]# make
make[3]: Entering directory `/usr/local/src/mono-3.2.3/mono/metadata'
CCLD pedump
./.libs/libmonoruntime.a(libmonoruntime_la-assembly.o): In function `InterlockedDecrement':
/usr/local/src/mono-3.2.3/mono/metadata/../../mono/utils/atomic.h:66: undefined reference to `__sync_add_and_fetch_4'
./.libs/libmonoruntime.a(libmonoruntime_la-assembly.o): In function `InterlockedIncrement':
/usr/local/src/mono-3.2.3/mono/metadata/../../mono/utils/atomic.h:61: undefined reference to `__sync_add_and_fetch_4'
./.libs/libmonoruntime.a(libmonoruntime_la-cominterop.o): In function `InterlockedDecrement':
/usr/local/src/mono-3.2.3/mono/metadata/../../mono/utils/atomic.h:66: undefined reference to `__sync_add_and_fetch_4'
./.libs/libmonoruntime.a(libmonoruntime_la-cominterop.o): In function `InterlockedIncrement':
/usr/local/src/mono-3.2.3/mono/metadata/../../mono/utils/atomic.h:61: undefined reference to `__sync_add_and_fetch_4'
./.libs/libmonoruntime.a(libmonoruntime_la-cominterop.o): In function `InterlockedDecrement':
/usr/local/src/mono-3.2.3/mono/metadata/../../mono/utils/atomic.h:66: undefined reference to `__sync_add_and_fetch_4'
./.libs/libmonoruntime.a(libmonoruntime_la-image.o):/usr/local/src/mono-3.2.3/mono/metadata/../../mono/utils/atomic.h:61: more undefined references to `__sync_add_and_fetch_4' follow
./.libs/libmonoruntime.a(libmonoruntime_la-marshal.o): In function `InterlockedCompareExchangePointer':
/usr/local/src/mono-3.2.3/mono/metadata/../../mono/utils/atomic.h:56: undefined reference to `__sync_val_compare_and_swap_4'
./.libs/libmonoruntime.a(libmonoruntime_la-marshal.o): In function `InterlockedExchangePointer':
While trying to resolve this I found this,this and this. I tried to implement the solution mentioned there but had no luck.
Has anybody faced this?
Regards,
Omky
I added two compiler switches in make file.
CPPFLAGS = -m32 -march=i686
This worked for me.

Suricata luajit compilation error

I'm currently trying to compile suricata (http://suricata-ids.org/) with luajit support on my arch linux distribution with these commands:
./configure --enable-luajit --with-libpcap-includes=/usr/local/pfring/include \
--with-libpcap-libraries=/usr/local/pfring/lib --with-libnss-libraries=/usr/lib \
--with-libnss-includes=/usr/include/nss/ --with-libnspr-libraries=/usr/lib \
--with-libnspr-includes=/usr/include/nspr \
--with-libluajit-includes=/usr/local/include/luajit-2.0/ \
--with-libluajit-libraries=/usr/lib/
then:
make
but I get the following errors when I make the project:
detect-luajit.o: In function `LuaDumpStack':
detect-luajit.c:(.text+0x46e): undefined reference to `lua_tonumberx'
detect-luajit.o: In function `DetectLuajitMatchBuffer':
detect-luajit.c:(.text+0x5d6): undefined reference to `lua_getglobal'
detect-luajit.c:(.text+0x6b9): undefined reference to `lua_pcallk'
detect-luajit.c:(.text+0x7d5): undefined reference to `lua_tonumberx'
detect-luajit.o: In function `DetectLuajitMatch':
detect-luajit.c:(.text+0xaac): undefined reference to `lua_getglobal'
detect-luajit.c:(.text+0xde4): undefined reference to `lua_pcallk'
detect-luajit.c:(.text+0xf00): undefined reference to `lua_tonumberx'
detect-luajit.o: In function `DetectLuajitThreadInit':
detect-luajit.c:(.text+0x1864): undefined reference to `lua_pcallk'
detect-luajit.o: In function `DetectLuaSetupPrime':
detect-luajit.c:(.text+0x1fe7): undefined reference to `lua_pcallk'
detect-luajit.c:(.text+0x2167): undefined reference to `lua_getglobal'
detect-luajit.c:(.text+0x24bf): undefined reference to `lua_pcallk'
collect2: error: ld returned 1 exit status
make[2]: *** [suricata] Error 1
I first though it was an issue coming from the lua version. So I tried to install both the lua 5.1.5 and 5.2.2, remaking the library and symbolic links as well, and nothing worked.
Thanks for your help
In Debian and Ubuntu, the library files are installed into /usr/lib/x86_64-linux-gnu/. If arch does the same, your configure line should include: --with-libluajit-libraries=/usr/lib/x86_64-linux-gnu/

Cross-compiling with OpenSSL for Windows

I'm trying to compile the oauth-utils
http://mir.dnsalias.com/oss/oauth/start
for Windows from Ubuntu. I have compiled it on Windows before
(a few months back), but wanted to try cross-compiling.
I got openssl build using mingw32 ok, and put
libssl.a and libcrypto.a in the right place. The linker is now
finding the libraries (yay!) but I get the following error:
/usr/lib/gcc/i586-mingw32msvc/4.2.1-sjlj/../../../../i586-mingw32msvc/lib/libcrypto.a(rand_win.o):rand_win.c:(.text+0xaac): undefined reference to `_CreateDCA#16'
/usr/lib/gcc/i586-mingw32msvc/4.2.1-sjlj/../../../../i586-mingw32msvc/lib/libcrypto.a(rand_win.o):rand_win.c:(.text+0xab9): undefined reference to `_CreateCompatibleDC#4'
/usr/lib/gcc/i586-mingw32msvc/4.2.1-sjlj/../../../../i586-mingw32msvc/lib/libcrypto.a(rand_win.o):rand_win.c:(.text+0xacc): undefined reference to `_GetDeviceCaps#8'
/usr/lib/gcc/i586-mingw32msvc/4.2.1-sjlj/../../../../i586-mingw32msvc/lib/libcrypto.a(rand_win.o):rand_win.c:(.text+0xadc): undefined reference to `_GetDeviceCaps#8'
/usr/lib/gcc/i586-mingw32msvc/4.2.1-sjlj/../../../../i586-mingw32msvc/lib/libcrypto.a(rand_win.o):rand_win.c:(.text+0xaf4): undefined reference to `_CreateCompatibleBitmap#12'
/usr/lib/gcc/i586-mingw32msvc/4.2.1-sjlj/../../../../i586-mingw32msvc/lib/libcrypto.a(rand_win.o):rand_win.c:(.text+0xb04): undefined reference to `_SelectObject#8'
/usr/lib/gcc/i586-mingw32msvc/4.2.1-sjlj/../../../../i586-mingw32msvc/lib/libcrypto.a(rand_win.o):rand_win.c:(.text+0xb18): undefined reference to `_GetObjectA#12'
/usr/lib/gcc/i586-mingw32msvc/4.2.1-sjlj/../../../../i586-mingw32msvc/lib/libcrypto.a(rand_win.o):rand_win.c:(.text+0xb81): undefined reference to `_BitBlt#36'
/usr/lib/gcc/i586-mingw32msvc/4.2.1-sjlj/../../../../i586-mingw32msvc/lib/libcrypto.a(rand_win.o):rand_win.c:(.text+0xb8c): undefined reference to `_GetBitmapBits#12'
/usr/lib/gcc/i586-mingw32msvc/4.2.1-sjlj/../../../../i586-mingw32msvc/lib/libcrypto.a(rand_win.o):rand_win.c:(.text+0xbe5): undefined reference to `_SelectObject#8'
/usr/lib/gcc/i586-mingw32msvc/4.2.1-sjlj/../../../../i586-mingw32msvc/lib/libcrypto.a(rand_win.o):rand_win.c:(.text+0xbec): undefined reference to `_DeleteObject#4'
/usr/lib/gcc/i586-mingw32msvc/4.2.1-sjlj/../../../../i586-mingw32msvc/lib/libcrypto.a(rand_win.o):rand_win.c:(.text+0xbf6): undefined reference to `_DeleteDC#4'
/usr/lib/gcc/i586-mingw32msvc/4.2.1-sjlj/../../../../i586-mingw32msvc/lib/libcrypto.a(rand_win.o):rand_win.c:(.text+0xc00): undefined reference to `_DeleteDC#4'
Any ideas what could be causing this?
Thanks.
Link with Gdi32.lib
Which version of OpenSSL are you trying to compile?
In general, I have found version 1.0 and newer with MinGW-w64 to work great.
See for example the OpenSSL cross-compilation for Windows tutorial.
It seems that if one remove everything between
static void readscreen(void)
{
#if !defined(OPENSSL_SYS_WINCE) && !defined(OPENSSL_SYS_WIN32_CYGWIN)
and
#endif /* !OPENSSL_SYS_WINCE */
}
in rand_win.c, that building works. I'm not 100% sure how safe removing this is.
Are you adding -mwindows to your link command?

Resources