Compiling libidin.a to iOS - ios

I want to compile the libidin.a framework to iOS but I ran into a terminal problem during so.
This is the guide i'm using to do that:
https://github.com/robbiehanson/XMPPFramework/wiki/CompilingLibidn
The guide says I should cd to the folder where the libidin.a is at and write the following line:
./configure --prefix=/usr/local/iphone --host=arm-apple-darwin --disable-shared CC=/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/arm-apple-darwin9-gcc-4.0.1 CFLAGS="-arch armv6 -pipe -std=c99 -Wno-trigraphs -fpascal-strings -fasm-blocks -O0 -Wreturn-type -Wunused-variable -fmessage-length=0 -fvisibility=hidden -miphoneos-version-min=2.0 -gdwarf-2 -mthumb -isysroot /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS2.0.sdk" CPP=/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/cpp AR=/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/ar
But I get the follwing answer:
-bash: ./configure: No such file or directory
Since I have no clue about what i'm doing in terminal, I really need your help.
Thanks

Ok,
I found out that I added the precompiled libidin.a file only one of my targets and this is why it failed.

Related

Build openssl for arm64 iOS simulator

Description
I'm trying build iphonesimulator-only targeted library witn architecture arm64, but linking step failed with error:
${LDCMD:-/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang} -O3 -fvisibility=hidden -miphoneos-version-min=9.0 -fembed-bitcode -fPIC -arch arm64 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator14.5.sdk -L. -Wl,-search_paths_first \
-o apps/openssl apps/asn1pars.o apps/ca.o apps/ciphers.o apps/cms.o apps/crl.o apps/crl2p7.o apps/dgst.o apps/dhparam.o apps/dsa.o apps/dsaparam.o apps/ec.o apps/ecparam.o apps/enc.o apps/errstr.o apps/gendsa.o apps/genpkey.o apps/genrsa.o apps/nseq.o apps/ocsp.o apps/openssl.o apps/passwd.o apps/pkcs12.o apps/pkcs7.o apps/pkcs8.o apps/pkey.o apps/pkeyparam.o apps/pkeyutl.o apps/prime.o apps/rand.o apps/rehash.o apps/req.o apps/rsa.o apps/rsautl.o apps/s_client.o apps/s_server.o apps/s_time.o apps/sess_id.o apps/smime.o apps/speed.o apps/spkac.o apps/srp.o apps/storeutl.o apps/ts.o apps/verify.o apps/version.o apps/x509.o \
apps/libapps.a -lssl -lcrypto
ld: building for iOS, but linking in .tbd file (/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator14.5.sdk/usr/lib/libSystem.tbd) built for iOS Simulator, file '/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator14.5.sdk/usr/lib/libSystem.tbd' for architecture arm64
Configuraton command:
./Configure iossimulator-xcrun threads no-shared "-fvisibility=hidden -miphoneos-version-min=9.0 -fembed-bitcode -fPIC" no-asm no-hw no-async --prefix=/Users/macosuser/Build/OpenSSL/Install "-arch arm64" "-isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator14.5.sdk"
Configuring OpenSSL version 1.1.1j (0x101010afL) for iossimulator-xcrun
Using os-specific seed configuration
Creating configdata.pm
Creating Makefile
Build commands look like this:
...
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -I. -Iinclude -Iapps -O3 -fvisibility=hidden -miphoneos-version-min=9.0 -fembed-bitcode -fPIC -arch arm64 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator14.5.sdk -D_REENTRANT -DNDEBUG -MMD -MF apps/x509.d.tmp -MT apps/x509.o -c -o apps/x509.o apps/x509.c
...
Question
I can't figure out why for other architectures (i386, x86_64) the build happens without problems.
Perhaps I am missing some nuance, but I cannot understand which one.
Why do I need this - an application using this library must run on a simulator in a macbook with an M1 processor.
Environment specifications
MacOS 11.4
XCode v12.5
OpenSSL v1.1.1j
Compiler - AppleClang 12.0.5.12050022
Because i'm not an iOS developer, i didn't immediately understand the specifics of building libraries through make for this platform.
The problem was this:
-miphoneos-version-min specifies the deployment target for iOS, but since i am building library for the iOS simulator, me need to use -mios-simulator-version-min.
As a result, the configuration command should look like this:
./Configure iossimulator-xcrun threads no-shared "-fvisibility=hidden -mios-simulator-version-min=9.0 -fembed-bitcode -fPIC" no-asm no-hw no-async --prefix=/Users/macosuser/Build/OpenSSL/Install "-arch arm64" "-isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator14.5.sdk"
If anyone can explain why the -miphoneos-version-min flag works as expected for i386 and x86_64 architectures, i would be grateful.

