Attempting to build the project results in several errors. #1

Open
opened 2022-02-15 23:20:44 +01:00 by dshaver1 · 2 comments

Hello! I'm quite new to C++, but find myself needing to compile a custom build of the TDLight project.

I have a java application that depends on TDLight, so I'm attempting to generate a custom version of the tdlight-natives-linux-amd64 jar that contains my custom build of TDLight.

I've been able to successfully build TDLight, producing a libtdjni.so file, but I have so far been stumped on how I can include my new libtdjni.so in a jar that will work with tdlight-java. I tried manually swapping in the new so file to my local tdlight-natives-linux-amd64-4.0.219.jar just to see if it would work... unsurprisingly it did not. I got the following error when I attempted to start my java app:

FATAL ERROR in native method: Can't find class [org/drinkless/tdlib/Client]
	at java.lang.ClassLoader$NativeLibrary.load0(java.base@14.0.2/Native Method)
	at java.lang.ClassLoader$NativeLibrary.load(java.base@14.0.2/ClassLoader.java:2452)
	at java.lang.ClassLoader$NativeLibrary.loadLibrary(java.base@14.0.2/ClassLoader.java:2508)
	- locked <0x0000000719702160> (a java.util.HashSet)
	at java.lang.ClassLoader.loadLibrary0(java.base@14.0.2/ClassLoader.java:2704)
	at java.lang.ClassLoader.loadLibrary(java.base@14.0.2/ClassLoader.java:2637)
	at java.lang.Runtime.load0(java.base@14.0.2/Runtime.java:745)
	at java.lang.System.load(java.base@14.0.2/System.java:1871)
	at it.tdlight.common.utils.LoadLibrary.loadJarLibrary(LoadLibrary.java:192)
	at it.tdlight.common.utils.LoadLibrary.loadLibrary(LoadLibrary.java:88)
	at it.tdlight.common.utils.LoadLibrary.load(LoadLibrary.java:71)
	at it.tdlight.common.Init.start(Init.java:44)
	- locked <0x0000000718f1ecb0> (a java.lang.Class for it.tdlight.common.Init)

So next I decided to try building this project myself to try and exactly replicate how you are building the jar. However, I've been met with several issues.

  1. Missing parameters mentioned in the scripts but not the readme. Easy enough to solve, just export OPERATING_SYSTEM_NAME=linux etc.
  2. install-dependencies.sh was giving me a bunch of 404 errors on jdk dependencies. the 11_0_13_8 version was no longer available on the debian website so I updated to 11_0_14_9.
  3. install-dependencies.sh requires a valid CROSS_BUILD_DEPS_DIR variable, but this isn't mentioned.
  4. Finally, where I'm at the end of my knowledge... generate_td_tools.sh is giving me the following error:
Configuring CMake...
CMake Error: The source directory "/home/dshaver/git/tdlight-java-natives/generated/implementation" does not appear to contain CMakeLists.txt.

Based on this error, I'm led to believe that something (or maybe me?) was supposed to have copied src/main/jni-cpp-src/common/CMakeLists.txt into the ./generated/implementation directory... which makes me think I'm doing something very wrong. I can't find where in the scripts it would have copied this file...

Any tips you could give me would be much appreciated! I'm attaching the output of compile-natives-package.sh in case that sheds any light on how I'm messing this up.

