stef / libopaque

c implementation of the OPAQUE protocol with bindings for python, php, ruby, lua, zig, java, erlang, golang, js and SASL.
GNU Lesser General Public License v3.0
69 stars 10 forks source link

linker command failed with exit code 1 #34

Closed sudeep-moharana-idnow closed 1 year ago

sudeep-moharana-idnow commented 1 year ago

Hi,

While running the make command I'm getting the following error. Can you please help me resolve this? I am on mac 13.2 with intel processor.

gcc -shared -march=native -Wall -O2 -g -fstack-protector-strong -D_FORTIFY_SOURCE=2 -fasynchronous-unwind-tables -fpic -fstack-clash-protection -fcf-protection=full -Werror=format-security -Werror=implicit-function-declaration -Wl,-z,defs -Wl,-z,relro -ftrapv -Wl,-z,noexecstack -Iaux_ -Wl,-soname,libopaque.so -o libopaque.so common.o opaque.o aux_/kdf_hkdf_sha512.o -g -lsodium ld: unknown option: -z clang: error: linker command failed with exit code 1 (use -v to see invocation) make: *** [libopaque.so] Error 1

stef commented 1 year ago

hmm, seems you use clang? which version of clang? newer versions do support -z afaik.

sudeep-moharana-idnow commented 1 year ago

I am on clang version 14

stef commented 1 year ago

it seems - according to the internet - -z is a gnu ld thing, and not supported by macos clang ld.

you can also just adjust the flags, and remove those -z linker flags. they will disable security protections, but will otherwise work. you need to find out what kind of link time flags exist on your system that provide similar security features as those that you removed, or even better ones.

or you could use gnu ld.

sudeep-moharana-idnow commented 1 year ago

I was able to build this which basically creates libopaque.so in my lib. However the python library which calls ctypes.util.find_library('opaque') or ctypes.util.find_library('libopaque') fails because cytype.util.find_library is looking for the following. elif os.name == "posix" and sys.platform == "darwin": from ctypes.macholib.dyld import dyld_find as _dyld_find def find_library(name): possible = ['lib%s.dylib' % name, '%s.dylib' % name, '%s.framework/%s' % (name, name) since this one is of type .so, the function returns none. Is there a way to generate a .dylib file?

stef commented 1 year ago

sorry, i have zero experience or access to apple products. although this seems to be an easy problem that is probably solved by many other projects already, it should be easy to find such and test those, i am happy to accept pull requests!

stef commented 1 year ago

closing this issue, please reopen if you disagree with this decision.