nandeesh v
nandeesh v

Reputation: 127

Compilation error for RISCV gcc when try to include -lcrypto

I am running openssl benchmarks on Ubuntu Linux. Initially, there was some problem with the missing library. Later I fixed it by installing the library with the installation command sudo apt-get install libssl-dev. When I compiled using gcc command gcc sha256t.c -o sha -lcrypto, it generates binary but when compiled using RISCV gcc command riscv64-unknown-elf-gcc sha256.S -o sha.riscv -lcrypto, it throws the following link error.

/home/user_name/fpga-zynq/rocket-chip/riscv-tools/riscv/lib/gcc/riscv64-unknown-elf/6.1.0/../../../../riscv64-unknown-elf/bin/ld: cannot find -lcrypto collect2: error: ld returned 1 exit status.

How to link the -lcrypto in this case.

Upvotes: 0

Views: 392

Answers (1)

David Faure
David Faure

Reputation: 1997

You need a libcrypto compiled for the riscv64 architecture.

What you installed with sudo apt-get install libssl-dev is a libcrypto compiled for your host architecture (likely x86_64), it cannot be used for cross-compiling.

If you can't find a pre-built libcrypto for riscv64, you might have to compile it yourself, with that same riscv64 cross-compiler you're using.

Automating this is what yocto or buildroot is all about.

Upvotes: 1

Related Questions