frostwire / frostwire-jlibtorrent

A swig Java interface for libtorrent by the makers of FrostWire. Develop libtorrent based apps with the joy of coding in Java.
http://www.frostwire.com
MIT License
444 stars 137 forks source link

Docker script Q&A #276

Closed master255 closed 2 years ago

master255 commented 2 years ago

@gubatron @aldenml I think it is a very bad idea to switch to compilation in the docker. There is an error in the library compilation script, and as a third-party programmer I don't understand the meaning of these errors at all. But even if I figure out what the errors are, docker is a virtual machine in my ubuntu virtual machine. And I don't have any easy tools to fix the error. In order to fix something I need to fully understand how docker works. I used to have scripts that I could quickly edit in notepad. Now, I have to do a lot of complicated things to fix a script. You have made things very complicated. Here is my error and there is the Internet and in the browser this file is downloaded. And the docker can not download. There is no answer anywhere on the Internet. Maybe docker makes sense for corporate use but for compilation it is better to use regular scripts.

+ ./gradlew jar
Downloading https://services.gradle.org/distributions/gradle-7.3.2-bin.zip

Exception in thread "main" java.net.UnknownHostException: services.gradle.org
    at java.base/java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:229)
    at java.base/java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)
    at java.base/java.net.Socket.connect(Socket.java:609)
    at java.base/sun.security.ssl.SSLSocketImpl.connect(SSLSocketImpl.java:305)
    at java.base/sun.net.NetworkClient.doConnect(NetworkClient.java:177)
master255 commented 2 years ago

Ok. This error occurred in the Ubuntu 22 docker. In wsl Windows 11 Docker I was able to get the libraries in the docker.

gubatron commented 2 years ago

I don't understand the meaning of these errors at all. In order to fix something I need to fully understand how docker works.

We all have to learn Docker at some point. I learned with stuff like this. Use it as an opportunity, it will make your life easier once you do.

You have made things very complicated.

No, it's more complicated having to have the perfect build environment, with the right libc libraries.

Docker simplifies all this, doesn't give you 100% determinism, but it gets close.

It also makes the build process faster, just building the image alone gets you the openssl and boost builds out of the way, and then you just invoke the build scripts for windows, linux and then android from a single image. macOS I build on 2 machines, one with x86_64 and another with arm64 cpus.

The same machine I use to build x86_64 mac builds and runs the Docker image no problem.

It should work 100% on an Ubuntu x86_64 host.

master255 commented 2 years ago

@gubatron You're right. I should study Docker better. But for me, only Docker Windows 11 is acceptable. It has a friendlier interface than all the others. That's why I need to upgrade Windows. Right now I have Windows 10, which doesn't have Docker. It takes me about a month to update Windows. So Docker is like a toothache for me.

Right now I'm using Docker on a Windows 11 virtual machine.

master255 commented 2 years ago

@gubatron How to do a run_swig?

gubatron commented 2 years ago

./run-swig.sh is meant to have a few environment variables set and it's invoked by the build scripts provided in the frostwire-jlibtorrent/swig folder.

If you really want to run it in the Docker image, then you must set the minimum environment variables required to be present for a build, these are them

Screen Shot 2022-05-02 at 1 26 14 PM

Say you want to build a linux binary:

$ ./docker_run_interactive.sh 
root@13a3e237ea6d:/# cd frostwire-jlibtorrent/swig/
root@13a3e237ea6d:/frostwire-jlibtorrent/swig# source build-utils.shinc && linux_env && common_env && ./run-swig.sh
Screen Shot 2022-05-02 at 1 36 37 PM