configure 時,指定 CC 、 CPPFLAGS 、LDFLAG, CPPFLAGS 是關鍵,不要使用 CFLAGS,不然會一直驗證 ssl 失敗
Build OpenLDAP with Openssl,only client tools
# download OpenLDAP
wget https://www.openldap.org/software/download/OpenLDAP/openldap-release/openldap-2.4.58.tgz --no-check-certificate
tar zxvf openldap-2.4.58.tgz ; cd openldap-2.4.58
# configure
./configure --target=mips64-octeon-linux-gnu --host=mips64-octeon-linux-gnu --build=x86_64-linux-gnu --prefix=`pwd`/installed --enable-shared --disable-static --disable-debug --enable-dynamic --enable-syslog --disable-local --without-cyrus-sasl --without-fetch --with-tls --with-yielding_select=yes --with-threads --enable-null --disable-bdb --disable-hdb --disable-monitor --disable-relay --disable-slapd CC=mips64-octeon-linux-gnu-gcc LDFLAGS="-L/root/shared_data/embedded_rootfs/build/openssl -lssl -lcrypto" CPPFLAGS="-I/root/shared_data/embedded_rootfs/build/openssl/include"
# other option --exec-prefix=/usr --bindir=/usr/bin --sbindir=/usr/sbin --libexecdir=/usr/lib --sysconfdir=/etc
# 只選build client tools,不然再產生 doc 的檔案時候會出現 /bin/sh: 15: soelim: not found 的錯誤
# 或是安裝 apt-get install groff groff-base
sed -i 's/SUBDIRS= include libraries clients servers tests doc/SUBDIRS= include libraries clients/ ' Makefile
# 解決 undefined reference to `lutil_memcmp’.
sed -i 's/#define NEED_MEMCMP_REPLACEMENT 1/\/\*#undef NEED_MEMCMP_REPLACEMENT\*\// ' include/portable.h
# 解決 strip 參數的問題
sed -i 's/STRIP = -s/STRIP =/' clients/tools/Makefile
# compile and build
make depend && make
# install
make install
# strip lib and bin
mips64-octeon-linux-gnu-strip installed/bin/* installed/lib/*