Hello! I'm quite new to C++, but find myself needing to compile a custom build of the TDLight project. I have a java application that depends on TDLight, so I'm attempting to generate a custom version of the tdlight-natives-linux-amd64 jar that contains my custom build of TDLight. I've been able to successfully build TDLight, producing a `libtdjni.so` file, but I have so far been stumped on how I can include my new `libtdjni.so` in a jar that will work with `tdlight-java`. I tried manually swapping in the new so file to my local `tdlight-natives-linux-amd64-4.0.219.jar` just to see if it would work... unsurprisingly it did not. I got the following error when I attempted to start my java app: ``` FATAL ERROR in native method: Can't find class [org/drinkless/tdlib/Client] at java.lang.ClassLoader$NativeLibrary.load0(java.base@14.0.2/Native Method) at java.lang.ClassLoader$NativeLibrary.load(java.base@14.0.2/ClassLoader.java:2452) at java.lang.ClassLoader$NativeLibrary.loadLibrary(java.base@14.0.2/ClassLoader.java:2508) - locked <0x0000000719702160> (a java.util.HashSet) at java.lang.ClassLoader.loadLibrary0(java.base@14.0.2/ClassLoader.java:2704) at java.lang.ClassLoader.loadLibrary(java.base@14.0.2/ClassLoader.java:2637) at java.lang.Runtime.load0(java.base@14.0.2/Runtime.java:745) at java.lang.System.load(java.base@14.0.2/System.java:1871) at it.tdlight.common.utils.LoadLibrary.loadJarLibrary(LoadLibrary.java:192) at it.tdlight.common.utils.LoadLibrary.loadLibrary(LoadLibrary.java:88) at it.tdlight.common.utils.LoadLibrary.load(LoadLibrary.java:71) at it.tdlight.common.Init.start(Init.java:44) - locked <0x0000000718f1ecb0> (a java.lang.Class for it.tdlight.common.Init) ``` So next I decided to try building this project myself to try and exactly replicate how you are building the jar. However, I've been met with several issues. 1. Missing parameters mentioned in the scripts but not the readme. Easy enough to solve, just `export OPERATING_SYSTEM_NAME=linux` etc. 2. `install-dependencies.sh` was giving me a bunch of 404 errors on jdk dependencies. the 11_0_13_8 version was no longer available on the debian website so I updated to 11_0_14_9. 3. `install-dependencies.sh` requires a valid `CROSS_BUILD_DEPS_DIR` variable, but this isn't mentioned. 4. Finally, where I'm at the end of my knowledge... `generate_td_tools.sh` is giving me the following error: ``` Configuring CMake... CMake Error: The source directory "/home/dshaver/git/tdlight-java-natives/generated/implementation" does not appear to contain CMakeLists.txt. ``` Based on this error, I'm led to believe that something (or maybe me?) was supposed to have copied `src/main/jni-cpp-src/common/CMakeLists.txt` into the `./generated/implementation` directory... which makes me think I'm doing something very wrong. I can't find where in the scripts it would have copied this file... Any tips you could give me would be much appreciated! I'm attaching the output of `compile-natives-package.sh` in case that sheds any light on how I'm messing this up.
Author

Okay I figured out I was supposed to copy in the TDLight source into the ./implementation/tdlight directory, but the build now fails in compile_tdjni.sh with:

CMake Error in CMakeLists.txt:
  Imported target "Td::TdStatic" includes non-existent path

    "/include"

  in its INTERFACE_INCLUDE_DIRECTORIES.  Possible reasons include:

  * The path was deleted, renamed, or moved to another location.

  * An install or uninstall procedure did not complete successfully.

  * The installation package was faulty and references files it does not
  provide.

Attaching full output of compile_tdjni.sh...

Okay I figured out I was supposed to copy in the TDLight source into the ./implementation/tdlight directory, but the build now fails in `compile_tdjni.sh` with: ``` CMake Error in CMakeLists.txt: Imported target "Td::TdStatic" includes non-existent path "/include" in its INTERFACE_INCLUDE_DIRECTORIES. Possible reasons include: * The path was deleted, renamed, or moved to another location. * An install or uninstall procedure did not complete successfully. * The installation package was faulty and references files it does not provide. ``` Attaching full output of `compile_tdjni.sh`...

CMake Error in CMakeLists.txt:
Imported target "Td::TdStatic" includes non-existent path

"/include"

in its INTERFACE_INCLUDE_DIRECTORIES. Possible reasons include:

  • The path was deleted, renamed, or moved to another location.

  • An install or uninstall procedure did not complete successfully.

  • The installation package was faulty and references files it does not
    provide.

I don't know why this is happening, it seems that you have set a bad environment variable or you deleted/moved some files in the repository.
Can you try building the original repository on your computer? (by the way you should git clone using --recursive)

> CMake Error in CMakeLists.txt: > Imported target "Td::TdStatic" includes non-existent path > > "/include" > > in its INTERFACE_INCLUDE_DIRECTORIES. Possible reasons include: > > * The path was deleted, renamed, or moved to another location. > > * An install or uninstall procedure did not complete successfully. > > * The installation package was faulty and references files it does not > provide. I don't know why this is happening, it seems that you have set a bad environment variable or you deleted/moved some files in the repository. Can you try building the original repository on your computer? (by the way you should git clone using `--recursive`)
Sign in to join this conversation.
No Label
No Milestone
No Assignees
2 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: tdlight-team/tdlight-java-natives#1
No description provided.