Open FunkyMuse opened 6 months ago
hmm, it seems that no matter which script i run, it always deletes those files, strange
up until this point everything works good
after commenting out line 49 in run-swig.sh
build is successful but there's an error
all the deleted code on that folder is generated by SWIG, this is necessary, otherwise your java code will not match the latest changes in the libtorrent library.
you're having some sort of C++ build error because you didn't get to have a .dylib created.
(A lot of changes and cleanup are coming on the swig/
folder from a branch I hope to have ready the next spring, which wraps libtorrent 2.0)
Since i shouldn't comment out that code that deletes the folder but without it, the script can't continue 🤔
At least am I on the right path, I've tried adapting the scripts as much as I can from what you already had in place
Feel free to review the code if you have time
...found 6 targets...
...updating 5 targets...
darwin.compile.c++ bin/release/ios/arm64/32.o
clang: warning: using sysroot for 'MacOSX' but targeting 'iPhone' [-Wincompatible-sysroot]
/Users/funkymuse/src/boost_1_82_0/libs/config/checks/architecture/32.cpp:9:10: error: 'test' declared as an array with a negative size
int test[sizeof(void*) == 4? 1 : -1];
^~~~~~~~~~~~~~~~~~~~~~~~~~
1 error generated.
"clang++" -fvisibility-inlines-hidden -std=c++17 -miphoneos-version-min=14.0 -fno-strict-aliasing -fvisibility=hidden -D_DARWIN_C_SOURCE -fPIC -O0 -fno-inline -Wall -g -fvisibility=hidden -dynamic -gdwarf-2 -fexceptions -DBOOST_ALL_NO_LIB=1 -DBOOST_NO_IOSTREAM -DTORRENT_USE_I2P=1 -D_WIN32_WINNT=0x0600 -I"/Users/funkymuse/src/boost_1_82_0" -c -o "bin/release/ios/arm64/32.o" "/Users/funkymuse/src/boost_1_82_0/libs/config/checks/architecture/32.cpp"
...failed darwin.compile.c++ bin/release/ios/arm64/32.o...
...failed updating 1 target...
...updated 4 targets...
...found 2 targets...
...updating 1 target...
darwin.compile.c++ bin/release/ios/arm64/64.o
clang: warning: using sysroot for 'MacOSX' but targeting 'iPhone' [-Wincompatible-sysroot]
...updated 1 target...
...found 2 targets...
...updating 1 target...
darwin.compile.c++ bin/release/ios/arm64/arm.o
clang: warning: using sysroot for 'MacOSX' but targeting 'iPhone' [-Wincompatible-sysroot]
...updated 1 target...
...found 1 target...
...updating 1 target...
config-cache.write bin/project-cache.jam
...updated 1 target...
hmmm, I haven't a single clue how to fix this Boost issue, maybe you're using an older version of Boost?
...skipped <pbin/release/ios/arm64>libjlibtorrent.so for lack of <pbin/release/ios/arm64>libtorrent_jni.o...
:(
@gubatron i'd appreciate your help on this PR
wish I could be of help, currently dealing with much harder issues merging libtorrent 2 (while dealing with holiday visits). Once I'm done with the libtorrent 2 branch I can take a look, as there's several fixes to run-swig.sh and other scripts. (much better project structure now)
maybe you're using an older version of Boost?
On my libtorrent 2 branch I'm using boost 1.82.0 and I don't have this issue, perhaps you want to check your build environment, your clang version.
This is mine:
clang --version
Apple clang version 15.0.0 (clang-1500.0.40.1)
Target: arm64-apple-darwin23.2.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin
Here, there's some stuff to pay attention
...found 6 targets...
...updating 5 targets...
darwin.compile.c++ bin/release/ios/arm64/32.o
clang: warning: using sysroot for 'MacOSX' but targeting 'iPhone' [-Wincompatible-sysroot]
/Users/funkymuse/src/boost_1_82_0/libs/config/checks/architecture/32.cpp:9:10: error: 'test' declared as an array with a negative size
int test[sizeof(void*) == 4? 1 : -1];
^~~~~~~~~~~~~~~~~~~~~~~~~~
1 error generated.
This one raises my eyebrow:
clang: warning: using sysroot for 'MacOSX' but targeting 'iPhone' [-Wincompatible-sysroot]
In my copy of boost, I have the same exact test and it's ok in my build environment.
To solve issues like this, I basically comment out code in the build script, I'd make sure that boost gets built correctly.
by doing this on swig/build-ios-arm64.sh
#!/usr/bin/env bash
# This script is meant to run here inside the swig folder
# It's supposed to be a one-step build for the java jar and iOS (.dylib enclosing) jar
# Output .jar files will be at:
# ../build/libs/${LIBRARY_NAME}-<version>.jar
# ../build/libs/${LIBRARY_NAME}-ios-<version>.jar
source build-utils.shinc
ios_env
common_env
check_min_req_vars
export os_arch=arm64
export os_build=ios
export SHARED_LIB=lib${LIBRARY_NAME}.dylib
export RELEASE_SHARED_LIB=lib${LIBRARY_NAME}.${os_arch}.dylib
export CXX=clang++
export CC=clang
export run_openssl_configure="./Configure iphoneos-${os_arch} -fembed-bitcode ${OPENSSL_NO_OPTS} --prefix=${OPENSSL_ROOT}"
export run_readelf="otool -L bin/release/${os_build}/${os_arch}/${SHARED_LIB}"
export run_bjam="${BOOST_ROOT}/b2 -j16 --user-config=config/${os_build}-${os_arch}-config.jam variant=release toolset=darwin-iphone target-os=iphone location=bin/release/${os_build}/${os_arch}"
export run_objcopy="echo dummy run_objcopy for ${os_build} ${os_arch}"
export run_strip="strip -S -x bin/release/${os_build}/${os_arch}/${SHARED_LIB}"
export run_native_jar="./gradlew nativeiOSArm64Jar"
create_folder_if_it_doesnt_exist ${SRC}
prompt_msg "$0: About to prepare BOOST ${BOOST_VERSION}"
press_any_to_continue
prepare_boost #make the script work up to here and make sure it's building fine, passing tests and what not. Perhaps there's something different in the way that clang works for iOS and that C++ doesn't work, and maybe there's a flag you can pass to `run_bjam` so it doesn't perform that test.
#prepare_openssl
#build_openssl
#prepare_libtorrent
#./run-swig.sh
#build_libraries
In case you didn't catch the comment above:
make the script work up to here and make sure it's building fine, passing tests and what not. Perhaps there's something different in the way that clang works for iOS and that C++ doesn't work, and maybe there's a flag you can pass to `run_bjam` so it doesn't perform that test.
Happy New Year, thanks for your work on this
Happy New Year, thanks for your work on this
Happy New Year to you too, hope you have a nice one.
https://github.com/frostwire/frostwire-jlibtorrent/issues/287
I've ran into some issues, if I run
./build-ios-arm64.sh
Then for some reason the
src/main/java/com.frostwire.jlibtorrent.swig
folder gets deleted and the gradle task is unable to finish the build because of missing imports since the swigs are deleted.I'll need some help @gubatron with this if possible, i've been hitting a dead end for an hour already, I hope my head clears tomorrow so I'd fix this without any assits