4

I have set the following compiler and linker settings for building harfbuzz for my IOS library:

CC=clang 
CXX=clang++ CXXFLAGS='-miphoneos-version-min=9.0 -stdlib=libc++ -pipe -arch arm64 -no-cpp-precomp -I/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/usr/include -I./include/  -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk -Wl,-headerpad_max_install_names  -fembed-bitcode' CFLAGS=' -miphoneos-version-min=9.0 -pipe -arch arm64 -no-cpp-precomp -I/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/usr/include -I./include/  -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk -Wl,-headerpad_max_install_names  -fembed-bitcode' ./configure --with-freetype=no --with-glib=no --with-cairo=no --with-fontconfig=no --enable-static --host=arm-apple-darwin --with-icu=no

After this, I run the make command, and I get following error: ld: -bind_at_load and -bitcode_bundle (Xcode setting ENABLE_BITCODE=YES) cannot be used together. Following is the stack trace:

manas-534:harfbuzz manasaga$ make
/Users/manasaga/Downloads/Xcode.app/Contents/Developer/usr/bin/make  all-recursive
Making all in src
/Users/manasaga/Downloads/Xcode.app/Contents/Developer/usr/bin/make  all-recursive
Making all in hb-ucdn
  CC       libhb_ucdn_la-ucdn.lo
  CCLD     libhb-ucdn.la
  CXX      libharfbuzz_la-hb-blob.lo
  CXX      libharfbuzz_la-hb-buffer-serialize.lo
  CXX      libharfbuzz_la-hb-buffer.lo
  CXX      libharfbuzz_la-hb-common.lo
  CXX      libharfbuzz_la-hb-face.lo
  CXX      libharfbuzz_la-hb-font.lo
  CXX      libharfbuzz_la-hb-map.lo
  CXX      libharfbuzz_la-hb-ot-tag.lo
  CXX      libharfbuzz_la-hb-set.lo
  CXX      libharfbuzz_la-hb-shape.lo
  CXX      libharfbuzz_la-hb-shape-plan.lo
  CXX      libharfbuzz_la-hb-shaper.lo
  CXX      libharfbuzz_la-hb-static.lo
  CXX      libharfbuzz_la-hb-unicode.lo
  CXX      libharfbuzz_la-hb-warning.lo
  CXX      libharfbuzz_la-hb-aat-layout.lo
  CXX      libharfbuzz_la-hb-ot-face.lo
  CXX      libharfbuzz_la-hb-ot-font.lo
  CXX      libharfbuzz_la-hb-ot-layout.lo
  CXX      libharfbuzz_la-hb-ot-color.lo
  CXX      libharfbuzz_la-hb-ot-map.lo
  CXX      libharfbuzz_la-hb-ot-math.lo
  CXX      libharfbuzz_la-hb-ot-shape.lo
  CXX      libharfbuzz_la-hb-ot-shape-complex-arabic.lo
  CXX      libharfbuzz_la-hb-ot-shape-complex-default.lo
  CXX      libharfbuzz_la-hb-ot-shape-complex-hangul.lo
  CXX      libharfbuzz_la-hb-ot-shape-complex-hebrew.lo
  CXX      libharfbuzz_la-hb-ot-shape-complex-indic.lo
  CXX      libharfbuzz_la-hb-ot-shape-complex-indic-table.lo
  CXX      libharfbuzz_la-hb-ot-shape-complex-khmer.lo
  CXX      libharfbuzz_la-hb-ot-shape-complex-myanmar.lo
  CXX      libharfbuzz_la-hb-ot-shape-complex-thai.lo
  CXX      libharfbuzz_la-hb-ot-shape-complex-tibetan.lo
  CXX      libharfbuzz_la-hb-ot-shape-complex-use.lo
  CXX      libharfbuzz_la-hb-ot-shape-complex-use-table.lo
  CXX      libharfbuzz_la-hb-ot-shape-normalize.lo
  CXX      libharfbuzz_la-hb-ot-shape-fallback.lo
  CXX      libharfbuzz_la-hb-ot-var.lo
  CXX      libharfbuzz_la-hb-fallback-shape.lo
  CXX      libharfbuzz_la-hb-ucdn.lo
make[5]: Nothing to be done for `all'.
  GEN      libharfbuzz.la
  CXX      libharfbuzz_subset_la-hb-static.lo
  CXX      libharfbuzz_subset_la-hb-subset.lo
  CXX      libharfbuzz_subset_la-hb-subset-glyf.lo
  CXX      libharfbuzz_subset_la-hb-subset-input.lo
  CXX      libharfbuzz_subset_la-hb-subset-plan.lo
  CXXLD    libharfbuzz-subset.la
  CXX      main-main.o
  CXXLD    main

ld: -bind_at_load and -bitcode_bundle (Xcode setting ENABLE_BITCODE=YES) cannot be used together
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[4]: *** [main] Error 1
make[3]: *** [all-recursive] Error 1
make[2]: *** [all] Error 2
make[1]: *** [all-recursive] Error 1
make: *** [all] Error 2

Edit: My updated linker and compiler settings

CC=clang CXX=clang++ IPHONEOS_DEPLOYMENT_TARGET=9.0 LD=/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld LDFLAGS='-arch arm64 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS10.2.sdk' AS=/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/as AR=/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ar LIBTOOL=/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/libtool CXXFLAGS='-stdlib=libc++ -pipe -arch arm64 -no-cpp-precomp -I/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS10.2.sdk/usr/include -I./include/  -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS10.2.sdk -Wl,-headerpad_max_install_names  -fembed-bitcode' CFLAGS='-pipe -arch arm64 -no-cpp-precomp -I/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS10.2.sdk/usr/include -I./include/  -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS10.2.sdk -Wl,-headerpad_max_install_names  -fembed-bitcode' ./configure --with-freetype=no --with-glib=no --with-cairo=no --with-fontconfig=no --enable-static --host=arm-apple-darwin -with-cross-build=/Users/manasaga/Perforce/releases/esg/lipika/main/wrservices/External/Harfbuzz/Source/harfbuzz/ios_mac/ --with-icu=no
5
  • What iOS platform are you targeting? You probably need to set a deployment target. Basically, if you don't set a development target, you get a default that triggers a libtool workaround. (Search for that error message on the web and there are hints to this effect.) Not an answer because I don't know for sure, and I have no way of testing. This is an opportunity for you to create an Answer and get the rep. Commented Nov 2, 2018 at 15:10
  • I am targetting arm64 architecture Commented Nov 2, 2018 at 16:11
  • You need an iOS deployment target. What devices are you targeting, and at what version ranges? Search for the error on the web and you will see. Commented Nov 2, 2018 at 17:53
  • I have changed my compiler and linker settings, but I still get the same error. Commented Nov 5, 2018 at 7:03
  • I think you need to do a bit more research. The Deployment target is different from iPhone deployment target in some manner that you will have to figure out, and all the refs to this linker problem mention the former. stackoverflow.com/q/11340478/1531971 Commented Nov 5, 2018 at 15:33

1 Answer 1

3

Because a bug fix in 'libtool':

if test "$tagname" = CXX ; then
  case ${MACOSX_DEPLOYMENT_TARGET-10.0} in
    10.[0123])
      compile_command+=" ${wl}-bind_at_load"
      finalize_command+=" ${wl}-bind_at_load"
    ;;
  esac
fi

you can run this:

export MACOSX_DEPLOYMENT_TARGET="10.14.1"

and then make success.

Sign up to request clarification or add additional context in comments.

1 Comment

Thanks! I was able to build the library using this solution.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.