Hi, Finally I found the reason. The program find lib “crypto” in the default path. And my system has installed a openssl-0.98. That version doesn’t support “gcm”.
I installed a new version openssl from source code, but it only generate libcrypto.a in directory “lib/“. And I notice that there’s the libcrypto.dylib in /usr/lib. So I use brew to install the latest openssl in from the repo. Then use command as follows: cc -g -L/path/to/brew repo/openssl/1.0.2a-1/lib/ -Wall -I../../include -o test aesgcm.c -lcrypto It works. Br, Great Soul [email protected] > On Jul 24, 2015, at 7:52 PM, [email protected] wrote: > > > And I use both gcc and clang with command “cc -g -Wall -I../../include > > -lcrypto aesgcm.c" to compile the source code. > Long version: > Note that the linker processes its libraries from left to right, e.g. if you > have an object file object.o and to libraries > liba.a and libb.a, then "cc object.o -la -lb" will first collect all > unresolved symbols in the object files, then it will > resolve whatever it can resolve with the files in liba.a, possibly adding new > unresolved symbols and finally it > will try to resolve the remaining symbols with libb.a. If you do "cc object.o > -lb -la", it will again start with the > symbols from object.o, resolve what it can against libb.a, then resolve the > reamaining stuff against liba.a and > if it adds any symbol from liba.a that needs something from libb.a you get an > error. > If you do "cc -lb -la object.o", it will start with no symbols, add whatever > it needs to resolve the symbols from > libb.a (i.e. nothing), then adds whatever it needs from liba.a (i.e. > nothing), then add object.o and complain > about everything that remains unresolved. > > In short: try "cc ... aesgcm.c -lcrypto", that should work. > > Regards, > Stefan > _______________________________________________ > openssl-dev mailing list > To unsubscribe: https://mta.openssl.org/mailman/listinfo/openssl-dev
_______________________________________________ openssl-dev mailing list To unsubscribe: https://mta.openssl.org/mailman/listinfo/openssl-dev
