cossacklabs / themis

Easy to use cryptographic framework for data protection: secure messaging with forward secrecy and secure data storage. Has unified APIs across 14 platforms.
https://www.cossacklabs.com/themis
Apache License 2.0
1.88k stars 144 forks source link

Cross compile failed using OpenWRT, have to change CMakefiles.txt #1018

Open jannson opened 1 year ago

jannson commented 1 year ago

Describe the bug

I can build package from source in OpenWRT SDK.

To Reproduce Steps to reproduce the behavior:

  1. Use 'I wrote a makefile for Openwrt: https://gist.github.com/jannson/d0bc34ce9319c0c217343fccb820e720'
  2. Run 'build in OpenWRT SDK, using command: make package/example/themis/{clean,prepare,compile} V=s'
  3. See the following error:
    
    make[5]: Entering directory '/xxx/openwrt-sdk-21.02.3-realtek-rtd129x_gcc-7.5.0_musl.Linux-x86_64/build_dir/target-aarch64_cortex-a53_musl/themis-1.0'
    [  0%] Building C object CMakeFiles/soter.dir/src/soter/ed25519/fe_0.c.o
    In file included from /xxx/openwrt-sdk-21.02.3-realtek-rtd129x_gcc-7.5.0_musl.Linux-x86_64/build_dir/target-aarch64_cortex-a53_musl/themis-1.0/src/soter/ed25519/fe_0.c:1:0:
    /xxx/openwrt-sdk-21.02.3-realtek-rtd129x_gcc-7.5.0_musl.Linux-x86_64/build_dir/target-aarch64_cortex-a53_musl/themis-1.0/src/soter/ed25519/fe.h:7:10: fatal error: soter/soter_api.h: No such file or directory
    #include <soter/soter_api.h>
          ^~~~~~~~~~~~~~~~~~~
    compilation terminated.
    make[5]: *** [CMakeFiles/soter.dir/build.make:82: CMakeFiles/soter.dir/src/soter/ed25519/fe_0.c.o] Error 1

**Expected behavior**
Should build OK using cmake

**Environment (please complete the following information):**
- OS: [OS name and version, e.g. iOS 13]
- Hardware: [32-bit/64-bit, or mobile device name and version]
- Themis version: [e.g. 0.12.0]
- Installation way:
   - [ ] via package manager
   - [x] built from source

**Additional context**

Add a new line after https://github.com/cossacklabs/themis/blob/master/CMakeLists.txt#L3, which is:

include_directories(include)



Then we can passthough.
jannson commented 1 year ago

Addition, The Verbose of cmake gcc command:

/xxx/openwrt-sdk-21.02.3-realtek-rtd129x_gcc-7.5.0_musl.Linux-x86_64/staging_dir/toolchain-aarch64_cortex-a53_gcc-7.5.0_musl/bin/aarch64-openwrt-linux-musl-gcc -DDNIST_STS_E
XE_PATH=tests/soter/nist-sts -I/xxx/openwrt-sdk-21.02.3-realtek-rtd129x_gcc-7.5.0_musl.Linux-x86_64/build_dir/target-aarch64_cortex-a53_musl/themis-1.0/src -Os -pipe -mcpu=c
ortex-a53 -fno-caller-saves -fno-plt -fhonour-copts -Wno-error=unused-but-set-variable -Wno-error=unused-result -iremap/xxx/openwrt-sdk-21.02.3-realtek-rtd129x_gcc-7.5.0_mus
l.Linux-x86_64/build_dir/target-aarch64_cortex-a53_musl/themis-1.0:themis-1.0 -Wformat -Werror=format-security -fstack-protector -D_FORTIFY_SOURCE=1 -Wl,-z,now -Wl,-z,relro -DNDEBUG -std=gnu99 -o CMakeFil
es/soter.dir/src/soter/ed25519/fe_0.c.o -c /xxx/openwrt-sdk-21.02.3-realtek-rtd129x_gcc-7.5.0_musl.Linux-x86_64/build_dir/target-aarch64_cortex-a53_musl/themis-1.0/src/soter
/ed25519/fe_0.c 
Lagovas commented 1 year ago

Actually, we test and document installation using make, not cmake. For now, we don't test builds by cmake. CMakeLists.txt was added for IDE support (eg CLion) that worked only with CMakeLists.txt as source of project files. So, for now the main approach (officially suggested) is tobuild from sources using make instead of cmake according to the docs. Feel free to create PR with changes in CMakeLists.txt & tests the verifies building with cmake.