Build iOS native code without -gmodules flag - ios

I intentionally downgraded the clang version I'm compiling with in xcode to a special 3.6 version.
Now I've an error on a flag that was added on a later version of clang
clang-3.6: error: unknown argument: '-gmodules'
Which switch I should disable on Xcode to not add this flag on build ?

Related

Not able to build openh264 for ios because of libstdc++

I am trying to build openh264 for ios. I have downloaded the source code from the latest release. then changed the PREFIX in makefile to ios_local. After that I did make OS=ios ARCH=arm64 which completed with lot of warning.
After that when I did sudo make OS=ios ARCH=arm64 install It exited with error like below
clang: warning: libstdc++ is deprecated; move to libc++ with a minimum deployment target of iOS 7 [-Wdeprecated]
ld: library not found for -lstdc++
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [libopenh264.2.0.0.dylib] Error 1
After researching it seems like Apple does not support libstdc++ now, so mac os compatible version is libc++ which is supposed to be installed when you install XCode. My XCode version is Version 10.2.1 (10E1001) which is more than enough to get this libc++ I think.I am using macOS Mojave. What's going wrong here?

ld: warning: -no_pie ignored for arm64

I used "-no_pie" for LDFLAGS , but prompt: "ld: warning: -no_pie ignored for arm64".
then I use otool to check the binary ,there is no PIE flag with V7 and V7S cpusubtype,but still in ARM64,is the ld don't support -no_pie for ARM64?
This came up for me on an older ObjC project when I upped the Deployment Target from 9.0 to 10.0. It only occurred when I archived the project or when I ran it on a physical device. To removed the warning, I set the Build Setting 'Generate Position-Dependent Executable' to 'No'. It was previously set to 'Yes'.

Carthage fails when trying to install FontAwesomeSwift in iOS project

I am trying to install FontAwesome.Swift in my Xcode project (Swift) so I created a Cartfile with the following line
github "thii/FontAwesome.swift" >= 0.4.1
as described here. Then I ran
carthage update and this happened :
==> carthage update
*** Fetching FontAwesome.swift
*** Checking out FontAwesome.swift at "0.6.0"
*** xcodebuild output can be found in /var/folders/fr/sn4l2f393_v_ytcwkb0lx7_40000gp/T/carthage-xcodebuild.4QnCto.log
*** Building scheme "FontAwesome" in FontAwesome.xcodeproj
** BUILD FAILED **
The following build commands failed:
CompileSwift normal x86_64 <path_to_project>/<ProjectName>/Carthage/Checkouts/FontAwesome.swift/FontAwesome/FontAwesome.swift
CompileSwiftSources normal x86_64 com.apple.xcode.tools.swift.compiler
(2 failures)
<path_to_project>/<ProjectName>/Carthage/Checkouts/FontAwesome.swift/FontAwesome/FontAwesome.swift:72:61: error: 'String.Index' does not have a member named 'advancedBy'
A shell task failed with exit code 65:
** BUILD FAILED **
The following build commands failed:
CompileSwift normal x86_64 <path_to_project>/<ProjectName>/Carthage/Checkouts/FontAwesome.swift/FontAwesome/FontAwesome.swift
CompileSwiftSources normal x86_64 com.apple.xcode.tools.swift.compiler
(2 failures)
I deduce from the error message:
'String.Index' does not have a member named 'advancedBy'
that you are still using Xcode 6.x? The advancedBy API is only available as of Swift 2.0 which ships with Xcode 7.
So, you have two options:
Upgrade your project to Xcode 7 / Swift 2.0
Edit your project's Cartfile so that it fetches a version of FontAwesome.swift that is compatible with you Xcode version. It seems FontAwesome.swift migrated to Swift 2.0 with version 0.6, so specifying a version < 0.6 (instead of >= 0.4.1) might do it.
In case you have both versions of Xcode installed, then Carthage may still use the command line tools from Xcode 6.x instead of the newer ones. You could fix this with the xcodeselect command in Terminal, but it's also possible to switch to the desired version of the tools in the Xcode Preferences (Locations tab).

stop compilation switching to clang

No matter what I try, any compilation I attempt always calls clang. For example, in CMake, setting CC=/usr/bin/gcc has no effect and clang is still called. In terminal entering any compiler results in clang being called:
~/tinyos-main/tools$ nescc
clang: error: no input files
~/tinyos-main/tools$ gcc
clang: error: no input files
Can I stop this? Running on OS X Yosemite and using home-brew.
~$ /usr/bin/gcc --version
Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/usr/include/c++/4.2.1
Apple LLVM version 6.0 (clang-600.0.56) (based on LLVM 3.5svn)
Target: x86_64-apple-darwin14.0.0
Thread model: posix
No, gcc is not installed as /usr/bin/gcc. Clang is installed as /usr/bin/gcc, because Apple doesn't ship gcc anymore. If you want gcc, you need to install it (presumably by saying brew install gcc) and then setting CC=/usr/local/bin/gcc.

Linking dylibs installed on MacOSX for iOS app

I want to use libcaldav with following dependency. I have built libcaldav.0.dylib while other dependencies were installed with port or brew on MAC
otool -L ~/lib/libcaldav.0.dylib
~/lib/libcaldav.0.dylib:
~/lib/libcaldav.0.dylib (compatibility version 1.0.0, current version 1.6.0)
/opt/local/lib/libcurl.4.dylib (compatibility version 8.0.0, current version 8.0.0)
/opt/local/lib/libgnutls.28.dylib (compatibility version 70.0.0, current version 70.1.0)
/opt/local/lib/libgthread-2.0.0.dylib (compatibility version 4201.0.0, current version 4201.0.0)
/opt/local/lib/libglib-2.0.0.dylib (compatibility version 4201.0.0, current version 4201.0.0)
/opt/local/lib/libintl.8.dylib (compatibility version 10.0.0, current version 10.2.0)
/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1197.1.1)
I tried adding those files to Xcode ios app using
Link binary with libraries -> Xcode build phase
Other linker flags -> Build Settings
Setting appropriate search paths
However, I get following warning and error
ld: building for iOS Simulator, but linking against dylib built for
MacOSX file '/lib/libcaldav.0.dylib' for architecture x86_64 clang:
error: linker command failed with exit code 1 (use -v to see
invocation)
Enviroment
Xcode = 6.1
supported Platform = iOS
valid architecture = arm64, armv7 and armv7s
libcaldav source
https://github.com/fd00/yacp/tree/master/libcaldav
Please help me as I have been struggling. Please give me pointers what needs to be done.
You need to build these libraries for iOS and not OS X. Specifically, you will need to use the iOS SDK and armv7 and arm64. If you want to use them in the iOS Simulator as well, you will need to build them for i386 and x86_64 against the iOS Simulator SDK (NOT against the host SDK).
See my answer in cross compile libgcrypt static lib for use on iOS for some hints as to how to do this.

Resources