-
Notifications
You must be signed in to change notification settings - Fork 4
Open
Description
Hey there,
I'm really curious about this project because it really allows me to get rid of all of the pain when working with JNI
Environment:
OS: macOS 13.0
Processor/Arch: Apple M1 Pro
Use case
I was attempting to build a modified sample from your readme file just to get started
File structure
src/main.cpp
#include "ktbind/ktbind.hpp"
struct Sample {
Sample();
Sample(const char*);
Sample(std::string);
};
DECLARE_NATIVE_CLASS(Sample, "io.h4kt.sample.Sample")
JAVA_EXTENSION_MODULE() {
using namespace java;
native_class<Sample>()
.constructor<Sample()>("create")
.constructor<Sample(std::string)>("create")
;
print_registered_bindings();
}I tried building it using Gradle with cpp-library plugin and even tried a manual build using g++ in a command line.
Both ways were unsuccessful
Apple clang using Gradle
buid.gradle.kts
plugins {
id("cpp-library")
}
val javaHome: String by project
repositories {
mavenCentral()
}
library {
source.from("src")
privateHeaders.from("src")
publicHeaders.from(
"include",
"$javaHome/include",
"$javaHome/include/darwin"
)
}
tasks.withType<CppCompile> {
compilerArgs.add("-std=c++17")
}output
clang: error: unable to execute command: Segmentation fault: 11
clang: error: clang frontend command failed due to signal (use -v to see invocation)
Apple clang version 14.0.0 (clang-1400.0.29.102)
Target: arm64-apple-darwin22.1.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin
clang: note: diagnostic msg:
********************
PLEASE ATTACH THE FOLLOWING FILES TO THE BUG REPORT:
Preprocessed source(s) and associated run script(s) are located at:
clang: note: diagnostic msg: /var/folders/fn/g44nnh2x78d08v068fs6l8n80000gn/T/main-345300.cpp
clang: note: diagnostic msg: /var/folders/fn/g44nnh2x78d08v068fs6l8n80000gn/T/main-345300.sh
clang: note: diagnostic msg: Crash backtrace is located in
clang: note: diagnostic msg: /Users/h4kt/Library/Logs/DiagnosticReports/clang_<YYYY-MM-DD-HHMMSS>_<hostname>.crash
clang: note: diagnostic msg: (choose the .crash file that corresponds to your crash)
clang: note: diagnostic msg:
********************
Manual build using g++
build.sh
/opt/homebrew/Cellar/gcc/12.2.0/bin/g++-12 -std=c++17 -I include -I /Users/h4kt/Library/Java/JavaVirtualMachines/azul-11.0.16.1/Contents/Home/include -I /Users/h4kt/Library/Java/JavaVirtualMachines/azul-11.0.16.1/Contents/Home/include/darwin src/main.cppoutput
0 0x100b2c1a0 __assert_rtn + 140
1 0x1009b3a8c mach_o::relocatable::Parser<arm64>::parse(mach_o::relocatable::ParserOptions const&) + 4536
2 0x100985d38 mach_o::relocatable::Parser<arm64>::parse(unsigned char const*, unsigned long long, char const*, long, ld::File::Ordinal, mach_o::relocatable::ParserOptions const&) + 148
3 0x1009ee4ac ld::tool::InputFiles::makeFile(Options::FileInfo const&, bool) + 1468
4 0x1009f1360 ___ZN2ld4tool10InputFilesC2ER7Options_block_invoke + 56
5 0x19092f544 _dispatch_client_callout2 + 20
6 0x190944654 _dispatch_apply_invoke_and_wait + 224
7 0x190943938 _dispatch_apply_with_attr_f + 1152
8 0x190943b48 dispatch_apply + 108
9 0x1009f11f4 ld::tool::InputFiles::InputFiles(Options&) + 616
10 0x1009736c0 main + 552
A linker snapshot was created at:
/tmp/a.out-2022-12-11-041054.ld-snapshot
ld: Assertion failed: (_file->_atomsArrayCount == computedAtomCount && "more atoms allocated than expected"), function parse, file macho_relocatable_file.cpp, line 2061.
collect2: error: ld returned 1 exit status
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels
