Tweak make package failed: libfakeroot.dylib: mach-o, but wrong architecture - ios

I was trying to make my first tweak for ios using Theos.
And I just used a default tweak template(nic.pl), didnt change anything, I got this error when I tried to run make package:
dyld: could not load inserted library '/usr/local/Cellar/fakeroot/1.22/lib/libfakeroot.dylib' because no suitable image found. Did find:
/usr/local/Cellar/fakeroot/1.22/lib/libfakeroot.dylib: mach-o, but wrong architecture
/usr/local/Cellar/fakeroot/1.22/lib/libfakeroot-0.dylib: mach-o, but wrong architecture
/usr/local/bin/fakeroot: line 181: 3701 Abort trap: 6 FAKEROOTKEY=$FAKEROOTKEY DYLD_INSERT_LIBRARIES="$LIB" "$#"
make: *** [internal-package] Error 134
More Information:
Env: Darwin MacBook pro 16.7.0 Darwin Kernel Version 16.7.0
IOS sdk: I am using the newest version of SDK(iosdk11) & Xcode(9.0), I also tried different SDK, but no luck, I assume the problem here is fake root did not generate compatible binary.
Fakeroot: I just did brew install fakeroot to install.
libfakeroot info: /usr/local/Cellar/fakeroot/1.22/lib/libfakeroot.dylib: Mach-O 64-bit dynamically linked shared library x86_64.

Related

Rails 7, vips on M1 MacBook Air

I'm unable to use Rails 7.0.3.1 with vips on an M1 MacBook Air due to the error:
rails aborted!
LoadError: Could not open library 'glib-2.0.0': dlopen(glib-2.0.0, 0x0005): tried: 'glib-2.0.0' (no such file), '/usr/local/lib/glib-2.0.0' (no such file), '/usr/lib/glib-2.0.0' (no such file), '/Users/brody/Code/tms.next-tms.com.wip2/glib-2.0.0' (no such file).
Could not open library '/opt/local/lib/libglib-2.0.0.dylib': dlopen(/opt/local/lib/libglib-2.0.0.dylib, 0x0005): tried: '/opt/local/lib/libglib-2.0.0.dylib' (mach-o file, but is an incompatible architecture (have (x86_64), need (arm64e)))
I'm using ffi 1.15.1 and can see it searching correctly in /opt/local/lib, but the homebrew package builds binaries for x86_64 rather than arm64e even while using the --build-from-source option (brew install vips --build-from-source).
Has anyone got this working?
I ran into the same issue (with libglib-2.0.0) but then I figured that brew poured glib--2.74.5.arm64_monterey.bottle so why does it find 2.0.0? In my case it was (a dated version of) Navicat linking an old glib
~$ ls -l /usr/local/lib/libglib*
0 lrwxr-xr-x 1 chaos staff 73B Dec 11 11:23 /usr/local/lib/libglib-2.0.0.dylib -> /Applications/Navicat Premium.app/Contents/Frameworks/libglib-2.0.0.dylib
This wasn't the only file however, Navicat linked a total of 71 dylib files. I removed all those symlinks and then the error disappeared

iOS/macOS app distribution failed while using framework after upgrading Xcode12 and macOS BigSur

