In Personally, I am modifying and testing some features of the kotlin-native memory manager.
But, I am struggling to find a way to create an OSX XCode executable, including debugging information of the C++ sources in kotlin-native runtime.
'kotlinc -g ..' generates only debug informations for Kotlin sources.
Please let me know how to build debugging version of runtime and link the debug information into sample kotlin apps.
I am using Kotlin-native 1.3.72, and Xcode 11.5
I think the only available option here is to re-build Kotlin/Native runtime with adding -g compiler option to the Gradle script. See this file and line, probably it should be the correct place.
Related
Currently I am working on one KMM project. It would be really useful to be able to debug the shared code which is in kotlin in xcode project.
I am aware of this solution but I have problem to tell Xcode that *.kt files are source files
to be more specific in the above github link it is written :
You need to tell Xcode that *.kt files are source files, and run an lldb formatter script when debugging starts. Advanced users may want to do this manually, but if you have Xcode installed in the default place, you can run the setup script.
Unless you're using Xcode 11 (in which case look here for help), the following script will install both debugging and formatting support:
./setup.sh
I do not know where and how I should run the ./setup.sh or if there is another way to do it?
The setup script is included in the github repository: https://github.com/touchlab/xcode-kotlin/blob/main/setup.sh
The above plugin is great if you want to debug on Xcode and I highly recommend it.
Just an FYI, in case you didn't notice, there is also a plugin for debugging shared code on iOS for Android Studio: https://plugins.jetbrains.com/plugin/14936-kotlin-multiplatform-mobile
I have an iPad running iOS 13.5 and it is jailbroken.
I installed clang compiler and vim editor on the Cydia store, so I can write code with vim and compile the source code with clang. Both compilation and execution are successful.
Now I have an idea, I know there is a method called cross-compile, so is it possible to compile a C program on iPad that can run in macOS or Windows?
You can certainly compile for macOS. All you need is the SDK with header files and library stubs, which you can either copy from Xcode, or grab from here.
You can either pass its folder to the compiler with -isysroot, or place/symlink it to /usr/share/SDKs/MacOSX.sdk where the compiler will find it automatically.
Once you've done that, you can run:
clang --target=x86_64-apple-darwin -o t t.c
Compiling for Linux or Windows would work in similar fashion with --target=x86_64-linux-gnu and --target=x86_64-windows-msvc respectively, but in addition to a suitable SDK will also require a custom linker. You could presumably build LLVM's lld for iOS and then pass -fuse-ld=ld.lld for Linux or -fuse-ld=lld-link for Windows, but I haven't been able to find this as precompiled binary for iOS.
I provide a Yocto SDK to cross-build an application for an embedded target. The application itself is built using CMake. The SDK setup script provides many necessary environment variables (like location of the cross-compiler, sysroot, etc.), which so far was enough to build the application.
However, since recently the application has a dependency to the Boost library (through the command find_package(Boost REQUIRED) in the CMakeLists.txt). Now CMake complains that it cannot find the library, even though it's installed in the SDK sysroot. But if I build the application directly in Yocto, it works fine.
After some research it turned out that Yocto generates a toolchain.cmake file which is added to the cmake call. In this file, the variable CMAKE_FIND_ROOT_PATH is set, which CMake needs to find libraries. Using such a toolchain file, I can also build using the SDK.
Now I'm wondering if Yocto provides any mechanism to export such a toolchain file with the SDK. Or alternatively if the SDK provides a script or something to automatically create a toolchain file directly on the SDK build host.
Or shall I just tell the users of the SDK to manually create a toolchain file and add it to their cmake call?
Assuming that you're using the image based SDK, i.e. building it with bitbake <image> -c populate_sdk, adding the following toimage.bb should fix it:
TOOLCHAIN_HOST_TASK += "nativesdk-cmake"
That should give you a OEToolchainConfig.cmake file in the SDK. After sourcing the SDK environment file, cmake will be an alias to cmake -DCMAKE_TOOLCHAIN_FILE=$OECORE_NATIVE_SYSROOT/usr/share/cmake/OEToolchainConfig.cmake to further help your developers.
I'd like to add to Anders answer that while it worked great for me to add nativesdk-cmake this way it did not work when I tried to add nativesdk-python3-numpy. After some googling I found this, suggesting that TOOLCHAIN_HOST_TASK has to be extended using _append instead of +=.
I have an iOS application project with couple of private(owned) carthage dependencies, sometimes I'm in the need of debugging bugs or to know what is the code executed by certain methods.
I'd like to know if there is an easy way to setup the framework source code in Carthage/Checkouts using a run script, so that if I do a carthage update and run my app a can debug the frameworks source code without the need of adding sub projects.
Can this be done by including the debugging symbols in the framework build if so what would I need to do, to make it work?
Did you tried to copy the dsym files as mentioned in Carthage - Getting Started?
With the debug information copied into the built products directory, Xcode will be able to symbolicate the stack trace whenever you stop at a breakpoint. This will also enable you to step through third-party code in the debugger.
The README claims it can compile to armv7, but I cannot find the magic incantation to make it work.
I started down the rabbit hole of changing the Makefile to set the arch=armv7, fixing the resulting compilation errors, etc, but that doesn't seem like the right way to go about it.
There recommended cmake flags are:
cmake -DLLVM_TARGETS_TO_BUILD="X86;ARM;NVPTX" -DLLVM_ENABLE_ASSERTIONS=ON -DCMAKE_BUILD_TYPE=Release ..
But alas, the bin directory contains only a .a and a .so, both of which are compiled for x86_64. There are no dylibs.
I can successfully run the test iOS app in the simulator, linking with the x86 libraries, but I cannot build on a device since there are no arm binaries.
Here is a link to the Halide test app I'm trying to build:
https://github.com/halide/Halide/tree/master/apps/HelloiOS
You should use AOT compilation for iOS. The JIT in principle works on ARM (the architecture), but not on iOS (the OS).
Clarification: are you trying to build Halide to run on ARM, or merely to generate code for ARM? (If the latter, any target will do, as all builds of Halide can generate code for all known targets.)