title: Build librdkafa Static Library for iOS
body: <p>I was able to compile a static version of librdkafa for MacOS easy enough: </p>
  
  <pre><code>./configure --prefix=$TEMP_DIR \
    --disable-sasl \
    --enable-static
  make
  make install
  </code></pre>
  
  <p>I'm assuming the above configuration worked since I'm compiling on the platform that I am targeting.</p>
  
  <p>For iOS I'm specifying the architecture type like so:</p>
  
  <pre><code>./configure --prefix=$TEMP_DIR \
    --arch=arm64 \
    --disable-sasl \
    --enable-static
  make
  make install
  </code></pre>
  
  <p>But I get a compilation error:</p>
  
  <pre><code>gcc  -shared -dynamiclib -Wl,-install_name,/Users/przemeklach/dev/artifact_staging/temp/lib/librdkafka.1.dylib rdkafka.o rdkafka_broker.o rdkafka_msg.o rdkafka_topic.o rdkafka_conf.o rdkafka_timer.o rdkafka_offset.o rdkafka_transport.o rdkafka_buf.o rdkafka_queue.o rdkafka_op.o rdkafka_request.o rdkafka_cgrp.o rdkafka_pattern.o rdkafka_partition.o rdkafka_subscription.o rdkafka_assignor.o rdkafka_range_assignor.o rdkafka_roundrobin_assignor.o rdkafka_feature.o rdcrc32.o crc32c.o rdaddr.o rdrand.o rdlist.o tinycthread.o rdlog.o rdstring.o rdkafka_event.o rdkafka_metadata.o rdregex.o rdports.o rdkafka_metadata_cache.o rdavl.o rdkafka_sasl.o rdkafka_sasl_plain.o rdkafka_interceptor.o rdkafka_msgset_writer.o rdkafka_msgset_reader.o rdvarint.o rdbuf.o rdunittest.o rdkafka_sasl_scram.o snappy.o rdgz.o rdkafka_lz4.o xxhash.o rddl.o rdkafka_plugin.o -o librdkafka.1.dylib -L/usr/local/Cellar/lz4/1.8.1.2/lib -llz4 -lpthread -lz -L/usr/local/Cellar/openssl/1.0.2o_1/lib -lssl -ldl
  Undefined symbols for architecture x86_64:
    "_BIO_ctrl", referenced from:
        _rd_base64_encode in rdkafka_sasl_scram.o
    "_BIO_f_base64", referenced from:
        _rd_kafka_sasl_scram_fsm in rdkafka_sasl_scram.o
        _rd_base64_encode in rdkafka_sasl_scram.o
  </code></pre>
  
  <p>The actual error is much longer so I'm posting only the part I think is relevant.</p>
  
  <p>Here is the configuration summary that is printed right at the start of compilation:</p>
  
  <pre><code>prefix                   /Users/przemeklach/dev/artifact_staging/temp
    ARCH                     arm64
    CPU                      generic
    GEN_PKG_CONFIG           y
    ENABLE_DEVEL             n
    ENABLE_VALGRIND          n
    ENABLE_REFCNT_DEBUG      n
    ENABLE_SHAREDPTR_DEBUG   n
    ENABLE_LZ4_EXT           y
    ENABLE_SSL               y
    ENABLE_SASL              n
    MKL_APP_NAME             librdkafka
    MKL_APP_DESC_ONELINE     The Apache Kafka C/C++ library
    MKL_DISTRO               osx
    SOLIB_EXT                .dylib
    CC                       gcc
    CXX                      g++
    LD                       ld
    NM                       nm
    OBJDUMP                  objdump
    STRIP                    strip
    CPPFLAGS                 -gstrict-dwarf -O2 -fPIC -Wall -Wsign-compare -Wfloat-equal -Wpointer-arith -Wcast-align
    PKG_CONFIG               pkg-config
    INSTALL                  install
    HAS_LDFLAGS_STATIC       n
    LIB_LDFLAGS              -shared -dynamiclib -Wl,-install_name,$(DESTDIR)$(libdir)/$(LIBFILENAME)
    RDKAFKA_VERSION_STR      0.11.3
    MKL_APP_VERSION          0.11.3
    LIBS                     -L/usr/local/Cellar/lz4/1.8.1.2/lib -llz4 -lpthread -lz -L/usr/local/Cellar/openssl/1.0.2o_1/lib -lssl -ldl
    CFLAGS                   -I/usr/local/Cellar/lz4/1.8.1.2/include -I/usr/local/Cellar/openssl/1.0.2o_1/include
    CXXFLAGS                 -Wno-non-virtual-dtor
    SYMDUMPER                $(NM) -g
    exec_prefix              /Users/przemeklach/dev/artifact_staging/temp
    bindir                   /Users/przemeklach/dev/artifact_staging/temp/bin
    sbindir                  /Users/przemeklach/dev/artifact_staging/temp/sbin
    libexecdir               /Users/przemeklach/dev/artifact_staging/temp/libexec
    datadir                  /Users/przemeklach/dev/artifact_staging/temp/share
    sysconfdir               /Users/przemeklach/dev/artifact_staging/temp/etc
    sharedstatedir           /Users/przemeklach/dev/artifact_staging/temp/com
    localstatedir            /Users/przemeklach/dev/artifact_staging/temp/var
    libdir                   /Users/przemeklach/dev/artifact_staging/temp/lib
    includedir               /Users/przemeklach/dev/artifact_staging/temp/include
    infodir                  /Users/przemeklach/dev/artifact_staging/temp/info
    mandir                   /Users/przemeklach/dev/artifact_staging/temp/man
  </code></pre>
  
  <p>This error raises two questions for me: 1) Am I specifying the architecture correctly in my configure and 2) Why would it complain about undefined symbols for an architecture I'm not trying to build for?</p>