We are unable to distribute our sample app which uses our framework as well as our users can't.
While archiving and distributing to AppStore, the app is rejected with the following message:
Invalid Bundle - One or more dynamic libraries that are referenced by your app are not present in the dylib search path. If your app contains bitcode, bitcode processing may have failed. Because of these errors, this build of your app will not be able to be submitted for review or placed on the App Store.
The framework contain the bitcode, or at least there's a BITCODE_GENERATION_MODE = bitcode build setting in our .xcconfig, which basically means, the Xcode will add -fembed-bitcode build flag to any clang invocation.
From here, we've started testing using Ad-Hoc builds, to speed up our trial and error attempts, which also fails while Rebuild from bitcode option is selected. Organiser shows the popup with the following contents:
ipatool failed with an exception: #<CmdSpec::NonZeroExitException: $ /Applications/Xcode.app/Contents/Developer/usr/bin/python3 /Applications/Xcode.app/Contents/Developer/usr/bin/bitcode-build-tool -v -t /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin --sdk /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS14.2.sdk -o /var/folders/vz/b0jj0dms4014y5htfv93svfc0000gn/T/ipatool20201130-52097-13rj9hy/thinned-out/arm64/Payload/iosTest.app/Frameworks/SciChart.framework/SciChart --generate-dsym /var/folders/vz/b0jj0dms4014y5htfv93svfc0000gn/T/ipatool20201130-52097-13rj9hy/thinned-out/arm64/Payload/iosTest.app/Frameworks/SciChart.framework/SciChart.dSYM --strip-swift-symbols /var/folders/vz/b0jj0dms4014y5htfv93svfc0000gn/T/ipatool20201130-52097-13rj9hy/thinned-in/arm64/Payload/iosTest.app/Frameworks/SciChart.framework/SciChart
Status: pid 52150 exit 1
Stdout:
SDK path: /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/
Logs provided isn't very informative, here is the snippet from IDEDistributionPipeline.log
-= Output =-
ld: warning: -sdk_version and -platform_version are not compatible, ignoring -sdk_version
Undefined symbols for architecture arm64:
"___llvm_profile_runtime", referenced from:
__hidden#25821_ in 0832.o
__hidden#25821_ in 0833.o
__hidden#25821_ in 0834.o
__hidden#25821_ in 0835.o
__hid
2020-11-30 16:19:17 +0000 den#25821_ in 0836.o
__hidden#25821_ in 0837.o
__hidden#25821_ in 0838.o
...
ld: symbol(s) not found for architecture arm64
Exited with 1z
Failed to compile bundle: /var/folders/vz/b0jj0dms4014y5htfv93svfc0000gn/T/SciChart6aun_sfs/SciChart.arm64.xar
Stderr:
from /Applications/Xcode.app/Contents/Developer/usr/bin/ipatool:2808:in `block in CompileOrStripBitcodeInBundle'
from /Applications/Xcode.app/Contents/Developer/usr/bin/ipatool:2747:in `each'
from /Applications/Xcode.app/Contents/Developer/usr/bin/ipatool:2747:in `CompileOrStripBitcodeInBundle'
from /Applications/Xcode.app/Contents/Developer/usr/bin/ipatool:3016:in `block in ProcessIPA'
from /Applications/Xcode.app/Contents/Developer/usr/bin/ipatool:2978:in `each'
from /Applications/Xcode.app/Contents/Developer/usr/bin/ipatool:2978:in `ProcessIPA'
from /Applications/Xcode.app/Contents/Developer/usr/bin/ipatool:3928:in `<main>'
2020-11-30 16:19:17 +0000 /Applications/Xcode.app/Contents/Developer/usr/bin/ipatool exited with 1
which after bunch of warnings shows the actual error at the end of file (I can't include full log, since it's too much of a raw text):
code = 1061;
description = "ipatool failed with an exception: #<CmdSpec::NonZeroExitException: ...
info = {
};
level = ERROR;
type = exception;
Not sure what to to do with this, I've tried different build settings options, nothing helped... Already contacted apple, but no feedback yet, and knowing them, we can wait far too long...
The strange part here, is if we include our .framework directly as a source code and then archive the app - everything works as expected. If we include it as XCFramework or just .framework, which is pre-built - it fails as described above.
I might miss something simple or obvious here, so please let me know if somebody have some insights on that matter.
Some system info:
macOS BigSur 11.0.1
XCode Version 12.2 (12B45b)
We've tried different combinations of macOS and Xcode, e.g.:
Catalina with Xcode 12
BigSur with Xcode 11
etc.
Any help is greatly appreciated.
Thanks.
Long story short, there were LLVM instrumentation included, which prevents AppStore processing. I've written a whole blog post about it here - https://blog.scichart.com/xcframework-xcode-12-and-bigsur-issues/
To sum up, here is a few required steps to make sure while creating XCFramework for distribution:
Using archive builds is a MUST, release build isn't enough
BUILD_LIBRARY_FOR_DISTRIBUTION must be set to YES
SKIP_INSTALL must be set to NO
GCC_INSTRUMENT_PROGRAM_FLOW_ARCS = NO to turn off GCC instrumentation and remove them from the binary
CLANG_ENABLE_CODE_COVERAGE = NO to turn off code coverage tools from the binary
Having all of the above helped to solve our preparing and distribution problem and hopefully save you some time if you happened to face same issues as we did.

How to build DCMTK 3.6.1 libs for iOS?

I followed Russes' instructions found at http://forum.dcmtk.org/viewtopic.php?f=3&t=3047&start=15
With a fresh copy of his "afab" git branch, I built Xcode project for x86 arch with the command line:
cmake -DIOS_PLATFORM=SIMULATOR64 -G Xcode ../dcmtk.public
or for arm arch with:
cmake -DIOS_PLATFORM=OS -G Xcode ../dcmtk.public
However, my Xcode project can't be successfully built because of, at least, the following errors:
List of Xcode errors on ofchrenc.cc file (for eg. "No class named Implementation in OFCharacterEncoding")
The compilation with Unix makefiles gives the same errors in my case:
Scanning dependencies of target ofstd
0% Building CXX object ofstd/libsrc/CMakeFiles/ofstd.dir/ofchrenc.cc.o
dcmtk.public/ofstd/libsrc/ofchrenc.cc:518:28: error: no class named 'Implementation' in 'OFCharacterEncoding'
class OFCharacterEncoding::Implementation {};
dcmtk.public/ofstd/libsrc/ofchrenc.cc:556:31: error: out-of-line definition of 'getLocaleEncoding' does not match any declaration in
'OFCharacterEncoding'
OFString OFCharacterEncoding::getLocaleEncoding()
/usr/local/include/dcmtk/ofstd/ofchrenc.h:97:21: note: member declaration does not match because it is const qualified
const OFString &getLocaleEncoding() const;
[...]
dcmtk.public/ofstd/libsrc/ofchrenc.cc:644:34: error: out-of-line definition of 'setConversionFlags' does not match any declaration in
'OFCharacterEncoding'
OFCondition OFCharacterEncoding::setConversionFlags(const unsigned flags)
19 errors generated.
make 2: ofstd/libsrc/CMakeFiles/ofstd.dir/ofchrenc.cc.o Error 1
make 1: ofstd/libsrc/CMakeFiles/ofstd.dir/all Error 2
make: [all] Error 2
I don't understand what is wrong in my configuration:
MacOs Sierra 10.12.2
Xcode 8.2
CMake 3.7.1 (I have the same issue previously with 3.5.2 version)
GNU Make 3.81 (for Unix makefiles compilation)
Apple LLVM version 8.0.0.8000042
Darwin version of host: 16.3.0
Building for minimum iOS version: 10.2 (SDK version: 10.2)
I'm not sure about the first error message but
/usr/local/include/dcmtk/ofstd/ofchrenc.h:97:21: note: member
declaration does not match because it is const qualified const
OFString &getLocaleEncoding() const;
seems to indicate that you are mixing an old version of "ofchrenc.h" (stored in "/usr/local/...") with a more recent version of "ofchrenc.cc" (stored in your working directory).

"unable to find utility g++" while trying to compile a MobileSubstrate tweak with Theos (OSX)

OSX Yosemite 10.10.2
I recently installed Theos following this guide, got no problems. However when I try to compile a simple MS tweak, I get this error in Terminal.app:
MBP:noeditnc ned$ cd /Users/ned/noeditnc
MBP:noeditnc ned$ make
Making all for tweak NoEditNC...
Preprocessing Tweak.xm...
Compiling Tweak.xm (armv7)...
xcrun: error: unable to find utility "clang++", not a developer tool or in PATH
make[3]: *** [.theos/obj/armv7/Tweak.xm.5e67a2f0.o] Error 72
make[2]: *** [.theos/obj/armv7/NoEditNC.dylib] Error 2
make[1]: *** [internal-library-all_] Error 2
make: *** [NoEditNC.all.tweak.variables] Error 2
I have Command Line Tools and Xcode both installed and updated to the latest version. Google couldn't help... What am I doing wrong?
EDIT: Clang++ is installed.
MBP:noeditnc ned$ clang++ --version
Apple LLVM version 6.0 (clang-600.0.57) (based on LLVM 3.5svn)
Target: x86_64-apple-darwin14.1.0
Thread model: posix
EDIT 2: Found a solution! I had the wrong sdk version number in /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/ (iPhoneOS8.1 instead of iPhoneOS8.2)

fail to build Opencv in windows using code:block

Following this link. I am stuck in the last two steps during setting up my workstation.
As a compiler I use Code:Block MinGW; I have already generated the compiled opencv files, now I need to build the sln file in Windows. I use Code Block to build this OpenCV Project File in the path D:\OpenCV\Build\Opencv, where I put the generated bin file after using Cmake.
During the building, it stopped at 40%, saying;
Linking CXX executable ....\bin\opencv_perf_core.exe
c:/codeblock/codeblocks/mingw/bin/../lib/gcc/mingw32/4.4.1/../../../../mingw32/bin/ld.exe:
warning: auto-importing has been activated without
--enable-auto-import specified on the command line. This should work unless it involves constant data structures referencing symbols from
auto-imported DLLs. Cannot export _ZN12_GLOBAL__N_13ROp3allEv: symbol
not found Cannot export _ZN12_GLOBAL__N_17CmpType3allEv: symbol not
found collect2: ld returned 1 exit status mingw32-make.exe[2]: *
[bin/opencv_perf_core.exe] Error 1 mingw32-make.exe1: *
[modules/core/CMakeFiles/opencv_perf_core.dir/all] Error 2
mingw32-make.exe: * [all] Error 2 Info: resolving vtable for
cv::_OutputArray by linking to imp_ZTVN2cv12_OutputArrayE
(auto-import) Info: resolving vtable for cv::_InputArray by linking to
imp_ZTVN2cv11_InputArrayE (auto-import) Info: resolving vtable for cv::Exception by linking to imp_ZTVN2cv9ExceptionE (auto-import)
Creating library file: ....\bin\libopencv_perf_core.dll.a Process
terminated with status 2 (14 minutes, 29 seconds) 0 errors, 3 warnings
How can I solve this problem?
Unfortunately, there's not much you can do, according to http://code.opencv.org/issues/2523.
You will have to use a recent version of MinGW. It builds fine using the latest MinGW shipping with GCC 4.7.2.
This issue seems to have been introduced in OpenCV 2.4.3 as it is said version 2.4.2 builds fine.

Resources