Conan: Setting up autotools to cross compile libcurl for iOS - libcurl

I've started using Conan to manage a cross platform project with a fairly large dependency tree (diving into the deep end, I know). Several components in the project use autotools for their configuration step, and I'm struggling to get some of those scripts to detect it properly. Conan itself offers little guidance on the subject, so I'm certain there's some setting I'm missing.
To test out my cross environment, I'm compiling libcurl/7.69.1 from MacOS to iOS armv8 with the following settings (using --build to make everything locally):
[settings]
arch=armv8
arch_build=x86_64
build_type=Release
compiler=apple-clang
compiler.libcxx=libc++
compiler.version=11.0
os=iOS
os.version=9.0
os_build=Macos
[options]
darwin_ssl=False
with_openssl=True
[build_requires]
*: darwin-toolchain/1.0.6#theodelrieu/stable
libcurl/*: libtool/2.4.6
[env]
When it gets to the libcurl configure script, it fails with the following message (relevant libtool output included):
libtool/2.4.6: Package '150f8c59c5beb38d3bb23c3061298c1594abbc17' created
libtool/2.4.6: Created package revision 33a24903417fc5c368223b78e4ffc784
libtool/2.4.6: Appending PATH env: /Users/my_home_dir/.conan/data/libtool/2.4.6/_/_/package/150f8c59c5beb38d3bb23c3061298c1594abbc17/bin
libtool/2.4.6: Setting LIBTOOLIZE env to /Users/my_home_dir/.conan/data/libtool/2.4.6/_/_/package/150f8c59c5beb38d3bb23c3061298c1594abbc17/bin/libtoolize
libtool/2.4.6: Appending ACLOCAL_PATH env: /Users/my_home_dir/.conan/data/libtool/2.4.6/_/_/package/150f8c59c5beb38d3bb23c3061298c1594abbc17/bin/share/aclocal
libtool/2.4.6: Setting LIBTOOL_PREFIX environment variable to /Users/my_home_dir/.conan/data/libtool/2.4.6/_/_/package/150f8c59c5beb38d3bb23c3061298c1594abbc17
libtool/2.4.6: Setting LIBTOOL_DATADIR environment variable to /Users/my_home_dir/.conan/data/libtool/2.4.6/_/_/package/150f8c59c5beb38d3bb23c3061298c1594abbc17/bin/share
libtool/2.4.6: Setting LIBTOOL_PKGAUXDIR environment variable to /Users/my_home_dir/.conan/data/libtool/2.4.6/_/_/package/150f8c59c5beb38d3bb23c3061298c1594abbc17/bin/share/libtool/build-aux
libtool/2.4.6: Setting LIBTOOL_PKGLTDLDIR environment variable to /Users/my_home_dir/.conan/data/libtool/2.4.6/_/_/package/150f8c59c5beb38d3bb23c3061298c1594abbc17/bin/share/libtool
libtool/2.4.6: Setting LIBTOOL_ACLOCALDIR environment variable to /Users/my_home_dir/.conan/data/libtool/2.4.6/_/_/package/150f8c59c5beb38d3bb23c3061298c1594abbc17/bin/share/aclocal
libtool/2.4.6: Appending AUTOMAKE_CONAN_INCLUDES environment variable: /Users/my_home_dir/.conan/data/libtool/2.4.6/_/_/package/150f8c59c5beb38d3bb23c3061298c1594abbc17/bin/share/aclocal
...
libcurl/7.69.1: Calling:
> ./configure '--without-libidn2' '--without-librtmp' '--without-libmetalink' '--without-libpsl' '--without-brotli' '--with-ssl=/Users/my_home_dir/.conan/data/openssl/1.1.1g/Qrypt/dev/package/6721cd435aa597f77b709c9f18a506df5f25cc78' '--without-libssh2' '--without-nghttp2' '--with-zlib=/Users/my_home_dir/.conan/data/zlib/1.2.11/_/_/package/6721cd435aa597f77b709c9f18a506df5f25cc78/lib' '--disable-shared' '--enable-static' '--disable-ldap' '--enable-threaded-resolver' '--disable-verbose' '--prefix=/Users/my_home_dir/.conan/data/libcurl/7.69.1/_/_/package/614a97ea5d3c0afeea50678bf1a8f62835834ff0' '--bindir=${prefix}/bin' '--sbindir=${prefix}/bin' '--libexecdir=${prefix}/bin' '--libdir=${prefix}/lib' '--includedir=${prefix}/include' '--oldincludedir=${prefix}/include' '--datarootdir=${prefix}/share' --build=x86_64-apple-darwin --host=aarch64-apple-darwin
checking whether to enable maintainer-specific portions of Makefiles... no
checking whether make supports nested variables... yes
checking whether to enable debug build options... no
checking whether to enable compiler optimizer... (assumed) yes
checking whether to enable strict compiler warnings... no
checking whether to enable compiler warnings as errors... no
checking whether to enable curl debug memory tracking... no
checking whether to enable hiding of library internal symbols... yes
checking whether to enable c-ares for DNS lookups... no
checking whether to disable dependency on -lrt... (assumed no)
checking whether to enable ESNI support... no
checking for path separator... :
checking for sed... /usr/bin/sed
checking for grep... /usr/bin/grep
checking for egrep... /usr/bin/grep -E
checking for a BSD-compatible install... /usr/bin/install -c
checking for aarch64-apple-darwin-gcc... /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang
checking whether the C compiler works... no
configure: error: in `/Users/my_home_dir/.conan/data/libcurl/7.69.1/_/_/build/614a97ea5d3c0afeea50678bf1a8f62835834ff0/source_subfolder':
configure: error: C compiler cannot create executables
See `config.log' for more details
And the libcurl config.log reads:
configure:4319: checking whether the C compiler works
configure:4341: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS13.6.sdk -arch arm64 -mios-version-min=9.0 -isysroot/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS13.6.sdk -mios-version-min=9.0 -fembed-bitcode -arch arm64 -DHAVE_SOCKET -DHAVE_FCNTL_O_NONBLOCK -isysroot/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS13.6.sdk -mios-version-min=9.0 -fembed-bitcode -arch arm64 -arch arm64 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS13.6.sdk -L/Users/my_home_dir/.conan/data/openssl/1.1.1g/Qrypt/dev/package/6721cd435aa597f77b709c9f18a506df5f25cc78/lib conftest.c -lltdl -lssl -lcrypto -lz >&5
ld: library not found for -lltdl
clang: error: linker command failed with exit code 1 (use -v to see invocation)
configure:4345: $? = 1
configure:4383: result: no
configure: failed program was:
| /* confdefs.h */
| #define PACKAGE_NAME "curl"
| #define PACKAGE_TARNAME "curl"
| #define PACKAGE_VERSION "-"
| #define PACKAGE_STRING "curl -"
| #define PACKAGE_BUGREPORT "a suitable curl mailing list: https://curl.haxx.se/mail/"
| #define PACKAGE_URL ""
| /* end confdefs.h. */
|
| int main (void)
| {
|
| ;
| return 0;
| }
My main question: Searching around, this error seems to indicate libtool cannot be found for my target platform. Am I setting up my autotools correctly within my profile? I copied it from the linux settings within lib curl's recipe; are there any other settings needed to get it set up for a MacOS build agent?
Some other misc questions to help me understand what I'm doing:
When I declare a build_requirement, those components get compiled for the build architecture, correct? (MacOS/x86_64 in this case)
The libcurl recipe on conan-center-index does not set libtool as a build_requirement for MacOS, but configure still tries to call it. Is that an oversight within the recipe or is there supposed to be another way to compile libcurl on MacOS machines?
I noticed the libtool package appends LIBTOOL_PREFIX/bin to the PATH, but libltdl.a resides in LIBTOOL_PREFIX/lib, does the curl configure script find libltdl.a some other way?

