I have a CentOS 7.4 server, where I’m trying to install asterisk-13.7.2, while creating static libraries.
While I have run ‘contrib/scripts/install_prereq install’, and even if I have installed libstdc+±static and glibc-static so far, i face the following error during the make process:
#STATIC_BUILD="-static" make
[LD] astdb2sqlite3.o db1-ast/libdb1.a -> astdb2sqlite3
/bin/ld: cannot find -lsqlite3
collect2: error: ld returned 1 exit status
make[1]: *** [astdb2sqlite3] Error 1
make: *** [utils] Error 2
Unfortunately, I cannot find the proper .a library to use! If I run:
[LD] astdb2sqlite3.o db1-ast/libdb1.a -> astdb2sqlite3
/usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../../../lib64/libpthread.a(libpthread.o): In function `__libc_sigaction':
(.text+0x89f0): multiple definition of `__libc_sigaction'
/usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../../../lib64/libc.a(sigaction.o):(.text+0x20): first defined here
/usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../../../lib64/libpthread.a(libpthread.o): In function `__libc_pread':
(.text+0x8340): multiple definition of `__libc_pread'
/usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../../../lib64/libc.a(pread.o):(.text+0x0): first defined here
/usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../../../lib64/libpthread.a(libpthread.o): In function `__libc_fsync':
(.text+0x8100): multiple definition of `__libc_fsync'
/usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../../../lib64/libc.a(fsync.o):(.text+0x0): first defined here
/usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../../../lib64/libpthread.a(libpthread.o): In function `__connect_nocancel':
(.text+0x7dc9): multiple definition of `__connect_nocancel'
/usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../../../lib64/libc.a(connect.o):(.text+0x9): first defined here
/usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../../../lib64/libpthread.a(libpthread.o): In function `__libc_fcntl':
(.text+0x7c40): multiple definition of `__libc_fcntl'
/usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../../../lib64/libc.a(fcntl.o):(.text+0xa0): first defined here
/usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../../../lib64/libpthread.a(libpthread.o): In function `__fsync_nocancel':
(.text+0x8109): multiple definition of `__fsync_nocancel'
/usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../../../lib64/libc.a(fsync.o):(.text+0x9): first defined here
/usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../../../lib64/libpthread.a(libpthread.o): In function `_IO_funlockfile':
(.text+0x8990): multiple definition of `_IO_funlockfile'
/usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../../../lib64/libc.a(funlockfile.o):(.text+0x0): first defined here
/usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../../../lib64/libpthread.a(libpthread.o): In function `__libc_nanosleep':
(.text+0x8220): multiple definition of `__libc_nanosleep'
/usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../../../lib64/libc.a(nanosleep.o):(.text+0x0): first defined here
/usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../../../lib64/libpthread.a(libpthread.o): In function `pwrite64':
(.text+0x83a0): multiple definition of `__libc_pwrite'
/usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../../../lib64/libc.a(pwrite.o):(.text+0x0): first defined here
/usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../../../lib64/libpthread.a(libpthread.o): In function `__read':
(.text+0x7ae0): multiple definition of `__libc_read'
/usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../../../lib64/libc.a(read.o):(.text+0x0): first defined here
/usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../../../lib64/libpthread.a(libpthread.o): In function `__pread_nocancel':
(.text+0x8349): multiple definition of `__pread_nocancel'
/usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../../../lib64/libc.a(pread.o):(.text+0x9): first defined here
/usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../../../lib64/libpthread.a(libpthread.o): In function `__open_nocancel':
(.text+0x8289): multiple definition of `__open_nocancel'
/usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../../../lib64/libc.a(open.o):(.text+0x9): first defined here
/usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../../../lib64/libpthread.a(libpthread.o): In function `__lseek_nocancel':
(.text+0x8169): multiple definition of `__lseek_nocancel'
/usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../../../lib64/libc.a(llseek.o):(.text+0x9): first defined here
/usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../../../lib64/libpthread.a(libpthread.o): In function `__read_nocancel':
(.text+0x7ae9): multiple definition of `__read_nocancel'
/usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../../../lib64/libc.a(read.o):(.text+0x9): first defined here
/usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../../../lib64/libpthread.a(libpthread.o): In function `send':
(.text+0x7f90): multiple definition of `__libc_send'
/usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../../../lib64/libc.a(send.o):(.text+0x0): first defined here
/usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../../../lib64/libpthread.a(libpthread.o): In function `__libc_close':
(.text+0x7b40): multiple definition of `__libc_close'
/usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../../../lib64/libc.a(close.o):(.text+0x0): first defined here
/usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../../../lib64/libpthread.a(libpthread.o): In function `__open':
(.text+0x8280): multiple definition of `__libc_open'
/usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../../../lib64/libc.a(open.o):(.text+0x0): first defined here
/usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../../../lib64/libpthread.a(libpthread.o): In function `__write_nocancel':
(.text+0x7a89): multiple definition of `__write_nocancel'
/usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../../../lib64/libc.a(write.o):(.text+0x9): first defined here
/usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../../../lib64/libpthread.a(libpthread.o): In function `__pwrite_nocancel':
(.text+0x83a9): multiple definition of `__pwrite_nocancel'
/usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../../../lib64/libc.a(pwrite.o):(.text+0x9): first defined here
/usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../../../lib64/libpthread.a(libpthread.o): In function `__close_nocancel':
(.text+0x7b49): multiple definition of `__close_nocancel'
/usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../../../lib64/libc.a(close.o):(.text+0x9): first defined here
/usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../../../lib64/libpthread.a(libpthread.o): In function `__fcntl_nocancel':
(.text+0x7ba0): multiple definition of `__fcntl_nocancel'
/usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../../../lib64/libc.a(fcntl.o):(.text+0x0): first defined here
/usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../../../lib64/libpthread.a(libpthread.o): In function `__llseek':
(.text+0x8160): multiple definition of `__libc_lseek'
/usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../../../lib64/libc.a(llseek.o):(.text+0x0): first defined here
/usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../../../lib64/libpthread.a(libpthread.o): In function `sigaction':
(.text+0x8be0): multiple definition of `__sigaction'
/usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../../../lib64/libc.a(sigaction.o):(.text+0x210): first defined here
/usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../../../lib64/libpthread.a(libpthread.o): In function `__errno_location':
(.text+0x9df0): multiple definition of `__errno_location'
/usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../../../lib64/libc.a(errno-loc.o):(.text+0x0): first defined here
/usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../../../lib64/libpthread.a(libpthread.o): In function `_IO_funlockfile':
(.text+0x8990): multiple definition of `__funlockfile'
/usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../../../lib64/libc.a(funlockfile.o):(.text+0x0): first defined here
/usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../../../lib64/libpthread.a(libpthread.o): In function `__lll_lock_wait_private':
(.text+0x77f0): multiple definition of `__lll_lock_wait_private'
/usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../../../lib64/libc.a(libc-lowlevellock.o):(.text+0x0): first defined here
/usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../../../lib64/libpthread.a(libpthread.o): In function `__write':
(.text+0x7a80): multiple definition of `__libc_write'
/usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../../../lib64/libc.a(write.o):(.text+0x0): first defined here
/usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../../../lib64/libpthread.a(libpthread.o): In function `__nanosleep_nocancel':
(.text+0x8229): multiple definition of `__nanosleep_nocancel'
/usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../../../lib64/libc.a(nanosleep.o):(.text+0x9): first defined here
/usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../../../lib64/libpthread.a(libpthread.o): In function `connect':
(.text+0x7dc0): multiple definition of `__libc_connect'
/usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../../../lib64/libc.a(connect.o):(.text+0x0): first defined here
/usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../../../lib64/libpthread.a(libpthread.o): In function `__lll_unlock_wake_private':
(.text+0x78a0): multiple definition of `__lll_unlock_wake_private'
/usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../../../lib64/libc.a(libc-lowlevellock.o):(.text+0x30): first defined here
/usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../../../lib64/libpthread.a(libpthread.o): In function `raise':
(.text+0x8880): multiple definition of `raise'
/usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../../../lib64/libc.a(raise.o):(.text+0x0): first defined here
/usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../../../lib64/libpthread.a(libpthread.o): In function `sem_open':
(.text+0x6a23): warning: the use of `mktemp' is dangerous, better use `mkstemp'
/usr/local/sqlite/lib/libsqlite3.a(sqlite3.o): In function `unixDlError':
/root/source/bld/sqlite3.c:36994: undefined reference to `dlerror'
/usr/local/sqlite/lib/libsqlite3.a(sqlite3.o): In function `unixDlClose':
/root/source/bld/sqlite3.c:37025: undefined reference to `dlclose'
/usr/local/sqlite/lib/libsqlite3.a(sqlite3.o): In function `unixDlSym':
/root/source/bld/sqlite3.c:37021: undefined reference to `dlsym'
/usr/local/sqlite/lib/libsqlite3.a(sqlite3.o): In function `unixDlOpen':
/root/source/bld/sqlite3.c:36980: undefined reference to `dlopen'
collect2: error: ld returned 1 exit status
make[1]: *** [astdb2sqlite3] Error 1
make: *** [utils] Error 2
I wonder if the static build of sqlite is including libc statically as well. I may be able to look later today but take a look at the sqlite build instructions and see if anything is mentioned.
Well, the issue I think is that sqlite is linking statically to glibc which means that glibc will be included in the resulting libsqlite.a. Asterisk dynamically links to glibc so when it links to libsqlite.a, it finds duplicate symbols.
Did you manage to have a look deeper into this matter?
PS: If the combination of latest CentOS 7 with static Asterisk-13.7.2 is not officially tested and supported, can you please point me to the minimum specific version of Asterisk that you may have managed to build statically?
PS2: My ultimate goal is to build Asterisk in one server and be able to install it in another, but where the prefix may vary, so I’m looking into creating an INST_DIR independent build. So, if there is another way to handle this, please feel free to propose!
Static builds are not something many (I don’t even know if anyone has in recent times) do, it’s certainly not something we test, support, or have documented.