yinqiwen / ardb

A redis protocol compatible nosql, it support multiple storage engines as backend like Google's LevelDB, Facebook's RocksDB, OpenLDAP's LMDB, PerconaFT, WiredTiger, ForestDB.
BSD 3-Clause "New" or "Revised" License
1.83k stars 278 forks source link

ardb binary file is not portable #446

Open purplegrape opened 6 years ago

purplegrape commented 6 years ago

I have packaged rpm file for ardb , it runs ok in local , but others not.

yinqiwen commented 6 years ago

what's the error report?

purplegrape commented 6 years ago

./ardb-server --help Illegal instruction

purplegrape commented 6 years ago

rebuild src.rpm file locally, rpm file works again, so I believe it's not portable . as far as i see, it probably due to build jemalloc with gcc options "-O3"

purplegrape commented 6 years ago

echo "<<<<< Done unpacking JEMALLOC"

Unpacking JEMALLOC <<<<< Done unpacking JEMALLOC echo ">>>>> Building JEMALLOC" && \ cd /builddir/build/BUILD/ardb-0.9.7/src/../deps/jemalloc-5.0.1 && \ ./configure && \ make build_lib_static && \ echo "<<<<< Done building JEMALLOC" Building JEMALLOC checking for xsltproc... false checking for gcc... gcc checking whether the C compiler works... yes checking for C compiler default output file name... a.out checking for suffix of executables... checking whether we are cross compiling... no checking for suffix of object files... o ..............................

jemalloc version : 5.0.1-0-g896ed3a8b3f41998d4fb4d625d30ac63ef2d51fb library revision : 2

CONFIG : CC : gcc CONFIGURE_CFLAGS : -std=gnu11 -Wall -Wsign-compare -Wundef -pipe -g3 -fvisibility=hidden -O3 -funroll-loops SPECIFIED_CFLAGS : EXTRA_CFLAGS : CPPFLAGS : -D_GNU_SOURCE -D_REENTRANT CXX : g++ CONFIGURE_CXXFLAGS : -fvisibility=hidden -O3 SPECIFIED_CXXFLAGS : EXTRA_CXXFLAGS : LDFLAGS : EXTRA_LDFLAGS : DSO_LDFLAGS : -shared -Wl,-soname,$(@F) LIBS : -lm -lpthread -ldl RPATH_EXTRA :

XSLTPROC : false XSLROOT :

PREFIX : /usr/local BINDIR : /usr/local/bin DATADIR : /usr/local/share INCLUDEDIR : /usr/local/include LIBDIR : /usr/local/lib MANDIR : /usr/local/share/man

srcroot : abs_srcroot : /builddir/build/BUILD/ardb-0.9.7/deps/jemalloc-5.0.1/ objroot : abs_objroot : /builddir/build/BUILD/ardb-0.9.7/deps/jemalloc-5.0.1/

JEMALLOC_PREFIX : JEMALLOC_PRIVATENAMESPACE : je install_suffix : malloc_conf : autogen : 0 debug : 0 stats : 1 prof : 0 prof-libunwind : 0 prof-libgcc : 0 prof-gcc : 0 thp : 1 fill : 1 utrace : 0 xmalloc : 0 lazy_lock : 0 cache-oblivious : 1 cxx : 0

