Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cant compile CMakeLists.txt #711

Closed
baptistapedro opened this issue Nov 28, 2019 · 20 comments
Closed

Cant compile CMakeLists.txt #711

baptistapedro opened this issue Nov 28, 2019 · 20 comments
Labels

Comments

@baptistapedro
Copy link

Hello,
I'm trying to compile the CMakeLists.txt but I'm having a hard time, please follow here https://dpaste.de/OsHZ/raw

It creates the CMakeFiles and also generate the .o files like init.c.o however I'm not able to link those into my own file.c

What's wrong with the compilation?

@koral--
Copy link
Owner

koral-- commented Nov 28, 2019

-DCMAKE_LIBRARY_OUTPUT_DIRECTORY=/libs/armeabi-v7a
Does this directory exist? Path is absolute, starting from /, which is quite unusual.

@baptistapedro
Copy link
Author

Koral,
I tried =libs/armeabi-v7a
I already tried to remove the output dir flag as well, and the issue is the same.

Can you descrbie step by step how to compile it with cmake?

Just an example, I tried to link one of the .o files, check the error I'm having:

clang -g -O1 -I/usr/lib/jvm/java-8-openjdk-amd64/include -I/usr/lib/jvm/java-8-openjdk-amd64/include/linux CMakeFiles/pl_droidsonroids_gif.dir/init.c.o myf.c -o myf
/usr/bin/ld: CMakeFiles/pl_droidsonroids_gif.dir/init.c.o: Relocations in generic ELF (EM: 40)
/usr/bin/ld: CMakeFiles/pl_droidsonroids_gif.dir/init.c.o: Relocations in generic ELF (EM: 40)
/usr/bin/ld: CMakeFiles/pl_droidsonroids_gif.dir/init.c.o: Relocations in generic ELF (EM: 40)
/usr/bin/ld: CMakeFiles/pl_droidsonroids_gif.dir/init.c.o: Relocations in generic ELF (EM: 40)
/usr/bin/ld: CMakeFiles/pl_droidsonroids_gif.dir/init.c.o: Relocations in generic ELF (EM: 40)
/usr/bin/ld: CMakeFiles/pl_droidsonroids_gif.dir/init.c.o: Relocations in generic ELF (EM: 40)
/usr/bin/ld: CMakeFiles/pl_droidsonroids_gif.dir/init.c.o: Relocations in generic ELF (EM: 40)
/usr/bin/ld: CMakeFiles/pl_droidsonroids_gif.dir/init.c.o: Relocations in generic ELF (EM: 40)
/usr/bin/ld: CMakeFiles/pl_droidsonroids_gif.dir/init.c.o: Relocations in generic ELF (EM: 40)
CMakeFiles/pl_droidsonroids_gif.dir/init.c.o: error adding symbols: File in wrong format

@koral--
Copy link
Owner

koral-- commented Dec 1, 2019

Here is what is invoked by Gradle:

arguments : 
-Hprojects/android-gif-drawable/android-gif-drawable/src/main/c
-Bprojects/android-gif-drawable/android-gif-drawable/.cxx/cmake/debug/x86_64
-DANDROID_ABI=x86_64
-DANDROID_PLATFORM=android-17
-DCMAKE_LIBRARY_OUTPUT_DIRECTORY=projects/android-gif-drawable/android-gif-drawable/build/intermediates/cmake/debug/obj/x86_64
-DCMAKE_BUILD_TYPE=Debug
-DANDROID_NDK=/opt/android-sdk-update-manager/ndk/20.0.5594570
-DCMAKE_C_FLAGS=-std=c11 -Weverything -Wall -DDEBUG -g
-DCMAKE_TOOLCHAIN_FILE=/opt/android-sdk-update-manager/ndk/20.0.5594570/build/cmake/android.toolchain.cmake
-DCMAKE_MAKE_PROGRAM=/opt/android-sdk-update-manager/cmake/3.6.4111459/bin/ninja
-GAndroid Gradle - Ninja
-DANDROID_PLATFORM=android-17
-DANDROID_STL=none
jvmArgs : 

@baptistapedro
Copy link
Author

baptistapedro commented Dec 1, 2019 via email

@koral--
Copy link
Owner

koral-- commented Dec 1, 2019

Yes, exactly.

@baptistapedro
Copy link
Author

I have the android NDK (android-ndk-r20b) the latest one and it does not contain the /bin/ninja binary, so I excluded that flag and remained with everything else as follows:

cmake -Hprojects/android-gif-drawable/android-gif-drawable/src/main/c -Bprojects/android-gif-drawable/android-gif-drawable/.cxx/cmake/debug/x86_64 -DANDROID_ABI=x86_64 -DANDROID_PLATFORM=android-17 -DCMAKE_LIBRARY_OUTPUT_DIRECTORY=projects/android-gif-drawable/android-gif-drawable/build/intermediates/cmake/debug/obj/x86_64 -DCMAKE_BUILD_TYPE=Debug -DANDROID_NDK=~/android-ndk-r20b -DCMAKE_C_FLAGS=-std=c11 -Weverything -Wall -DDEBUG -g -DCMAKE_TOOLCHAIN_FILE=~/android-ndk-r20b/build/cmake/android.toolchain.cmake -GAndroid Gradle - Ninja -DANDROID_PLATFORM=android-17 -DANDROID_STL=none
CMake Error: Could not create named generator Android

You can see the error I have and probably has nothing to do with the lack of the ninja flag?

@koral--
Copy link
Owner

koral-- commented Dec 1, 2019

I don't use cmake directly, so this is only a blind suggestion:
could you try quoting parameters containing spaces?

@baptistapedro
Copy link
Author

That does not change the output.

@baptistapedro
Copy link
Author

Well you have a CMakeLists.txt so you might compiled somehow.
Do you mind to try on your machine please?

@baptistapedro
Copy link
Author

as long as I'm able to generate the .o files and possible the all .so files (not only the main .so file that is used as /lib for android apps).
I never used gradle to build projects but I gave it a try perhaps you can tell me what's the correct way to do it with gradle, I gave it a try, check out: https://dpaste.de/O6k2/raw

@baptistapedro
Copy link
Author


Gradle 2.10

Build time: 2016-01-26 15:17:49 UTC
Build number: none
Revision: UNKNOWN

Groovy: 2.4.5
Ant: Apache Ant(TM) version 1.9.6 compiled on July 20 2018
JVM: 1.8.0_222 (Private Build 25.222-b10)
OS: Linux 4.15.0-70-generic amd64

@koral--
Copy link
Owner

koral-- commented Dec 2, 2019

Gradle 2.10 is very very old, that's why it does not recognize google() repo. The newest stable version is 6.

@baptistapedro
Copy link
Author

I tried the latest version and 5.6.2, because seems the project was built with it.

~/Desktop/gradle-5.6.2/bin/gradle build.gradle droidson

FAILURE: Build failed with an exception.

  • What went wrong:
    Task 'build.gradle' not found in root project 'android-gif-drawable'.

  • Try:
    Run gradle tasks to get a list of available tasks. Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

  • Get more help at https://help.gradle.org

BUILD FAILED in 2s

@baptistapedro
Copy link
Author

please post the exact commands I should use

@baptistapedro
Copy link
Author

I did gradle -q archieveSymbols
then I noticed this path

nasa@ubuntu:~/android-gif-drawable/android-gif-drawable/build/libs$ ls -al
total 60
drwxrwxr-x 2 nasa nasa  4096 Dec  2 06:27 .
drwxrwxr-x 4 nasa nasa  4096 Dec  2 06:27 ..
-rw-rw-r-- 1 nasa nasa   261 Dec  2 06:27 android-gif-drawable-1.2.20-SNAPSHOT-javadoc.jar
-rw-rw-r-- 1 nasa nasa 47364 Dec  2 06:27 android-gif-drawable-1.2.20-SNAPSHOT-sources.jar

the .c files on src/main/c, were not compiled though

@koral--
Copy link
Owner

koral-- commented Dec 2, 2019

You can invoke ./gradlew build (gradlew is located in project root directory).

@baptistapedro
Copy link
Author

Task :android-gif-drawable:lint FAILED

FAILURE: Build failed with an exception.

  • What went wrong:
    A problem was found with the configuration of task ':android-gif-drawable:lint'.

No value has been specified for property 'lintClassPath'.

@koral--
Copy link
Owner

koral-- commented Dec 3, 2019

It seems that something is wrong with your environment. Impossible to say what with that amount of logs.

@Taolaw
Copy link

Taolaw commented Feb 13, 2020

some error occured, build log:

luna@luna-ubuntu:~/Downloads/android-gif-drawable-dev$ ./gradlew build
> Task :android-gif-drawable:lint FAILED

FAILURE: Build failed with an exception.

* What went wrong:
A problem was found with the configuration of task ':android-gif-drawable:lint'.
> No value has been specified for property 'lintClassPath'.

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 766ms
3 actionable tasks: 1 executed, 2 up-to-date

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants