Kivy Application Fatal signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0x40 in tid 10919 (SDLThread) after opening the app in the android device - kivy

Fatal signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0x40 in tid 10919 (SDLThread), pid 10882 (org.test.myapp)
this it the last line of the logcat, I am really clueless on what happened because even if I revert everything that I applied, even in the first ever deployment build that I am sure will work on my device because I've tried it before now gives the above error, but when I use my friends phone on an android 10 device it works flawlessly. below is my buildozer spec file... some say it might be a native library issue wherein 32bit libraries cannot work with a 64bit library
requirements = android,python3,kivy,kivymd,certifi,pillow,camera4kivy,gestures4kivy,numpy,keras,opencv-python,requests,urllib3,chardet,idna,beautifulsoup4
# change the major version of python used by the app
osx.python_version = 3
# Kivy version to use
osx.kivy_version = 1.9.1
# (list) Permissions
android.permissions = INTERNET,CAMERA,RECORD_AUDIO,WRITE_EXTERNAL_STORAGE,READ_EXTERNAL_STORAGE
# (list) features (adds uses-feature -tags to manifest)
#android.features = android.hardware.usb.host
# (int) Target Android API, should be as high as possible.
android.api = 31
# (list) The Android archs to build for, choices: armeabi-v7a, arm64-v8a, x86, x86_64
# In past, was `android.arch` as we weren't supporting builds for multiple archs at the same time.
android.archs = arm64-v8a, armeabi-v7a
p4a.hook = camerax_provider/gradle_options.py
I tried reverting to my most basic app before reverting my code in kivy python and buildozer, and now it gives that error... is it on my phone?

I had the same problem, SIGSEGV due to graphics thread. I managed to find a solution. The problem was using kivymd 1.1.1, I specified a different version(1.0.2) in buildozer.spec requirements, and the error was gone.
I attach the reference where I found the solution: https://github.com/Android-for-Python/Android-for-Python-Users#null-pointer-dereference

Related

Windows 11 / Arm64 - USB Serial Driver

Good day. We currently deploy our own drivers for Windows 32bit and 64bit. I am trying to update the USBSerial driver to work on Windows 11 ARM. Based on the documentation i am finding, i thought it would be as simple as adding the ARM64 block, but it will not work.
Added this up at the top
[Manufacturer]
%MFGNAME%=DeviceList, NTamd64, NTarm64
And then i added this block
;------------------------------------------------------------------------------
; ARM64
;------------------------------------------------------------------------------
[DriverInstall.NTarm64]
include=mdmcpq.inf
CopyFiles=FakeModemCopyFileSection
AddReg=DriverInstall.NTarm64.AddReg
[DriverInstall.NTarm64.AddReg]
HKR,,DevLoader,,*ntkern
HKR,,EnumPropPages32,,"MsPorts.dll,SerialPortPropPageProvider"
[DriverInstall.NTarm64.Services]
AddService=usbser, 0x00000002, DriverService.NTarm64
[DriverService.NTarm64]
DisplayName=%SERVICE%
ServiceType=1
StartType=3
ErrorControl=1
ServiceBinary=%12%\%DRIVERFILENAME%.sys
and here is my PIC/VID block which is just a copy with the new arm64 (removed the pids/vids for safety)
[SourceDisksFiles]
[SourceDisksNames]
[DeviceList]
%DESCRIPTION%=DriverInstall, <listed here>
[DeviceList.NTamd64]
%DESCRIPTION%=DriverInstall, <listed here>
[DeviceList.NTarm64]
%DESCRIPTION%=DriverInstall, <listed here>
Any other thoughts on what i might be missing for making the driver work?
this is the command i use on the windows 11/arm machine to generate the cat file
"C:\Program Files (x86)\Windows Kits\10\bin\10.0.22000.0\x86\inf2cat" /driver:"C:\Users\source\Source" /os:7_X86,7_X64,XP_X86,XP_X64,8_ARM /verbose
I don't get any errors and it builds the cat file fine.. but this is still happening when i try to use the driver on my device
Doesn't seem like there is an easy way to debug this process either.
Thanks

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.

Building OpenCV with CUDA support Error on transpose.cu