Can't Compile Crypto++ Library for IOS

I'm trying to build a static cryptopp library for ios. I'm basing my steps from these sites:
http://cryptopp.com/wiki/IOS_(Command_Line)#Xcode_Project
https://github.com/noloader/cryptopp-5.6.2-ios
https://www.cryptopp.com/
1.) I downloaded the latest cryptopp version 5.6.3
2.) I downloaded noloader's cryptopp-5.6.2-ios becasue it has updated:
setenv-ios.sh - i had to edit this to search for sdk 9.2
GNUmakefile
config.h
build-for-ios.sh
3.) I copied the four files to my cryptopp 5.6.3 directory and replaced GNUmakefile and config.h
4.) I checked out IOS_Command_Line instruction to invoke setenv-ios.sh first.
5.) Then, as noloader said, run build-for-ios.sh.
However, i'm getting this error:
Has anyone successfully built the library using the latest ios SDK and cryptopp version? If so, can you please point me to the right direction. Thanks.
The documentation was not correct under IOS (Command Line) | Build the Library. After setting the environment with setenv-ios.sh, you should use GNUmakefile-cross:
$ make -f GNUmakefile-cross static dynamic cryptest.exe
clang++ -DNDEBUG -g2 -Os -fPIC -pipe -Wall -Wno-delete-non-virtual-dtor -arch armv7 -isysroot
/Applications/Xcode-5_1.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS7.1.sdk
-stdlib=libc++ -c cryptlib.cpp
clang++ -DNDEBUG -g2 -Os -fPIC -pipe -Wall -Wno-delete-non-virtual-dtor -arch armv7 -isysroot
/Applications/Xcode-5_1.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS7.1.sdk
-stdlib=libc++ -c cpu.cpp
clang++ -DNDEBUG -g2 -Os -fPIC -pipe -Wall -Wno-delete-non-virtual-dtor -arch armv7 -isysroot
/Applications/Xcode-5_1.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS7.1.sdk
-stdlib=libc++ -c 3way.cpp
...
I thought we updated the iOS procedures when we updated the Android procedures. I'm not sure what went wrong the documentation updates.
We checked in the scripts for setenv-ios.sh, setenv-android.sh and setenv-embedded.sh in March 2016. GNUmakefile-cross was already in the library. Also see Commit a78b9dfa0840f92f, Added iOS environment and test script and Commit 22d6374ce7151ad0, Added Android and embedded environment and test script.
All you should need to do now is the following:
git clone https://github.com/weidai11/cryptopp.git
cd cryptopp
. ./setenv-ios.sh
make -f GNUmakefile-cross static dynamic cryptest.exe
...
The new/updated files will be available in the ZIP at the next Crypto++ release, which will be either 5.6.4 or 5.7.0.

How to get the options with which clang was compiled

