Unsupported Architectures .frameworks - swift

I'm using commoncrypto. I added this using carthage. I added the run script. I embed & sign Framework. I also added code to the run script. When I try to install the app in the apple store, I get the error in the photo below. I added framework to input and output. What is the problem?
if [ "${CONFIGURATION}" = "Release" ]; then
APP_PATH="${TARGET_BUILD_DIR}/${WRAPPER_NAME}"
# This script loops through the frameworks embedded in the application and
# removes unused architectures.
find "$APP_PATH" -name '*.framework' -type d | while read -r FRAMEWORK
do
FRAMEWORK_EXECUTABLE_NAME=$(defaults read "$FRAMEWORK/Info.plist" CFBundleExecutable)
FRAMEWORK_EXECUTABLE_PATH="$FRAMEWORK/$FRAMEWORK_EXECUTABLE_NAME"
echo "Executable is $FRAMEWORK_EXECUTABLE_PATH"
EXTRACTED_ARCHS=()
for ARCH in $ARCHS
do
echo "Extracting $ARCH from $FRAMEWORK_EXECUTABLE_NAME"
lipo -extract "$ARCH" "$FRAMEWORK_EXECUTABLE_PATH" -o "$FRAMEWORK_EXECUTABLE_PATH-$ARCH"
EXTRACTED_ARCHS+=("$FRAMEWORK_EXECUTABLE_PATH-$ARCH")
done
echo "Merging extracted architectures: ${ARCHS}"
lipo -o "$FRAMEWORK_EXECUTABLE_PATH-merged" -create "${EXTRACTED_ARCHS[#]}"
rm "${EXTRACTED_ARCHS[#]}"
echo "Replacing original executable with thinned version"
rm "$FRAMEWORK_EXECUTABLE_PATH"
mv "$FRAMEWORK_EXECUTABLE_PATH-merged" "$FRAMEWORK_EXECUTABLE_PATH"
done
fi

Where did you put the script to eliminate i386?
Did you try to download the CommonCrypto.framework.zip file then drag and drop directly to your project?

Related

ERROR ITMS-90085: "No architectures in the binary

The app runs fine on the device and simulator and we are able to build an archive without any issues.
The issue is when we want to upload the build to the app store using Xcode 12.5, we get the following error:
I'm using this script to remove unused architectures before submission.
And encountered the same problem as you.
So I checked the archive log in Xcode, I fond that some binary are non-fat file. For example error >
fatal error: lipo: input file (/Users/.../MyApp.app/Frameworks/MyFramework.framework/MyFramework) must be a fat file when the -extract option is specified
Looking at the script, because of that error So there is no extraction to create "-merged" file.
At the last step "Replacing original executable with thinned version"
echo "Replacing original executable with thinned version"
rm "$FRAMEWORK_EXECUTABLE_PATH"
mv "$FRAMEWORK_EXECUTABLE_PATH-merged" "$FRAMEWORK_EXECUTABLE_PATH"
It deletes the original binary. !!!
For workaround solution, I just add if condition to check -merged file exists
So I modified the script to this >
APP_PATH="${TARGET_BUILD_DIR}/${WRAPPER_NAME}"
# This script loops through the frameworks embedded in the application and
# removes unused architectures.
find "$APP_PATH" -name '*.framework' -type d | while read -r FRAMEWORK
do
FRAMEWORK_EXECUTABLE_NAME=$(defaults read "$FRAMEWORK/Info.plist" CFBundleExecutable)
FRAMEWORK_EXECUTABLE_PATH="$FRAMEWORK/$FRAMEWORK_EXECUTABLE_NAME"
echo "Executable is $FRAMEWORK_EXECUTABLE_PATH"
EXTRACTED_ARCHS=()
for ARCH in $ARCHS
do
echo "Extracting $ARCH from $FRAMEWORK_EXECUTABLE_NAME"
lipo -extract "$ARCH" "$FRAMEWORK_EXECUTABLE_PATH" -o "$FRAMEWORK_EXECUTABLE_PATH-$ARCH"
EXTRACTED_ARCHS+=("$FRAMEWORK_EXECUTABLE_PATH-$ARCH")
done
echo "Merging extracted architectures: ${ARCHS}"
lipo -o "$FRAMEWORK_EXECUTABLE_PATH-merged" -create "${EXTRACTED_ARCHS[#]}"
rm "${EXTRACTED_ARCHS[#]}"
# Check $FRAMEWORK_EXECUTABLE_PATH-merged (thin file) exists then replace to the original version (fat file)
if [ -f "$FRAMEWORK_EXECUTABLE_PATH-merged" ]; then
echo "Replacing original executable with thinned version"
rm "$FRAMEWORK_EXECUTABLE_PATH"
mv "$FRAMEWORK_EXECUTABLE_PATH-merged" "$FRAMEWORK_EXECUTABLE_PATH"
fi
done
it worked perfectly
Solved this error using pod 'Stripe', '19.4.1' So if someone faced this error using Xcode 12.5 or above then use the above pod version.