make[2]: Entering directory `/builddir/build/BUILD/ardb-0.9.7/deps/jemalloc-5.0.1' gcc -std=gnu11 -Wall -Wsign-compare -Wundef -pipe -g3 -fvisibility=hidden -O3 -funroll-loops -c -D_GNU_SOURCE -D_REENTRANT -Iinclude -Iinclude -DJEMALLOC_NO_PRIVATE_NAMESPACE -o src/jemalloc.sym.o src/jemalloc.c nm -a src/jemalloc.sym.o | gawk -f include/jemalloc/internal/private_symbols.awk > src/jemalloc.sym gcc -std=gnu11 -Wall -Wsign-compare -Wundef -pipe -g3 -fvisibility=hidden -O3 -funroll-loops -c -D_GNU_SOURCE -D_REENTRANT -Iinclude -Iinclude -DJEMALLOC_NO_PRIVATE_NAMESPACE -o src/arena.sym.o src/arena.c

yinqiwen commented 6 years ago

u can use MALLOC=libc make to build without jemalloc.

purplegrape commented 6 years ago

have tried MALLOC=libc ,move binary file to another server , got the same error: ./ardb-server --help Illegal instruction

this need further investgation , many thanks .

purplegrape commented 6 years ago

traps: ardb-server[24459] trap invalid opcode ip:747a3d sp:7fff2ec5dac8 error:0 in ardb-server[400000+4b1000]

gupta2007vaibhav commented 5 years ago

can you share the spec file for ardb?

purplegrape commented 5 years ago

Name: ardb Version: 0.9.7 Release: 1%{?dist} Summary: A redis protocol compatible nosql

License: BSD-3-Clause URL: https://github.com/yinqiwen/ardb Source0: %{name}-%{version}.tar.gz Source1: %{name}.service

Source11: jemalloc-5.0.1.tar.bz2 Source12: rocksdb-5.12.2.tar.gz Source13: snappy-1.1.4.tar.gz

BuildRequires: gcc-c++ >= 4.8.1 BuildRequires: glibc-devel BuildRequires: libtool BuildRequires: bzip2-devel BuildRequires: gflags-devel BuildRequires: zlib-devel BuildRequires: systemd

Requires: glibc Requires: gflags Requires: libgcc Requires: libstdc++ Requires: bzip2 Requires: zlib Requires: systemd

%description A redis protocol compatible nosql, it support multiple storage engines as backend like Google's LevelDB, Facebook's RocksDB, OpenLDAP's LMDB, PerconaFT, WiredTiger, ForestDB.

%prep %setup -q install %{SOURCE11} deps/ install %{SOURCE12} deps/ install %{SOURCE13} deps/

%build sed -i 's/0.9.6/0.9.7/g' src/Makefile

MALLOC=libc storage_engine=rocksdb make

storage_engine=rocksdb make

%install rm -rf $RPM_BUILD_ROOT %{mkdir} -p $RPM_BUILD_ROOT%{_bindir} %{__mkdir} -p $RPM_BUILD_ROOT%{_sysconfdir}/ardb %{mkdir} -p $RPM_BUILD_ROOT%{_sharedstatedir}/ardb %{__mkdir} -p $RPM_BUILD_ROOT/var/log/ardb

%{install} -p -m 755 src/ardb-repair $RPM_BUILD_ROOT%{_bindir} %{__install} -p -m 755 src/ardb-server $RPM_BUILD_ROOT%{_bindir} %{install} -p -m 755 src/ardb-test $RPM_BUILD_ROOT%{_bindir}

%{__install} -p -m 644 ardb.conf $RPM_BUILD_ROOT%{_sysconfdir}/ardb/

%{__mkdir} -p $RPM_BUILD_ROOT%{_unitdir} %{__install} -p -m 644 %{SOURCE1} $RPM_BUILD_ROOT%{_unitdir}/

sed -i 's#home.*#home /var/lib/ardb#g' $RPM_BUILD_ROOT%{_sysconfdir}/ardb/ardb.conf sed -i 's#stdout#/var/log/ardb/ardb-server.log#g' $RPM_BUILD_ROOT%{_sysconfdir}/ardb/ardb.conf

%clean rm -rf $RPM_BUILD_ROOT

%pre

Add the "ardb" user

getent group ardb >/dev/null || groupadd -r ardb getent passwd ardb >/dev/null || useradd -r -g ardb -s /sbin/nologin -d /var/lib/ardb -c "ardb user" ardb exit 0

%post %systemd_post %{name}.service

%preun %systemd_preun %{name}.service

%postun %systemd_postun %{name}.service

%files %defattr(-,root,root,-) %{_bindir}/* %{_unitdir}/ardb.service %config(noreplace) %{_sysconfdir}/ardb/ardb.conf %dir %attr(0755,ardb,ardb) %{_sharedstatedir}/ardb %dir %attr(0755,ardb,ardb) /var/log/ardb %doc README.md %license LICENSE