It is possible to get gcc configure options with gcc -v (an example is here). Is there a similar way to retrieve the compilation options of clang?
My real task is the following one: I have an environment with a compiler (clang) which I want to improve. Now I have some patch for clang that I applied and I want to rebuild the patched sources, but I also want to be sure that nothing changes from the vanilla build apart from my patch; in particular, that all the build flags I use are the same.
No, probably not. But it's possible to get the CXXFLAGS/LDFLAGS clang was compiled with via llvm-config.
$ llvm-config --cxxflags
-I/opt/compiler/llvm-trunk/include -march=native -fPIC -fvisibility-inlines-hidden -Wall -W -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wmissing-field-initializers -pedantic -Wno-long-long -Wcovered-switch-default -Wnon-virtual-dtor -std=c++11 -ffunction-sections -fdata-sections -O3 -DNDEBUG -D_GNU_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS
$ llvm-config --ldflags
-L/opt/compiler/llvm-trunk/lib
$ llvm-config --system-libs
-lrt -ldl -lcurses -latomic -lpthread -lz -lm
If you are on a Linux distribution, then simply check the PKGBUILD (or similar) to find the exact flags.

Xcode looking in wrong location for CFNetwork framework

I wouldn't be surprised if this is something stupid that I'm doing... This is an iOS target project.
MacOS: 10.7 Lion
Xcode: 4.1
Target: iPhone 4.3
I used ASI's ASIHTTPRequest add-in framework in a different project and it worked fine.
I've added it to the current project I'm working on and now Xcode is looking for the CFNetwork framework in a project directory instead of the SDK location. I have not added any search locations and have verified that the CFNetwork framwork location is set to "Relative to SDK" and is looking at the "System/Library/Frameworks" directory.
As you can see at the bottom of the error message, it is looking in the wrong folder for the framework—it is looking inside the project folder.
Please let me know if you have any thoughts as to what I am doing wrong.
Thanks!
Error message:
CompileC /Users/mooner/Library/Developer/Xcode/DerivedData/MoonCo_TiltFinder-gzpflywfciaabtachdctgqaarhmu/Build/Intermediates/MoonCo_TiltFinder.build/Debug-iphonesimulator/MoonCo_TiltFinder.build/Objects-normal/i386/ASIDownloadCache.o ASIDownloadCache.m normal i386 objective-c com.apple.compilers.llvm.clang.1_0.compiler
cd /Volumes/One.One/Development/Cam-MoonCo_TabBar/MoonCo_CustomTabBar
setenv LANG en_US.US-ASCII
setenv PATH "/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin:/Developer/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin"
/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/clang -x objective-c -arch i386 -fmessage-length=0 -fdiagnostics-print-source-range-info -fdiagnostics-show-category=id -fdiagnostics-parseable-fixits -std=gnu99 -Wno-trigraphs -fpascal-strings -O0 -Wreturn-type -Wparentheses -Wswitch -Wno-unused-parameter -Wunused-variable -Wunused-value -DDEBUG -isysroot /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator4.3.sdk -fexceptions -fasm-blocks -mmacosx-version-min=10.6 -gdwarf-2 -fobjc-abi-version=2 -fobjc-legacy-dispatch "-DIBOutlet=attribute((iboutlet))" "-DIBOutletCollection(ClassName)=attribute((iboutletcollection(ClassName)))" "-DIBAction=void)attribute((ibaction)" -D__IPHONE_OS_VERSION_MIN_REQUIRED=40300 -iquote /Users/mooner/Library/Developer/Xcode/DerivedData/MoonCo_TiltFinder-gzpflywfciaabtachdctgqaarhmu/Build/Intermediates/MoonCo_TiltFinder.build/Debug-iphonesimulator/MoonCo_TiltFinder.build/MoonCo_TiltFinder-generated-files.hmap -I/Users/mooner/Library/Developer/Xcode/DerivedData/MoonCo_TiltFinder-gzpflywfciaabtachdctgqaarhmu/Build/Intermediates/MoonCo_TiltFinder.build/Debug-iphonesimulator/MoonCo_TiltFinder.build/MoonCo_TiltFinder-own-target-headers.hmap -I/Users/mooner/Library/Developer/Xcode/DerivedData/MoonCo_TiltFinder-gzpflywfciaabtachdctgqaarhmu/Build/Intermediates/MoonCo_TiltFinder.build/Debug-iphonesimulator/MoonCo_TiltFinder.build/MoonCo_TiltFinder-all-target-headers.hmap -iquote /Users/mooner/Library/Developer/Xcode/DerivedData/MoonCo_TiltFinder-gzpflywfciaabtachdctgqaarhmu/Build/Intermediates/MoonCo_TiltFinder.build/Debug-iphonesimulator/MoonCo_TiltFinder.build/MoonCo_TiltFinder-project-headers.hmap -I/Users/mooner/Library/Developer/Xcode/DerivedData/MoonCo_TiltFinder-gzpflywfciaabtachdctgqaarhmu/Build/Products/Debug-iphonesimulator/include -I/Users/mooner/Library/Developer/Xcode/DerivedData/MoonCo_TiltFinder-gzpflywfciaabtachdctgqaarhmu/Build/Intermediates/MoonCo_TiltFinder.build/Debug-iphonesimulator/MoonCo_TiltFinder.build/DerivedSources/i386 -I/Users/mooner/Library/Developer/Xcode/DerivedData/MoonCo_TiltFinder-gzpflywfciaabtachdctgqaarhmu/Build/Intermediates/MoonCo_TiltFinder.build/Debug-iphonesimulator/MoonCo_TiltFinder.build/DerivedSources -F/Users/mooner/Library/Developer/Xcode/DerivedData/MoonCo_TiltFinder-gzpflywfciaabtachdctgqaarhmu/Build/Products/Debug-iphonesimulator -F/Volumes/One.One/Development/Cam-MoonCo_TabBar/MoonCo_CustomTabBar -include /Users/mooner/Library/Developer/Xcode/DerivedData/MoonCo_TiltFinder-gzpflywfciaabtachdctgqaarhmu/Build/PrecompiledHeaders/MoonCo_CustomTabBar-Prefix-ezvknrzjsqbjxdfzxcnzjkisdtlw/MoonCo_CustomTabBar-Prefix.pch -MMD -MT dependencies -MF /Users/mooner/Library/Developer/Xcode/DerivedData/MoonCo_TiltFinder-gzpflywfciaabtachdctgqaarhmu/Build/Intermediates/MoonCo_TiltFinder.build/Debug-iphonesimulator/MoonCo_TiltFinder.build/Objects-normal/i386/ASIDownloadCache.d -c /Volumes/One.One/Development/Cam-MoonCo_TabBar/MoonCo_CustomTabBar/ASIDownloadCache.m -o /Users/mooner/Library/Developer/Xcode/DerivedData/MoonCo_TiltFinder-gzpflywfciaabtachdctgqaarhmu/Build/Intermediates/MoonCo_TiltFinder.build/Debug-iphonesimulator/MoonCo_TiltFinder.build/Objects-normal/i386/ASIDownloadCache.o
fatal error: cannot open file '/Volumes/One.One/Development/Cam-MoonCo_TabBar/MoonCo_CustomTabBar/CFNetwork.framework/Headers/CFHTTPMessage.h':
Had the same problem. Cleaning the project via Command Shift K solved it for me.