Error in run script phase: framework is a directory

I'm using the apollo framework for GraphQL that I installed using Carthage but I have an error when I run the script to generate the API.swift file during the build phase.
The error is
> [myproject]/Carthage/Build/iOS/Apollo.framework: is a directory
Command /bin/sh failed with exit code 126
I did added the script like in the apollo doc :
Here is the script itself:
APOLLO_FRAMEWORK_PATH="$(eval find $FRAMEWORK_SEARCH_PATHS -name "Apollo.framework" -maxdepth 1)"
if [ -z "$APOLLO_FRAMEWORK_PATH" ]; then
echo "error: Couldn't find Apollo.framework in FRAMEWORK_SEARCH_PATHS; make sure to add the framework to your project."
exit 1
fi
cd "${SRCROOT}/${TARGET_NAME}"
$APOLLO_FRAMEWORK_PATH/check-and-run-apollo-codegen.sh generate $(find . -name '*.graphql') --schema schema.json --output API.swift
Of course, I have also generated the schema.json beforehand
Might be a bit late to answer but at least on my machine APOLLO_FRAMEWORK_PATH gets evaluated to two frameworks (iOS and watchOS) and thus running the bundled script with $APOLLO_FRAMEWORK_PATH/check-and-run-apollo-codegen.sh fails.
Assuming the scripts don't differ (as of version apollo-ios#0.8.0 they don't) you can add -print -quit to the end of the find command to make it return only one result.
The full script will be:
APOLLO_FRAMEWORK_PATH="$(eval find $FRAMEWORK_SEARCH_PATHS -name "Apollo.framework" -maxdepth 1 -print -quit)"
if [ -z "$APOLLO_FRAMEWORK_PATH" ]; then
echo "error: Couldn't find Apollo.framework in FRAMEWORK_SEARCH_PATHS; make sure to add the framework to your project."
exit 1
fi
cd "${SRCROOT}/${TARGET_NAME}"
$APOLLO_FRAMEWORK_PATH/check-and-run-apollo-codegen.sh generate $(find . -name '*.graphql') --schema schema.json --output API.swift

Source RPM Can't Find Files

