Open niovi opened 4 months ago
Hi @niovi ! Would you be able to copy your build.log
file from the build-cva664
directory to here? Unfortunately the provided error trace does not have enough details for me to diagnose this.
of course build.log.tar.gz
Thank you for your response.
Okay, in your build log I see the following lines:
/home/ubi/gits/keystone/build-cva664/buildroot.build/per-package/keystone-examples/host/bin/../lib/gcc/riscv64-buildroot-linux-gnu/11.4.0/../../../../riscv64-buildroot-linux-gnu/bin/ld: warning: cannot find entry symbol _start; defaulting to 00000000000100e8
/home/ubi/gits/keystone/build-cva664/buildroot.build/per-package/keystone-examples/host/bin/../lib/gcc/riscv64-buildroot-linux-gnu/11.4.0/../../../../riscv64-buildroot-linux-gnu/bin/ld: CMakeFiles/ci.dir/eapp/ci.c.o: in function `.L0 ':
ci.c:(.text.startup+0x10): undefined reference to `puts'
collect2: error: ld returned 1 exit status
[ 11%] Linking CXX executable ci-runner
[ 12%] Building CXX object attestation/CMakeFiles/attestor-runner.dir/host/host.cpp.o
make[6]: *** [ci/CMakeFiles/ci.dir/build.make:99: ci/ci] Error 1
This seems to me like you are not linking the standard C libraries to your eapp, which you need to use functions like printf
. What does your CMakeLists.txt
for your new ci
example look like? It should look like the CMakeLists.txt
for the hello
example (not hello-native
).
hello again Thank you for your response. i try to #include <openssl/sha.h>
int main() { uint8_t test[32] = {0}; uint8_t test_p[32]; SHA256(test, 32, test_p); for (int i=0;i<32;i++){ printf("%02X", test[i]); } printf("\nhello, ci is here!\n"); return 0; }
and with CMakeLIsts.txt set(eapp_bin ci) set(eapp_src eapp/ci.c) set(host_bin ci-runner) set(host_src host/hostn.cpp) set(package_name "ci.ke") set(package_script "./ci-runner ci eyrie-rt loader.bin") set(eyrie_plugins "io_syscall linux_syscall env_setup")
add_executable(${eapp_bin} ${eapp_src})
target_link_libraries(${eapp_bin} /home/ubi/rewire/openssl-3.0.1/libcrypto.a /home/ubi/rewire/openssl-3.0.1/libssl.a) target_include_directories(${eapp_bin} PUBLIC /home/ubi/rewire/openssl-3.0.1/include)
add_executable(${host_bin} ${host_src}) target_link_libraries(${host_bin} ${KEYSTONE_LIB_HOST} ${KEYSTONE_LIB_EDGE})
set(eyrie_files_to_copy .options_log eyrie-rt loader.bin) add_eyrie_runtime(${eapp_bin}-eyrie ${eyrie_plugins} ${eyrie_files_to_copy})
add_keystone_package(${eapp_bin}-package ${package_name} ${package_script} ${eyrie_files_to_copy} ${eapp_bin} ${host_bin})
add_dependencies(${eapp_bin}-package ${eapp_bin}-eyrie)
add_dependencies(examples ${eapp_bin}-package)
and i am getting segmentation fault .
I see very many lines that look like (I chose one arbitrarily):
/home/ubi/gits/keystone/build-cva664/buildroot.build/per-package/keystone-examples/host/bin/../lib/gcc/riscv64-buildroot-linux-gnu/11.4.0/../../../../riscv64-buildroot-linux-gnu/bin/ld: /home/ubi/rewire/openssl-3.0.1/libcrypto.a(libcrypto-lib-v3_akid.o): relocation R_RISCV_HI20 against `a local symbol' can not be used when making a shared object; recompile with -fPIC
One thing that I notice here is that the linker believes you are making a shared object, which we do not support (yet) in Keystone. You may want to explicitly compile your eapp as a static binary, in the same way as in the hello
example here. That is, your eapp's CMakeLists.txt
should look like:
add_executable(${eapp_bin} ${eapp_src})
target_link_libraries(${eapp_bin} "-static" /home/ubi/rewire/openssl-3.0.1/libcrypto.a /home/ubi/rewire/openssl-3.0.1/libssl.a)
target_include_directories(${eapp_bin} PUBLIC /home/ubi/rewire/openssl-3.0.1/include)
Hello, i clone the repository dev-cva6-support. i run ./fast-setup.sh and then i create a new example the ci(eapp,host like hello example) which has in the eapp only int main() { printf("hello, ci!\n"); return 0; } and put add_subdirectory(ci) in CMakeLists.txt. I try KEYSTONE_PLATFORM=cva6 make and i am getting
i have manage to flash sd card and run keystone on cva6 with Genessys 2 board.
but i need to include my example also. where do i need to make changes beside the examples folder? Thank you in advance.