invalid value '' in '-std=' when switch from GCC 4.2 to LLVM 2.0

I'd like to change from using GCC version 4.2 to LLVM version 2.0 in XCode4.
When I change the compiler flag to to LLVM I get an error: invalid value '' in '-std='. Was having it in the *_prefix.pch file, but after turning off the GCC_Precompile_prefix_header the error moved to a new point in my code.
The initial value use seems to refer to an empty string.
What's going on here.
The full error message is below.
Many thanks
CompileC /Users/cram/Library/Developer/Xcode/DerivedData/MightyMemory-cceuiavwfpmibiczfvlodqgugfnb/Build/Intermediates/MightyMemory.build/Debug-iphonesimulator/MightyMemory.build/Objects-normal/i386/GameViewController.o Classes/GameViewController.m normal i386 objective-c com.apple.compilers.llvm.clang.1_0.compiler
cd /Users/cram/Projects/MightyMemory
setenv LANG en_US.US-ASCII
setenv PATH "/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin:/Developer/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/bin:/opt/local/bin:/usr/local/git/bin"
/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/clang -x objective-c -arch i386 -fmessage-length=0 -fdiagnostics-print-source-range-info -fdiagnostics-show-category=id -fdiagnostics-parseable-fixits -std= -Wno-trigraphs -fpascal-strings -O0 -Wreturn-type -Wparentheses -Wswitch -Wno-unused-parameter -Wunused-variable -Wunused-value -isysroot /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator4.3.sdk -fexceptions -fasm-blocks -mmacosx-version-min=10.6 -gdwarf-2 -fvisibility=hidden -fobjc-abi-version=2 -fobjc-legacy-dispatch -D__IPHONE_OS_VERSION_MIN_REQUIRED=40000 -iquote /Users/cram/Library/Developer/Xcode/DerivedData/MightyMemory-cceuiavwfpmibiczfvlodqgugfnb/Build/Intermediates/MightyMemory.build/Debug-iphonesimulator/MightyMemory.build/MightyMemory-generated-files.hmap -I/Users/cram/Library/Developer/Xcode/DerivedData/MightyMemory-cceuiavwfpmibiczfvlodqgugfnb/Build/Intermediates/MightyMemory.build/Debug-iphonesimulator/MightyMemory.build/MightyMemory-own-target-headers.hmap -I/Users/cram/Library/Developer/Xcode/DerivedData/MightyMemory-cceuiavwfpmibiczfvlodqgugfnb/Build/Intermediates/MightyMemory.build/Debug-iphonesimulator/MightyMemory.build/MightyMemory-all-target-headers.hmap -iquote /Users/cram/Library/Developer/Xcode/DerivedData/MightyMemory-cceuiavwfpmibiczfvlodqgugfnb/Build/Intermediates/MightyMemory.build/Debug-iphonesimulator/MightyMemory.build/MightyMemory-project-headers.hmap -I/Users/cram/Library/Developer/Xcode/DerivedData/MightyMemory-cceuiavwfpmibiczfvlodqgugfnb/Build/Products/Debug-iphonesimulator/include -I/Users/cram/Library/Developer/Xcode/DerivedData/MightyMemory-cceuiavwfpmibiczfvlodqgugfnb/Build/Intermediates/MightyMemory.build/Debug-iphonesimulator/MightyMemory.build/DerivedSources/i386 -I/Users/cram/Library/Developer/Xcode/DerivedData/MightyMemory-cceuiavwfpmibiczfvlodqgugfnb/Build/Intermediates/MightyMemory.build/Debug-iphonesimulator/MightyMemory.build/DerivedSources -F/Users/cram/Library/Developer/Xcode/DerivedData/MightyMemory-cceuiavwfpmibiczfvlodqgugfnb/Build/Products/Debug-iphonesimulator -include /Users/cram/Projects/MightyMemory/MaxMemory_Prefix.pch -c /Users/cram/Projects/MightyMemory/Classes/GameViewController.m -o /Users/cram/Library/Developer/Xcode/DerivedData/MightyMemory-cceuiavwfpmibiczfvlodqgugfnb/Build/Intermediates/MightyMemory.build/Debug-iphonesimulator/MightyMemory.build/Objects-normal/i386/GameViewController.o
error: invalid value '' in '-std='
I solved the problem. For the next person to run up against this: It turns out that the options that were passed to the compiler were incorrect; not that I changed them from what they were when using gcc. The error was that the GCC_C_LANGUAGE_STANDARD was not set, i.e. the argument that XCode4 put is was '' (a blank string). I set it to compiler default and all was good.

Resources