Recently I am trying to build OpenCV with CUDA support, and I met problem while building the module cudaarithm.
OpenCV source: git cloned from : http://github.com/Itseez/opencv.git
OpenCV branch: master branch
OpenCV commit:
`commit 5466e321b8c8f97536002a357e5b7ff49a5d2bf9, on Tue Feb 10 12:17:11 2015 +0000`
CUDA version: CUDA 6.5
Hardware: MacBook Pro (13-inch, Mid 2010)
GPU: NVIDIA GeForce 320M 256 MB
OS Version: OS X Yosemite
Steps I used:
1. cd in OpenCVSource, then mkdir myrelease, and cd myrelease
2. cmake -DPLANTUML_JAR=/usr/local/Cellar/plantuml/8002 -D BUILD_DOCS=1 -DPYTHON2_LIBRARY=/usr/local/Cellar/python/2.7.8_2/Frameworks/Python.framework/Versions/2.7/lib/python2.7/config/libpython2.7.dylib -DPYTHON2_INCLUDE_DIR=/usr/local/Cellar/python/2.7.8_2/Frameworks/Python.framework/Versions/2.7/include/python2.7 -DPYTHON3_LIBRARY=/usr/local/Cellar/python3/3.4.2_1/Frameworks/Python.framework/Versions/3.4/lib/libpython3.4m.dylib -DPYTHON3_INCLUDE_DIR=/usr/local/Cellar/python3/3.4.2_1/Frameworks/Python.framework/Versions/3.4/include/python3.4m -D CMAKE_BUILD_TYPE=RELEASE -DCMAKE_INSTALL_PREFIX=/usr/local -Wno-dev -DNVCC_FLAGS_EXTRA="-Xcompiler -stdlib=libstdc++; -Xlinker -stdlib=libstdc++" -DOPENCV_EXTRA_CXX_FLAGS=" -stdlib=libstdc++" -DOPENCV_EXTRA_EXE_LINKER_FLAGS="-stdlib=libstdc++" ..
3. make VERBOSE=1
Expect Result: Building success without error
Actual Result: when building OpenCVSource/modules/cudaarithm/src/cuda/transpose.cu, error happend like below:
/Users/Hawk/Documents/study/DIP/OpenCV/OpenCVSource/modules/cudaarithm/src/cuda/transpose.cu(61): *error: identifier "getInputMat" is undefined*
/Users/Hawk/Documents/study/DIP/OpenCV/OpenCVSource/modules/cudaarithm/src/cuda/transpose.cu(67): *error: identifier "getOutputMat" is undefined*
/Users/Hawk/Documents/study/DIP/OpenCV/OpenCVSource/modules/cudaarithm/src/cuda/transpose.cu(92): *error: identifier "syncOutput" is undefined*
Then what action I take:
check the code and I found these undefined symboles are defined in OpenCVSource/modules/core/include/opencv2/core/private.cuda.hpp
check the code and I confrim that the "transpose.cu" file include "opencv2/core/private.cuda.hpp"
check the building log, and I the confirm the private.cuda.hpp is in the search path of header file
cp "opencv2/core/private.cuda.hpp" as another file "opencv2/core/hawk.hpp", and then edit "transpose.cu" to include this new file, and I found
the "undifined symbole error" disapeared.
Although this is a workable workaround, I would like know whether the original OpenCV source cannot be compiled.
All, I think I found the problem cause.
Before I met such problem, I've already build and install OpenCV using older code from the git repo. So that there already have header files in my /usr/local/include/opencv2, especially there is /usr/local/include/opencv2/core/private.cuda.hpp.
However, it is an older one that doesn't define the symbols reporting undefined in above question. At the same time I found during the building nvcc have -I/usr/local/include in the command line, so that it use wrong private.cuda.hpp. As you know it should use the one in OpenCVSource, not the older installed one.
I think the solution is to gracefully remove the original installed OpenCV from my computer, then build again. I am trying and I will report later.

Xcode5: Failed to register "/System/Library/CoreServices/CoreTypes.bundle/Contents/Library/MobileDevices.bundle

My library has some type converters. I'm registering some OSX and iOS type converters, like so:
When I compile for iOS, I'm getting some errors related to not being able to find UIKit. Here's how I compile for iOS:
xcodebuild -destination OS=${module.sdk.version},name=iPhone -workspace ${workspace} -scheme '${library.ios.scheme}'
The ${} tokens are patched in by my build system.
When building I get:
__build.library.ios.simulator:
[exec] Details: Failed to register "/System/Library/CoreServices/CoreTypes.bundle/Contents/Library/MobileDevices.bundle" with Launch Services, error code: -10811.
[exec] Function: __RegisterUTIsIfNeeded_block_invoke
[exec] Thread: <NSThread: 0x7faca140e5c0>{name = (null), num = 1}
[exec] Please file a bug at http://bugreport.apple.com with this warning message and any useful information you can
How can I fix this?
This appears to be an compiler bug, and there's not much that can be done about it.
Here is oficial answer on JetBrains Tracker:
Anton Makeev 17 Sep 2013, 19:36
build error doesn't affect compilation results - it's just a log message from xcodebuild.
Simulator should work correctly after you run it at least once in Xcode 5.
and:
We will handle this output in AppCode (show it as a warning, not a n error) but we recommend filing the error to Apple as the message suggests - unfortunately we can't fix it (only hide)
and:
Build error won't go away until we implement 'hide-it-fix' or until Apple fixes it. It is harmless, though and doesn't affect build result.

CMake with iOS Toolchain: Can't Find Threads

