spacemonkeygo / openssl

OpenSSL bindings for Go
http://godoc.org/github.com/spacemonkeygo/openssl
Apache License 2.0
473 stars 236 forks source link

Not able to compile the code against openssl1.0.2q #127

Closed srinivasvenu closed 5 years ago

srinivasvenu commented 5 years ago

Hi, i want to compile the code against openssl1.0 and i'm getting the error's

github.com/spacemonkeygo/openssl

In file included from ./bio.go:17:0: ./shim.h:21:25: fatal error: openssl/bio.h: No such file or directory compilation terminated. Is there a way i can compile this code against any openssl version?

zeebo commented 5 years ago

Can you tell me more about the details of your system? go env would be useful, for example.

srinivasvenu commented 5 years ago

I got it resolved by doing the following in my machine. root@myubuntu:~# uname -a Linux myubuntu 4.4.0-72-generic #93-Ubuntu SMP Fri Mar 31 14:07:41 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux

In order to compile the spacemonkey openssl wrapper code for openssl1.0.x version, we need to do the following things sudo apt-get install libssl-dev reason: Most Linux distros install their libraries in two halves. libfoo will contain the actual binary code of the foo library; this is all you need to run programs that use foo. To compile such programs from source, you also need the library headers, which come in a package called libfoo-dev (Debian family) or libfoo-devel (Fedora family). libfoo is often installed by default; libfoo-dev is not.

you need to copy libcrypto.pc,libssl.pc and openssl.pc files to pkgconfig location cp /tmp/openssl.pc /tmp/libcrypto.pc /tmp/libssl.pc /usr/lib/x86_64-linux-gnu/pkgconfig/

root@myubuntu:/tmp# cat /tmp/libcrypto.pc prefix=/usr exec_prefix=${prefix} libdir=${exec_prefix}/lib/x86_64-linux-gnu includedir=${prefix}/include enginesdir=${libdir}/engines-1.1

Name: OpenSSL-libcrypto Description: OpenSSL cryptography library Version: 1.0.0 Libs: -L${libdir} -lcrypto Libs.private: -ldl -pthread Cflags: -I${includedir}

root@myubuntu:/tmp# cat /tmp/libssl.pc prefix=/usr exec_prefix=${prefix} libdir=${exec_prefix}/lib/x86_64-linux-gnu includedir=${prefix}/include

Name: OpenSSL-libssl Description: Secure Sockets Layer and cryptography libraries Version: 1.0.0 Requires.private: libcrypto Libs: -L${libdir} -lssl Cflags: -I${includedir}

root@myubuntu:/tmp# cat openssl.pc prefix=/usr exec_prefix=${prefix} libdir=${exec_prefix}/lib/x86_64-linux-gnu includedir=${prefix}/include

Name: OpenSSL Description: Secure Sockets Layer and cryptography libraries and tools Version: 1.0.0 Requires: libssl libcrypto