Argument unused during compilation: '-fembed-bitcode-marker' - static-libraries

I'm trying to build my library using bitcode! And I'm having strange issues. I added OTHER_CFLAGS="-fembed-bitcode" in my xcconfig which works fine... unless I compile for a real phone as my target.
I'm using an iPhone 4s as a phone, and it tells me Argument unused during compilation: '-fembed-bitcode-marker'
If I try on any simulator (iPhone 4s simulator included) it works perfectly fine and I can see the bitcode using otool -l lib.a | grep LLVM
Anyone knows what could be the issues there?
Thanks a lot!

Related

Build Haskell macOS executable with a deployment target

I want to distribute a gui app built with Haskell, but when I try to open it on a different Mac (with an older macOS) it fails.
This seems to be due to the minos value in the LC_BUILD_VERSION mach-o load-command:
% otool -l ./lamdu | grep minos
minos 11.0
How can I specify to GHC/Cabal/stack the deployment target to use (the equivalent to Clang's -mmacosx-version-min flag)?
Adding these lines to the .cabal file did the trick:
if os(darwin)
ld-options: -mmacosx-version-min=10.9
Even though the build through stack shows warnings that not everything (i.e the used Haskell libs) was build for this deployment target, the executable worked fine when testing on an older macOS

building for UIKitForMac, but linking in .tbd built for macOS

I'm trying to compile my iOS app to work on macOS and after checking the Mac checkbox, I'm getting this error on compile:
d: building for UIKitForMac, but linking in .tbd built for macOS, file '/Users/jan/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/System/Library/Frameworks//GLKit.framework/GLKit.tbd' for architecture x86_64
Any idea what it means and how to fix it?
Though I've not had this particular error I have had similar ones when trying to port from iPad to UIKitForMac. UIKitForMac appears to be the iOS SDK built for x86_64 when you're linking with frameworks. As a result it shouldn't be trying to pull the x86_64 files from the macOS SDK.
I'd be tempted to check over your 'architectures' and 'valid architectures' settings in Xcode to make sure that any settings you have are deleted and switched back to the standard ones.
Remove architectures

homebrew llvm build cannot find iOS simulator library containing _wordexp symbol

I'm working on touching up homebrew's (OS X package manager) llvm formula. Unfortunately, something about the parts I added broke the build in a way I just cannot figure out.
tl;dr ld asks for a library containing a _wordexp symbol for iOS simulator, and I have absolutely no clue where it is, if it exists
Compilation consistently fails for me when the compiler is attempting to link the address sanitizer dylib for iOS Simulator.
Reproduction steps (OS X only as far as I know, don't have *nix systems handy):
install homebrew if it isn't already installed
replace homebrew's llvm formula with the WIP one above
Run brew install llvm --with-clang --with-lldb --verbose --debug
wait for the build to fail and ask you what to do
Drop into a debug shell
cd to projects/compiler-rt/lib/asan/CMakeFiles/clang_rt.asan_iossim_dynamic.dir
add the following line to link.txt
-Wl,-syslibroot /Applications/Xcode-beta.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk
go back up to asan
Run make
At this point on my machine, something like this pops up:
Undefined symbols for architecture x86_64:
"_wordexp", referenced from:
_wrap_wordexp in asan_interceptors.cc.o
substitution_wordexp in asan_interceptors.cc.o
(maybe you meant: _wrap_wordexp)
ld: symbol(s) not found for architecture x86_64
I thought that it was just a matter of adding another folder to the linker search path. Turns out it isn't that simple:
wordexp.h is in <path-to-iPhoneSimulator.sdk>/usr/include, but running
find . -type f -name "*.dylib" -print0 | xargs -0 nm | grep -n "T _wordexp" -B <large number> | less
in Xcode-beta.app showed that the only .dylibs in Xcode that exported a _wordexp symbol were in the WatchSimulator.platform folder
Running the same command in /usr showed that 3 libraries in /usr/lib/system exported _wordexp (libsystem_asl, libsystem_c, and libsystem_blocks), but the linker doesn't seem to care when I add /usr/lib/system to the search path even when the code is the x86_64 code it wants, and the corresponding dylibs I found for other platforms didn't contain _wordexp
Googling about about this particular symbol missing turned up mostly stuff about Apple implementing wordexp() with Perl
I think I remember seeing something in the llvm-dev mailing list archives about *BSD/OSX not implementing wordexp, but the header file is definitely there, wordexp() shows up in the manpages, and the functions declared in the header file seem to work just fine when compiling for OSX
The symbol is not in the libc++(abi) dylibs compiled earlier in the build
Every other part of the build compiles just fine except for the asan folder and its parents
What am I missing? Given that this error does not seem to be particularly common, there could be a chance it's my machine, but I'm hoping the chances are pretty low, because I wiped and reinstalled my computer this weekend.
(OS X 10.11, Xcode/CLT 7.1, mid-2012 Retina pro)
If more info is needed I'll be happy to provide it.
Edit 1: Simplified link.txt fix. Turns out setting sysroot for clang++ doesn't do so for ld
Turns out the error was a result of the way homebrew processed compiler flags. That and a few other problems have been fixed since, so this probably isn't too useful any more.
For those curious about how exactly this broke, homebrew tries to change compiler flags to suppress warnings and create a more consistent building experience. One of these changes was to remove any -isysroot or -system flags, because that was added by homebrew itself at a later stage. Unfortunately, homebrew assumed that only the OS X SDK would be used, so when the build expected to build something with the iPhone simulator SDK it was pointed to the OS X SDK.

Cocos2d 2.x ARC issue on device

I'm working on a game that has cocos2d with ARC.
The game builds & runs fine in Simulator, but when I build for device I get Apple Mac-O Linker Errors, saying that I'm missing the libraries for libcocos2d.a etc.
clang: error: no such file or directory: '/Users/aleksandartrpeski/Library/Developer/Xcode/DerivedData/jellyfish-fsomqwhqasishxcfzhgvccrdvzpt/Build/Products/Debug-iphoneos/libcocos2d.a'
clang: error: no such file or directory: '/Users/aleksandartrpeski/Library/Developer/Xcode/DerivedData/jellyfish-fsomqwhqasishxcfzhgvccrdvzpt/Build/Products/Debug-iphoneos/libCocosDenshion.a'
clang: error: no such file or directory: '/Users/aleksandartrpeski/Library/Developer/Xcode/DerivedData/jellyfish-fsomqwhqasishxcfzhgvccrdvzpt/Build/Products/Debug-iphoneos/libkazmath.a'
clang: error: no such file or directory: '/Users/aleksandartrpeski/Library/Developer/Xcode/DerivedData/jellyfish-fsomqwhqasishxcfzhgvccrdvzpt/Build/Products/Debug-iphoneos/liblibpng.a'
When I go to the folder where the file is missing I only see jellyfish.app.
I don't have much experience in this kind of issues & I'm not clear why this happens,
I checked how to start the project from TinyTimGames & LearnCocos2D, still not clear what I'm doing wrong.
I've solved the issue, the builds for the binaries were somehow ignored by XCode because they were for another architecture, by settings the build settings for the cocos2d target Build For Active Architectures Only to NO, the issue dissapeared.
Sounds like you'll have to add these libraries to the Link Binary With Libraries build phase.
See my tutorial on Enabling ARC for Cocos2D projects for details.
It's strange that it would work for the Simulator though, since it's using the same target. I wouldn't rule out that the device is incompatible, you'll have to have at least a 3rd generation (iPhone 3GS) device running iOS 4.0 or higher.

Compiling the ffmpeg on iPhone?

I downloaded the iFrameExtractor sample code and try to compile it with the iPhone simulator version 3.1.3
The project shows the following errors ( http://img514.imageshack.us/img514/3245/66948298.png ) even thought I added *.a libraries to my project. All libraries was under the library searching path.
I guess it is a linking problem. Anyone can recommend to me a configuration for compiling ffmpeg on x86?
Thanks in advance.
try compiling/building for iPhone Device instead of simulator, I think as the simulator does not has camera so you got the above errors while compiling.
As far as i know you will have to compile the ffmpeg for your simulator you can do that by using ./configure script and put the iPhoneSimulator.platform as the target platform and use arch i386 as architecture .

Resources