Closed julianharty closed 4 years ago
Hi @julianharty.
Just checking, do you have all submodules checked out of the project, including the submodules of the submodules.
So for example, can you see the directory: ics-openvpn/main/src/main/cpp/openvpn3/cmake
?
Would be nice to include the full git clone command(s) in the README as well then :)
Also Gradle version 4.4 is not mentioned anywhere in the current version. Currently we are using 5.6.3 (and ics-openvpn is using 5.4.1, but that is not used here since it is a library). Are you sure you are on the latest commit?
Would be nice to include the full git clone command(s) in the README as well then :)
Done!
I was in a branch of a fork of this project :) so that was why it was using Gradle 4.4
I've made a fresh clone of this repo to another location and from the command line run the following commands before trying to open this folder in Android Studio.
git submodule init
git submodule update
I then noticed you've updated the README with the correct git command (thank you 👍) and used that.
git clone --recurse-submodules -j8 https://github.com/eduvpn/android.git
I then uses Open Project and navigated to that folder. This time it downloads Gradle 5.6.3 which is an improvement. The build seems to fail in a later step with:
org.gradle.process.internal.ExecException: A problem occurred starting process 'command 'swig''
at org.gradle.process.internal.DefaultExecHandle.execExceptionFor(DefaultExecHandle.java:237)
at org.gradle.process.internal.DefaultExecHandle.setEndStateInfo(DefaultExecHandle.java:214)
at org.gradle.process.internal.DefaultExecHandle.failed(DefaultExecHandle.java:364)
at org.gradle.process.internal.ExecHandleRunner.run(ExecHandleRunner.java:87)
at org.gradle.internal.operations.CurrentBuildOperationPreservingRunnable.run(CurrentBuildOperationPreservingRunnable.java:42)
at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:64)
at org.gradle.internal.concurrent.ManagedExecutorImpl$1.run(ManagedExecutorImpl.java:48)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at org.gradle.internal.concurrent.ThreadFactoryImpl$ManagedThreadRunnable.run(ThreadFactoryImpl.java:56)
at java.lang.Thread.run(Thread.java:748)
Caused by: net.rubygrapefruit.platform.NativeException: Could not start 'swig'
at net.rubygrapefruit.platform.internal.DefaultProcessLauncher.start(DefaultProcessLauncher.java:27)
at net.rubygrapefruit.platform.internal.WrapperProcessLauncher.start(WrapperProcessLauncher.java:36)
at org.gradle.process.internal.ExecHandleRunner.startProcess(ExecHandleRunner.java:98)
at org.gradle.process.internal.ExecHandleRunner.run(ExecHandleRunner.java:71)
... 7 more
Caused by: java.io.IOException: Cannot run program "swig" (in directory "/Users/julianharty/sandbox/eduvpn/master_android/ics-openvpn/main"): error=2, No such file or directory
at java.lang.ProcessBuilder.start(ProcessBuilder.java:1048)
at net.rubygrapefruit.platform.internal.DefaultProcessLauncher.start(DefaultProcessLauncher.java:25)
... 10 more
Caused by: java.io.IOException: error=2, No such file or directory
at java.lang.UNIXProcess.forkAndExec(Native Method)
at java.lang.UNIXProcess.<init>(UNIXProcess.java:247)
at java.lang.ProcessImpl.start(ProcessImpl.java:134)
at java.lang.ProcessBuilder.start(ProcessBuilder.java:1029)
... 11 more
I expect this is because I'm using OSX. so ran brew install swig
I'll cover what happened next in another comment here.
BTW: Android Studio reports: NDK Resolution Outcome: Project settings: Gradle model version=5.6.3, NDK version is UNKNOWN
. I believe I can set this in the project properties
So, after installing swig I re-ran the build, I did so both in Android Studio and on the command line. Both fail with the same error (with different levels of output).
In Android Studio I see:
Process 'command '/usr/local/bin/swig'' finished with non-zero exit value 1
And on the command line I get:
> Configure project :ics-openvpn-main
WARNING: API 'variant.getMergeAssets()' is obsolete and has been replaced with 'variant.getMergeAssetsProvider()'.
It will be removed at the end of 2019.
For more information, see https://d.android.com/r/tools/task-configuration-avoidance.
To determine what is calling variant.getMergeAssets(), use -Pandroid.debug.obsoleteApi=true on the command line to display more information.
WARNING: API 'variant.getExternalNativeBuildTasks()' is obsolete and has been replaced with 'variant.getExternalNativeBuildProviders()'.
It will be removed at the end of 2019.
For more information, see https://d.android.com/r/tools/task-configuration-avoidance.
To determine what is calling variant.getExternalNativeBuildTasks(), use -Pandroid.debug.obsoleteApi=true on the command line to display more information.
> Task :ics-openvpn-main:generateOpenVPN3Swig FAILED
Unable to find file 'src/main/cpp/openvpn3/javacli/ovpncli.i'.
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':ics-openvpn-main:generateOpenVPN3Swig'.
> Process 'command '/usr/local/bin/swig'' finished with non-zero exit value 1
The clue as to a possible cause for the error seems to be:
Unable to find file 'src/main/cpp/openvpn3/javacli/ovpncli.i'.
I'll investigate.
Should we have installed a specific version of ICS?
The following line is from build_app.sh
git clone --recursive -b ${GIT_TAG} ${GIT_REPO} "${APP_DIR}"
which seems subtly different from:
git clone --recurse-submodules -j8 https://github.com/eduvpn/android.git
in the README.
@dzolnai you'd asked me to check for
ics-openvpn/main/src/main/cpp/openvpn3/cmake
it's not present, even though the folder is
tree ics-openvpn/main/src/main/cpp/openvpn3/
shows no files or subdirectories.
Process 'command '/usr/local/bin/swig'' finished with non-zero exit value 1
This is the core issue, forgot that you need to have swig installed on your machine to run the project. Most package managers have it available. If you are on MacOS, you can install it via Homebrew.
@dzolnai I have swig installed now, there seems to be files missing from the ics-openvpn sub-project.
tree ics-openvpn/
has
226 directories, 843 files
It doesn't have the cmake
file you mentioned explicitly or ovpncli.i
(in the error reported when trying to build the app). Would you be willing and able to create a fresh clone of the project and follow along with the build steps please? Meanwhile I'll have a go on an ubuntu laptop I have here.
This is the core issue, forgot that you need to have swig installed on your machine to run the project. Most package managers have it available. If you are on MacOS, you can install it via Homebrew.
I noticed that too some time ago...
https://github.com/eduvpn/android/commit/7d1c4f3f53188b5652240006d6f266c3453dec19
@dzolnai slightly off this topic, however please can you add swig
to the apt-get install
command example for Debian systems. My Ubuntu laptop didn't have swig
installed either.
I noticed that too some time ago...
It was added for Fedora, but not for Debian :) Fixed it!
Would you be willing and able to create a fresh clone of the project and follow along with the build steps please?
I just did, and I think I found another issue. Android Studio selects the wrong build variant for ics-openvpn. It selects skeletonDebug
instead of the correct uiDebug
. You can open this menu from the left sidebar in Android Studio, by clicking on Build variants
.
Hopefully this fixes it for you.
@dzolnai Thanks for the revised build varient for ICS... I've changed it to UiDebug
for ics-openvpn-main and for the app it's set to basicDebug
. From the build menu, I also refreshed the C++ projects, cleaned the build and attempted a build. The build still fails with
Process 'command '/usr/local/bin/swig'' finished with non-zero exit value 1
Note I can run swig
at the command line, it tells me I Must specify and input file. ...
Any other suggestions or ideas please?
BTW, and further off topic, on Ubuntu 16.04 LTS I have git version 2.7.4 which does not recognise the -j8
command line option. I'll see if I can update git on my Ubuntu laptop while working on the OSX machine in parallel.
@dzolnai Here are a couple of screenshots from Android Studio on OSX, perhaps they'll help illustrate my build settings and where the error is happening in the build steps?
BTW, and further off topic, on Ubuntu 16.04 LTS I have git version 2.7.4 which does not recognise the -j8 command line option. I'll see if I can update git on my Ubuntu laptop while working on the OSX machine in parallel.
In that case you should use: git clone --recursive The -j8 flag is optional, it just makes the clone faster.
It seems that swig did not complete running. Can you please switch over to the build logs window by clicking on the small icon below the green hammer (a grey square with an arrow on it) in the left side of your build output window (just next to the Build variants button). Can you attach the log as an attachment to a comment here please?
If it is still this error:
Unable to find file 'src/main/cpp/openvpn3/javacli/ovpncli.i'.
Can you then please check for me:
src/main/cpp/openvpn3
? src/main/cpp/openvpn
? src/main/cpp/openssl
? BTW, and further off topic, on Ubuntu 16.04 LTS I have git version 2.7.4 which does not recognise the -j8
command line option.
-j8
command line parameter from the README for souls who use older OS releases? :)@dzolnai Here are the queries and results for the various files, I've run the command in the root of the cloned project.
Julians-MBP:master_android julianharty$ find . -name openvpn3
./android/.git/modules/ics-openvpn/modules/main/src/main/cpp/openvpn3
./android/ics-openvpn/main/src/main/cpp/openvpn3
./ics-openvpn/main/src/main/cpp/openvpn3
Julians-MBP:master_android julianharty$ find . -name openvpn
./android/.git/modules/ics-openvpn/modules/main/openvpn
./android/ics-openvpn/main/src/main/aidl/de/blinkt/openvpn
./android/ics-openvpn/main/src/main/cpp/openvpn
./android/ics-openvpn/main/src/main/cpp/openvpn/src/openvpn
./android/ics-openvpn/main/src/main/cpp/openvpn/tests/unit_tests/openvpn
./android/ics-openvpn/main/src/main/cpp/openvpn3/openvpn
./android/ics-openvpn/main/src/main/java/de/blinkt/openvpn
./android/ics-openvpn/main/src/ovpn3/java/de/blinkt/openvpn
./android/ics-openvpn/main/src/skeleton/java/de/blinkt/openvpn
./android/ics-openvpn/main/src/test/java/de/blinkt/openvpn
./android/ics-openvpn/main/src/ui/java/de/blinkt/openvpn
./android/ics-openvpn/remoteExample/src/main/aidl/de/blinkt/openvpn
./android/ics-openvpn/remoteExample/src/main/java/de/blinkt/openvpn
./android/ics-openvpn/tlsexternalcertprovider/src/main/aidl/de/blinkt/openvpn
./ics-openvpn/main/src/main/aidl/de/blinkt/openvpn
./ics-openvpn/main/src/main/cpp/openvpn
./ics-openvpn/main/src/main/java/de/blinkt/openvpn
./ics-openvpn/main/src/ovpn3/java/de/blinkt/openvpn
./ics-openvpn/main/src/skeleton/java/de/blinkt/openvpn
./ics-openvpn/main/src/test/java/de/blinkt/openvpn
./ics-openvpn/main/src/ui/java/de/blinkt/openvpn
./ics-openvpn/remoteExample/src/main/aidl/de/blinkt/openvpn
./ics-openvpn/remoteExample/src/main/java/de/blinkt/openvpn
./ics-openvpn/tlsexternalcertprovider/src/main/aidl/de/blinkt/openvpn
Julians-MBP:master_android julianharty$ find . -name openssl
./android/.git/modules/ics-openvpn/modules/main/openssl
./android/ics-openvpn/main/src/main/cpp/openssl
./android/ics-openvpn/main/src/main/cpp/openssl/include/openssl
./android/ics-openvpn/main/src/main/cpp/openvpn3/deps/openssl
./android/ics-openvpn/main/src/main/cpp/openvpn3/openvpn/openssl
./ics-openvpn/main/src/main/cpp/openssl
perhaps it'd be worth removing the -j8 command line parameter from the README
Will do!
About your last comment: This does not fully answer my question: the directory might exist, but it might be empty. Do you have any files inside those directories?
openssl: is yes, I see
openvpn3 too.
What about src/main/cpp/openvpn
What do you see when you do a git status in that directory?
Thank you,
Julians-MBP:main julianharty$ pwd
/Users/julianharty/sandbox/eduvpn/master_android/android/ics-openvpn/main
Julians-MBP:main julianharty$ git status src/main/cpp/openvpn
HEAD detached at ca83c967
nothing to commit, working tree clean
and running tree for that folder gives: 41 directories, 426 files
For completeness:
tree src/main/cpp/openssl | grep files
79 directories, 1352 files
git status src/main/cpp/openssl
HEAD detached at ca83c967
nothing to commit, working tree clean
tree src/main/cpp/openvpn3 | grep files
├── dockerfiles
103 directories, 645 files
(I was surprise to see dockerfiles in the results), and
git status src/main/cpp/openvpn3
HEAD detached at ca83c967
nothing to commit, working tree clean
Please cd into src/main/cpp/openvpn3
, and execute git status there :)
Git seems to be content...
Julians-MBP:openvpn3 julianharty$ git status
HEAD detached at 636e3d23
nothing to commit, working tree clean
Julians-MBP:openvpn3 julianharty$ pwd
/Users/julianharty/sandbox/eduvpn/master_android/android/ics-openvpn/main/src/main/cpp/openvpn3
And there are files here...
Julians-MBP:openvpn3 julianharty$ tree | grep directories
103 directories, 645 files
And do you see the file src/main/cpp/openvpn3/javacli/ovpncli.i
?
Is the swig error still the same?
@dzolnai The swig error is now masked as recent updates to the repo seem to have broken the gradle build at an earlier stage (see #206) Nonetheless I can confirm I do see the ovpncli.i
file where you mention:
Julians-MBP:main julianharty$ ls -l src/main/cpp/openvpn3/javacli/
total 72
-rw-r--r-- 1 julianharty staff 4366 6 Nov 14:15 Client.java
-rw-r--r-- 1 julianharty staff 3006 6 Nov 14:15 Main.java
-rw-r--r-- 1 julianharty staff 10040 6 Nov 14:15 OpenVPNClientThread.java
drwxr-xr-x 4 julianharty staff 136 6 Nov 14:15 android
-rwxr-xr-x 1 julianharty staff 2901 6 Nov 14:15 build-android
-rwxr-xr-x 1 julianharty staff 2117 6 Nov 14:15 build-linux
-rw-r--r-- 1 julianharty staff 2073 6 Nov 14:15 ovpncli.i
Julians-MBP:main julianharty$ pwd
/Users/julianharty/sandbox/eduvpn/master_android/android/ics-openvpn/main
I would have preferred to keep everything in one issue, so I am closing this for now, let's continue in the other.
@dzolnai Understood, this one has morphed to be more about gradle issues than pure Android Studio. Let's hope I'll manage to build the code cleanly in Android Studio once we resolve the gradle issues :)
Thank you for adding some notes on how to build the app in Android Studio in the current README.md
I've installed Android Studio 3.5.2 for OSX and added the various tools and packages as described in the README. I then 'Opened' a local copy of the app's codebase in Android Studio. It seemed to open the project OK and started installing the relevant version of Gradle 4.4 and then running a build.
The build failed at step
` because of
Unresolved dependencies (15 errors)It cannot find (and does not attempt to download
ics-openvpn-main`.I realise that the shell script
build_app.sh
downloads this package. How do you recommend I install this dependent package, and can the project do so automatically e.g. by changing a configuration setting?Meanwhile I'll check for possible approaches on SO e.g. https://stackoverflow.com/questions/53083669/can-not-add-submodule-to-android-project
Thank you.