I'm trying to use ios-cmake to generate Xcode project targeting iOS. However, it cannot find Threads. Here's a simple CMake script for demonstration:
CMAKE_MINIMUM_REQUIRED (VERSION 2.8)
PROJECT (MyCITest)
SET (CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake/modules")
########################
# EDIT: I've also tried adding the lines below prior to posting this question,
# but there doesn't seem to be any effect.
# (http://stackoverflow.com/questions/8386897)
SET (CMAKE_REQUIRED_INCLUDES ${CMAKE_IOS_SDK_ROOT}/usr ${CMAKE_IOS_SDK_ROOT}/usr/include)
SET (CMAKE_CXX_FLAGS "--sysroot=${CMAKE_IOS_SDK_ROOT} ${CMAKE_CXX_FLAGS}")
SET (CMAKE_C_FLAGS "--sysroot=${CMAKE_IOS_SDK_ROOT} ${CMAKE_C_FLAGS}")
########################
FIND_PACKAGE (ZLIB REQUIRED)
FIND_PACKAGE (LibXml2 REQUIRED)
FIND_PACKAGE (Threads REQUIRED)
Running CMake from the terminal:
cmake .. -DCMAKE_TOOLCHAIN_FILE=../cmake/toolchains/iOS.cmake -GXcode
This is the output I got:
-- Toolchain using default iOS SDK: /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS6.0.sdk
-- Found ZLIB: /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS6.0.sdk/usr/lib/libz.dylib (found version "1.2.5")
-- Found LibXml2: /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS6.0.sdk/usr/lib/libxml2.dylib (found version "2.7.8")
-- Looking for include file pthread.h
-- Looking for include file pthread.h - not found
CMake Error at cmake/modules/FindPackageHandleStandardArgs.cmake:97 (MESSAGE):
Could NOT find Threads (missing: Threads_FOUND)
Call Stack (most recent call first):
cmake/modules/FindPackageHandleStandardArgs.cmake:288 (_FPHSA_FAILURE_MESSAGE)
cmake/modules/FindThreads.cmake:166 (FIND_PACKAGE_HANDLE_STANDARD_ARGS)
CMakeLists.txt:8 (FIND_PACKAGE)
-- Configuring incomplete, errors occurred!
I've already triple-checked that pthread.h is located in /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS6.0.sdk/usr/include, and besides, it located ZLib and LibXML2 without a problem, so I'm not sure what I'm doing wrong.
> cmake --version
cmake version 2.8.10.2
None of these solutions seem to work. I found the only thing that consistently worked for me was to set the variables that FindThreads.cmake sets. In other words, define the following in your toolchain file:
set(CMAKE_THREAD_LIBS_INIT "-lpthread")
set(CMAKE_HAVE_THREADS_LIBRARY 1)
set(CMAKE_USE_WIN32_THREADS_INIT 0)
set(CMAKE_USE_PTHREADS_INIT 1)
The problem is indeed due to the call to try_compile failing in FindThreads.cmake. But for me setting CMAKE_CXX_COMPILER_WORKS was not enough. Instead, I changed the type of test performed by try_compile from trying to build an executable to trying to build a static library, by putting this in the toolchain file:
set(CMAKE_TRY_COMPILE_TARGET_TYPE STATIC_LIBRARY)
[Sept 2019] Fix for XCode 11 & iOS 13
As explained here.
Need to use XCODE_ATTRIBUTE_CODE_SIGNING_ALLOWED instead of CMAKE_XCODE_ATTRIBUTE_CODE_SIGNING_REQUIRED below to make this work:
set(CMAKE_TRY_COMPILE_PLATFORM_VARIABLES "XCODE_ATTRIBUTE_CODE_SIGNING_ALLOWED")
set(XCODE_ATTRIBUTE_CODE_SIGNING_ALLOWED "NO")
find_package(Threads REQUIRED)
unset(CMAKE_TRY_COMPILE_PLATFORM_VARIABLES)
unset(XCODE_ATTRIBUTE_CODE_SIGNING_ALLOWED)
[Aug 2019]: Info from CMake's issue tracker
The issue was discussed here and explained by #alcroito. It does not use the custom ios-cmake toolchain but the new native iOS toolchain (CMake 3.14+) but the issue is the same.
Source of the issue
When using the Xcode generator, it will try to sign applications by default. When looking for Threads, CMake calls FindThreads.cmake which will call a TRY_COMPILE test that Xcode will try to sign and fail at.
Proper solution:
Disable signing for the try_compile within FindThreads (seen here):
set(CMAKE_TRY_COMPILE_PLATFORM_VARIABLES "CMAKE_XCODE_ATTRIBUTE_CODE_SIGNING_REQUIRED")
set(CMAKE_XCODE_ATTRIBUTE_CODE_SIGNING_REQUIRED "NO")
find_package(Threads REQUIRED)
unset(CMAKE_TRY_COMPILE_PLATFORM_VARIABLES)
unset(CMAKE_XCODE_ATTRIBUTE_CODE_SIGNING_REQUIRED)
Other solutions in this thread
Make the binary of that try_compile static, which won't be signed (seen here). That's not great since it should be an executable and not a static lib.
Pass proper information to be able to sign the try_compile executable (seen here). That actually would not work for me.
Skip try_compile (seen here): not quite safe since you'll skip all your compiler tests. That would not work for me either.
Hardcode Threads by overriding what FindThreads does (seen here): quite a dirty workaround.
It turns out that the iOS toolchain currently doesn't support TRY_COMPILE, which is used by CheckIncludeFiles.cmake, which is in turn used by FindThreads.cmake. The toolchain is currently set to skip TRY_COMPILE by using:
set (CMAKE_CXX_COMPILER_WORKS TRUE)
set (CMAKE_C_COMPILER_WORKS TRUE)
Reference: http://code.google.com/p/ios-cmake/issues/detail?id=1&can=1
You can fix try_compile command using next variables in toolchain:
# toolchain.cmake
set(CMAKE_MACOSX_BUNDLE YES)
set(CMAKE_OSX_SYSROOT "iphoneos")
set(CMAKE_XCODE_ATTRIBUTE_CODE_SIGN_IDENTITY "iPhone Developer")
set(MACOSX_BUNDLE_GUI_IDENTIFIER "com.example")
And minimalistic example:
# CMakeLists.txt
cmake_minimum_required(VERSION 2.8)
project(Foo)
find_package(Threads REQUIRED)
add_executable(foo foo.cpp)
Generate output:
> cmake -H. -B_builds -DCMAKE_TOOLCHAIN_FILE=toolchain.cmake -GXcode
...
-- Looking for include file pthread.h
-- Looking for include file pthread.h - found
-- Looking for pthread_create
-- Looking for pthread_create - found
-- Found Threads: TRUE
...
Complete solution
Just to mention, I also encountered the same problem in my project. I commented out the find_package(Threads REQUIRED) line and generate the Xcode proejct. The codes compiled without errors. Maybe Xcode could automatically link with posix thread library.
The solution for me was a combination of the 2 answers before me.
Comment out the 2 lines that disable try_compile
# Skip the platform compiler checks for cross compiling
set (CMAKE_CXX_COMPILER_WORKS TRUE)
set (CMAKE_C_COMPILER_WORKS TRUE)
Then add this to the top of the IOS.cmake toolchain file.
set(MACOSX_BUNDLE_GUI_IDENTIFIER com.example)
set(CMAKE_MACOSX_BUNDLE YES)
set(CMAKE_XCODE_ATTRIBUTE_CODE_SIGN_IDENTITY "iPhone Developer")

Resources