Ubuntu OpenLDAP 移植 arm-linux(arm-linux-gnueabihf)

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=arm-linux-gnueabihf --host=arm-linux-gnueabihf --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=arm-linux-gnueabihf-gcc LDFLAGS="-L/root/shared_data/lib/libssl -lssl -lcrypto" CPPFLAGS="-I/root/shared_data/lib/libssl/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
arm-linux-gnueabihf-strip installed/bin/* installed/lib/*

  目錄