I'm trying to build an RPM of a node.js project I'm working on. The project's code is entirely contained in one directory and its subdirectories. Here's part of my build script:
Put everything in the SOURCES directory, except the node_modules
echo "Copying sources..."
cd $DIR/dashboard
tar -zcf $DIR/rpmbuild/SOURCES/project-$VERSION.tgz . --exclude=node_modules > /dev/null
cd $DIR
# Create the spec file
touch $DIR/rpmbuild/SPECS/specfile
# write to it
cat >$DIR/rpmbuild/SPECS/specfile <<EOL
Summary: [Summary]
Name: [Name]
Version: $VERSION
Release: 1
License: GPL
Group: Applications/WebApp
Source: [Name]-$VERSION.tgz
Vendor: None
Requires: nodejs
%description
[Description]
%prep
echo "in prep"
echo $(ls -al)
%setup -c
npm install
yes | ./compile_all.sh
mv app/index.html app/index_big.html
mv app/index_small.html app/index.html
%build
echo "Nothing to build!"
%install
mkdir -p /opt/project
mv -r ./ /opt/project
ln -s /opt/project/server_start /usr/local/bin
ln -s /opt/project/server_stop /usr/local/bin
%files
$DIR/rpmbuild/SOURCES
$DIR/rpmbuild/SPECS
EOL
HOME=`pwd` rpmbuild -bs $DIR/rpmbuild/SPECS/specfile
The compile_all.sh script just minifies the html, css, and javascript and concatenates them. index_small.html uses the smaller versions. $DIR points to the location of the script, which is one directory above the project code.
The script does indeed generate the source rpm. I've looked at it using mc, and inside CONTENTS.cpio there's the specfile and the tgz archive of the source code. However, trying to install doesn't work. With rpm -Vp project.rpm, I can see that it lists the specfile and the tgz archive as missing. With verbose mode enabled, I see something similar to:
Directories not explicitly included in package:
/home/USERNAME/rpmbuild/SPECS/
/home/USERNAME/rpmbuild/SOURCES`
My rpmbuild directory isn't in my home directory, it's in the same directory as the build script. This leads to my actual question: how can I point rpmbuild at the correct location?

iOS DOxygen adding docSet to Xcode Documents

Hey Everyone just having a problem with DOxygen, Ive generated my documentation and its allthere, but i find i am unable to add it to Xcode.
I currently have a script which takes the HTML directory containing all the files, and generates the .docset file.
# Run the makefile. The --silent parameter stops it from spamming us with too much output.
#/Applications/Xcode.app/Contents/Developer/usr/bin/docsetutil
make --silent -C "$DOCSET_OUTPUT/html" install
# Load docset
osascript "$[location of personal library]/Scripts/XcodeLoadDocSet.scpt"
"~/Library/Developer/Shared/Documentation/DocSets/$DOXYGEN_ID.docset"
This should also add the item to xcode, but running it manually reveals a problem..
/Developer/usr/bin/docsetutil index com.[my app].docset
make: /Developer/usr/bin/docsetutil: No such file or directory
make: *** [docset] Error 1
This is what i have atm for the makefile,
DOCSET_NAME=com.[my app].docset
DOCSET_CONTENTS=$(DOCSET_NAME)/Contents
DOCSET_RESOURCES=$(DOCSET_CONTENTS)/Resources
DOCSET_DOCUMENTS=$(DOCSET_RESOURCES)/Documents
DESTDIR=~/Library/Developer/Shared/Documentation/DocSets
XCODE_INSTALL=$(shell xcode-select -print-path)
all: docset
docset:
mkdir -p $(DOCSET_DOCUMENTS)
cp Nodes.xml $(DOCSET_RESOURCES)
cp Tokens.xml $(DOCSET_RESOURCES)
cp Info.plist $(DOCSET_CONTENTS)
tar --exclude $(DOCSET_NAME) \
--exclude Nodes.xml \
--exclude Tokens.xml \
--exclude Info.plist \
--exclude Makefile -c -f - . \
| (cd $(DOCSET_DOCUMENTS); tar xvf -)
$(XCODE_INSTALL)/usr/bin/docsetutil index $(DOCSET_NAME)
rm -f $(DOCSET_DOCUMENTS)/Nodes.xml
rm -f $(DOCSET_DOCUMENTS)/Info.plist
rm -f $(DOCSET_DOCUMENTS)/Makefile
rm -f $(DOCSET_RESOURCES)/Nodes.xml
rm -f $(DOCSET_RESOURCES)/Tokens.xml
install: docset
mkdir -p $(DESTDIR)
cp -R $(DOCSET_NAME) $(DESTDIR)
uninstall:
rm -rf $(DESTDIR)/$(DOCSET_NAME)
always:
If anyone has had a similer problem please let me know.
Cheers
Michael.
With Xcode 4, docsetutil is located under /Applications/Xcode.app/Contents/Developer/usr/bin/

fail building ffmpeg for armv6-7

I've been trying to build ffmpeg in every possible way I can think of. I'm trying with the latest revision from their git repository and with a build script which I have confirmation that it works, it's from this question: iPhone SDK 4.3 libav compiling problem. The script was updated yesterday and apparently works for the guy in the question.
my problem is that it doesn't generate the .a files (or actually any files) for armv6 anc armv7. and therefor the lipo commands, to concat into universal libs, fail. I've also tried using the build scripts from iFrameExtractor without any success it also fails with the lipo-commands in the end, i get the following:
lipo: can't open input file: ./compiled/armv6/lib/libavcodec.a (No such file or directory)
lipo: can't open input file: ./compiled/armv6/lib/libavdevice.a (No such file or directory)
lipo: can't open input file: ./compiled/armv6/lib/libavfilter.a (No such file or directory)
lipo: can't open input file: ./compiled/armv6/lib/libavformat.a (No such file or directory)
lipo: can't open input file: ./compiled/armv6/lib/libavutil.a (No such file or directory)
lipo: can't open input file: ./compiled/armv6/lib/libpostproc.a (No such file or directory)
lipo: can't open input file: ./compiled/armv6/lib/libswscale.a (No such file or directory)
and i have also posted the entire output here if anyone has any idea what to look for there (because i don't know where to start, it almost 5000 lines of output.)
i should also mention that i'm compiling it for armv6, armv7 and i386. I want to import it in XCode to get H.264 frames from video feed.
when i try to build for armv6 i use the following configure:
./configure \
--enable-cross-compile \
--arch=arm \
--extra-cflags='-arch armv6' \
--extra-ldflags='-arch armv6' \
--target-os=darwin \
--cc=/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/gcc \
--sysroot=/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS4.3.sdk \
--cpu=arm1176jzf-s \
--extra-ldflags=-L/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneSimulator4.3.sdk/usr/lib/system \
--prefix=compiled/armv6
and get the following output:
/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/gcc is unable to create an executable file.
C compiler test failed.
If you think configure made a mistake, make sure you are using the latest
version from Git.  If the latest version fails, report the problem to the
ffmpeg-user#ffmpeg.org mailing list or IRC #ffmpeg on irc.freenode.net.
Include the log file "config.log" produced by configure as this will help
solving the problem.
so the question, what c compiler should I use? i've tried different:
arm-apple-darwin10-gcc-4.2.1
arm-apple-darwin10-llvm-gcc-4.2
gcc
but with the same result. gcc works for both i386 and armv7 so i guess it should work for armv6 aswell
i used the following to compile only for armv6 and armv7. I couldn't get it working for i386, i receive errors that the cputype and subcputype are wrong. apparently the cputype is supposed to be x86 and subcputype should be intel.
anyhow i used the following build scripts to compile (i ended up using gcc and it worked, it was the configure flags that were wrong from the beginning i guess) for the arm architectures:
build script:
#!/bin/sh
set -e
SCRIPT_DIR=$( (cd -P $(dirname $0) && pwd) )
DIST_DIR_BASE=${DIST_DIR_BASE:="$SCRIPT_DIR/dist"}
if [ -d ffmpeg ]
then
echo "Found ffmpeg source directory, no need to fetch from git..."
else
echo "Fetching ffmpeg from git://git.videolan.org/ffmpeg.git..."
git clone git://git.videolan.org/ffmpeg.git
fi
ARCHS=${ARCHS:-"armv6 armv7"}
for ARCH in $ARCHS
do
FFMPEG_DIR=ffmpeg-$ARCH
if [ -d $FFMPEG_DIR ]
then
echo "Removing old directory $FFMPEG_DIR"
rm -rf $FFMPEG_DIR
fi
echo "Copying source for $ARCH to directory $FFMPEG_DIR"
cp -a ffmpeg $FFMPEG_DIR
cd $FFMPEG_DIR
DIST_DIR=$DIST_DIR_BASE-$ARCH
mkdir -p $DIST_DIR
case $ARCH in
armv6)
EXTRA_FLAGS="--enable-cross-compile --target-os=darwin --arch=arm --cpu=arm1176jzf-s"
EXTRA_CFLAGS="-arch $ARCH"
EXTRA_LDFLAGS="-arch $ARCH"
;;
armv7)
EXTRA_FLAGS="--enable-cross-compile --target-os=darwin --arch=arm --cpu=cortex-a8 --enable-pic"
EXTRA_CFLAGS="-arch $ARCH"
EXTRA_LDFLAGS="-arch $ARCH"
;;
x86_64)
EXTRA_CC_FLAGS="-mdynamic-no-pic"
;;
esac
echo "Configuring ffmpeg for $ARCH..."
./configure \
--prefix=$DIST_DIR \
--extra-ldflags=-L/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS4.3.sdk/usr/lib/system \
--disable-bzlib \
--disable-doc \
--disable-ffmpeg \
--disable-ffplay \
--disable-ffserver \
--cc=/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/gcc \
--sysroot=/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS4.3.sdk \
--extra-ldflags="$EXTRA_LDFLAGS" \
--extra-cflags="$EXTRA_CFLAGS" \
$EXTRA_FLAGS
echo "Installing ffmpeg for $ARCH..."
make && make install
cd $SCRIPT_DIR
if [ -d $DIST_DIR/bin ]
then
rm -rf $DIST_DIR/bin
fi
if [ -d $DIST_DIR/share ]
then
rm -rf $DIST_DIR/share
fi
done
and combine libs script:
#!/bin/bash
set -e
ARCHS="armv6 armv7"
for ARCH in $ARCHS
do
if [ -d dist-$ARCH ]
then
MAIN_ARCH=$ARCH
fi
done
if [ -z "$MAIN_ARCH" ]
then
echo "Please compile an architecture"
exit 1
fi
OUTPUT_DIR="dist-uarch"
rm -rf $OUTPUT_DIR
mkdir -p $OUTPUT_DIR/lib $OUTPUT_DIR/include
for LIB in dist-$MAIN_ARCH/lib/*.a
do
LIB=`basename $LIB`
LIPO_CREATE=""
for ARCH in $ARCHS
do
if [ -d dist-$ARCH ]
then
LIPO_CREATE="$LIPO_CREATE-arch $ARCH dist-$ARCH/lib/$LIB "
fi
done
OUTPUT="$OUTPUT_DIR/lib/$LIB"
echo "Creating: $OUTPUT"
lipo -create $LIPO_CREATE -output $OUTPUT
lipo -info $OUTPUT
done
echo "Copying headers from dist-$MAIN_ARCH..."
cp -R dist-$MAIN_ARCH/include/* $OUTPUT_DIR/include
then i import the .a files from BUILD-FOLDER/dist-uarch and it builds in xcode like a charm!