Related

pyenv: BUILD FAILED (OS X 10.15.7 using python-build 20180424)

I just installed pyenv on macOS Catalina, and I get the following error message with the command pyenv doctor:
Cloning /Users/joel.rontynen/.pyenv/plugins/pyenv-doctor/bin/.....
Installing python-pyenv-doctor...
python-build: use readline from homebrew
python-build: use zlib from xcode sdk
BUILD FAILED (OS X 10.15.7 using python-build 20180424)
Inspect or clean up the working tree at /var/folders/tl/_2700jnn5vj0q5ryygn4c4ww0000gp/T/python-build.20201014132428.46509
Results logged to /var/folders/tl/_2700jnn5vj0q5ryygn4c4ww0000gp/T/python-build.20201014132428.46509.log
Last 10 log lines:
checking readline/readline.h, presence... no
checking for readline/readline.h,... no
checking readline/rlconf.h usability... yes
checking readline/rlconf.h presence... yes
checking for readline/rlconf.h... yes
checking for SSL_library_init in -lssl... no
configure: WARNING: OpenSSL <1.1 not installed. Checking v1.1 or beyond...
checking for OPENSSL_init_ssl in -lssl... no
configure: error: OpenSSL is not installed.
make: *** No targets specified and no makefile found. Stop.
Problem(s) detected while checking system.
See https://github.com/pyenv/pyenv/wiki/Common-build-problems for known solutions.
The log file looks like this:
/var/folders/tl/_2700jnn5vj0q5ryygn4c4ww0000gp/T/python-build.20201021121358.92440 ~
Cloning into 'python-pyenv-doctor'...
warning: --depth is ignored in local clones; use file:// instead.
done.
/var/folders/tl/_2700jnn5vj0q5ryygn4c4ww0000gp/T/python-build.20201021121358.92440/python-pyenv-doctor /var/folders/tl/_2700jnn5vj0q5ryygn4c4ww0000gp/T/python-build.20201021121358.92440 ~
checking for gcc... clang
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
checking whether we are using the GNU C compiler... yes
checking whether clang accepts -g... yes
checking for clang option to accept ISO C89... none needed
checking for rl_gnu_readline_p in -lreadline... yes
checking how to run the C preprocessor... clang -E
checking for grep that handles long lines and -e... /usr/bin/grep
checking for egrep... /usr/bin/grep -E
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking readline/readline.h, usability... no
checking readline/readline.h, presence... no
checking for readline/readline.h,... no
checking readline/rlconf.h usability... yes
checking readline/rlconf.h presence... yes
checking for readline/rlconf.h... yes
checking for SSL_library_init in -lssl... no
configure: WARNING: OpenSSL <1.1 not installed. Checking v1.1 or beyond...
checking for OPENSSL_init_ssl in -lssl... no
configure: error: OpenSSL is not installed.
make: *** No targets specified and no makefile found. Stop.
I installed pyenv and pyenv-virtualenv using Homebrew, and the update and doctor add-ons by cloning the GitHub repository. The command brew list gives the following output:
fig pyenv-virtualenv xz
openssl#1.1 pyenv readline
My .zshrc file looks like this:
if command -v pyenv 1>/dev/null 2>&1; then
eval "$(pyenv init -)"
fi
and .zshenv file like this:
eval "$(pyenv virtualenv-init -)"
I'm not sure what other information is relevant, so you can ask for more in the comments.
The problem was OpenSSL that was installed with Homebrew, but which "was not symlinked into /usr/local, because macOS provides LibreSSL." I learned this by running the command brew info openssl, which says
openssl#1.1: stable 1.1.1h (bottled) [keg-only]
Cryptography and SSL/TLS Toolkit
https://openssl.org/
/usr/local/Cellar/openssl#1.1/1.1.1h (8,067 files, 18.5MB)
Poured from bottle on 2020-10-14 at 12:44:32
From: https://github.com/Homebrew/homebrew-core/blob/HEAD/Formula/openssl#1.1.rb
License: OpenSSL
==> Caveats
A CA file has been bootstrapped using certificates from the system
keychain. To add additional certificates, place .pem files in
/usr/local/etc/openssl#1.1/certs
and run
/usr/local/opt/openssl#1.1/bin/c_rehash
openssl#1.1 is keg-only, which means it was not symlinked into /usr/local,
because macOS provides LibreSSL.
If you need to have openssl#1.1 first in your PATH run:
echo 'export PATH="/usr/local/opt/openssl#1.1/bin:$PATH"' >> ~/.zshrc
For compilers to find openssl#1.1 you may need to set:
export LDFLAGS="-L/usr/local/opt/openssl#1.1/lib"
export CPPFLAGS="-I/usr/local/opt/openssl#1.1/include"
For pkg-config to find openssl#1.1 you may need to set:
export PKG_CONFIG_PATH="/usr/local/opt/openssl#1.1/lib/pkgconfig"
The fix can be found in the message above under the line "==> Caveats". I added the export LDFLAGS and CPPFLAGS lines to my ~/.zshrc file and the pyenv doctor command does not give any errors anymore.

gcc | compile from source trouble

I try compile simple tool, and get error. Help me please fix it :)
./configure
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for gawk... gawk
checking whether make sets $(MAKE)... yes
checking for g++... g++
checking whether the C++ compiler works... yes
....
....
checking for main in -lboost_filesystem... no
configure: error: in `/root/tbb2mbox/mbox2eml-0.1.2':
configure: error: boost_filesystem is required
but boost, boost-devel is installed
boost-1.33.1-16.el5_9
boost-devel-1.33.1-16.el5_9
libs
ldconfig -p | grep boost_filesystem
libboost_filesystem.so.2 (libc6,x86-64) => /usr/lib64/libboost_filesystem.so.2
headers
rpm -ql boost-devel | grep filesystem
/usr/include/boost/filesystem
/usr/include/boost/filesystem/config.hpp
/usr/include/boost/filesystem/convenience.hpp
/usr/include/boost/filesystem/exception.hpp
/usr/include/boost/filesystem/fstream.hpp
/usr/include/boost/filesystem/operations.hpp
/usr/include/boost/filesystem/path.hpp
/usr/lib64/libboost_filesystem.a
/usr/lib64/libboost_filesystem.so
What i can do for success ? ))
When configure performs a test, it generally only reports the results to the terminal. However, it also logs most of the work it does to config.log.
So, when confronted with an error like this, the best thing to do is search through config.log to find the failing compilation. This will give you more information about exactly what has failed, which should let you fix the underlying problem.

Basemap installation on Mac laptop

I know there are several questions about this topic, but I cannot find a clear answer.
I'm trying to install Basemap in my laptop (Mac OS X, v 10.6.8). I'm running Python 2.7.8 |Anaconda 2.0.1.
Python is installed in the following folder: users/myname/anaconda
I've downloaded basemap-1.0.7 into the same folder (users/myname/anaconda), then I follow the instructions from http://matplotlib.org/basemap/users/installing.html:
To install the GEOS library I open up a terminal and type:
cd anaconda/basemap-1.0.7/geos-3.3.3/
export GEOS_DIR=/user/myname/anaconda
./configure --prefix=$GEOS_DIR
Then I get the following error:
checking host system type... i386-apple-darwin10.8.0
checking target system type... i386-apple-darwin10.8.0
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... ./install-sh -c -d
checking for gawk... no
checking for mawk... no
checking for nawk... no
checking for awk... awk
checking whether make sets $(MAKE)... no
checking whether to enable maintainer-specific portions of Makefiles... no
checking for gcc... no
checking for cc... no
checking for cl.exe... no
configure: error: in `/Users/myname/anaconda/basemap-1.0.7/geos-3.3.3':
configure: error: no acceptable C compiler found in $PATH
See `config.log' for more details
Then, when I try to run make; make install I get the error:
-bash: make: command not found
Can someone explain what I'm doing wrong?
The problem is that Basemap needs to compile GEOS, which is a C library, so you need a C compiler.
Alternatively, just download and install from the Mac OSX binaries provided here: http://trac.osgeo.org/geos/

how to compile fftw3 on iOS

Nowdays I just want to use FFTW3 on iOS, since I've compiled it successfully into i386 version which is used by the iOS simulator, the rest work is to compile it into armv6(or v7) version and lipo these two versions together,below is my incorrect configure:
./configure
CC=/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/arm-apple-darwin10-gcc-4.2.1
LD=/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/ld
CCFLAGS="-I
/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS4.2.sdk/usr/lib/gcc/arm-apple-darwin10/4.2.1/include/
-I /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS4.2.sdk/usr/include/
-miphoneos-version-min=2.2 -arch armv6 -isysroot /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS4.2.sdk"
LDFLAGS="-arch armv6 -isysroot
/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS4.2.sdk"
--enable-float --host=arm-apple-darwin --build=arm-apple-darwin10 --disable-fortran
when use this to build fftw3,I always get this:
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for arm-apple-darwin-strip... no
checking for strip... strip
configure: WARNING: using cross tools not prefixed with host triplet
checking for a thread-safe mkdir -p... ./install-sh -c -d
checking for gawk... no
checking for mawk... no
checking for nawk... no
checking for awk... awk
checking whether make sets $(MAKE)... yes
checking whether to enable maintainer-specific portions of Makefiles... no
checking build system type... arm-apple-darwin10
checking host system type... arm-apple-darwin
checking for arm-apple-darwin-gcc... /Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/arm-apple-darwin10-gcc-4.2.1
checking whether the C compiler works... no
configure: error: in /Users/chencyz/Desktop/Development/Misc/fftw3/fftw-3.3':
configure: error: C compiler cannot create executables
Seeconfig.log' for more details
I'm not so clear about the problem(C compiler not works?),could anyone give me some guides,thanks very much !
According to ./configure --help:
--build=BUILD configure for building on BUILD [guessed]
--host=HOST cross-compile to build programs to run on HOST [BUILD]
So the key is to pass --host=arm-apple-darwin10, and execute configure with the correct alterations to PATH, CFLAGS, LDFLAGS, etc.
This seems to work:
PATH=/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin:$PATH \
../configure --host=arm-apple-darwin10 CFLAGS="-I/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS4.3.sdk/usr/include -I/Library/iPhone/include -isysroot /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS4.3.sdk" \
CC=arm-apple-darwin10-gcc-4.2.1 \
CPP=cpp \
LDFLAGS="-isysroot /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS4.3.sdk" \
--enable-single
Good luck.
I had a similar issue when trying to get cute compiled for iOS. Looking at the configure script, it didn't seem to use the $LDFLAGS variable, but if it did I think you could add the following to the configure line:
./configure CC=... CFLAGS="-arch armv7 -isysroot $SDKROOT" CXXFLAGS="$CFLAGS" LDFLAGS="$CFLAGS -Wl,-syslibroot $SDKROOT"
Where $SDKROOT is /Developer/Platforms/iPhone.platform/Developer/SDKs/iPhone5.0.sdk by default (with the iOS 5.0 SDK).
I never got cute compiled as I couldn't figure out how to correct the C-compiler invocation, however, your mileage may vary.

Cannot created executables installing IT++, ACML

I want to install IT++ with ACML
I first installed ACML and then did:
export LDFLAGS=$LDFLAGS:"-L/opt/acml4.4.0/ifort32/lib"
export CPPFLAGS=$CPPFLAGS:"-I/opt/acml4.4.0/ifort32/include"
So that IT++ can find it when it configures itself.
NExt I went to the IT++ directory and typed "./configure"
then I get the following error:
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for gawk... gawk
checking whether make sets $(MAKE)... yes
checking build system type... i686-pc-linux-gnu
checking host system type... i686-pc-linux-gnu
checking for g++... g++
checking for C++ compiler default output file name... configure: error: C++ compiler cannot create executables
See `config.log' for more details.
I went to the config.log and the interesting lines are given below:
lib conftest.cpp >&5
g++: :-I/opt/acml4.4.0/ifort32_mp/include: No such file or directory
g++: :-L/opt/acml4.4.0/ifort32_mp/lib: No such file or directory
configure:2836: $? = 1
Why is it doing this?