weidai11 / cryptopp

free C++ class library of cryptographic schemes
https://cryptopp.com
Other
4.88k stars 1.51k forks source link

'dynamic' target fails on MinGW x32 and x64 #25

Closed IlyaBizyaev closed 9 years ago

IlyaBizyaev commented 9 years ago
g++ -shared -o libcryptopp.so -DNDEBUG -g2 -O3 -march=native -Wall -Wextra -Wno-type-limits -Wno-unknown-pragmas -pipe 3way.o adler32.o algebra.o algparam.o arc4.o asn.o authenc.o base32.o base64.o basecode.o bfinit.o blowfish.o blumshub.o camellia.o cast.o casts.o cbcmac.o ccm.o channels.o cmac.o cpu.o crc.o cryptlib.o default.o des.o dessp.o dh.o dh2.o dll.o dsa.o eax.o ec2n.o eccrypto.o ecp.o elgamal.o emsa2.o eprecomp.o esign.o files.o filters.o fips140.o fipstest.o gcm.o gf256.o gf2_32.o gf2n.o gfpcrypt.o gost.o gzip.o hex.o hmac.o hrtimer.o ida.o idea.o integer.o iterhash.o luc.o mars.o marss.o md2.o md4.o md5.o misc.o modes.o mqueue.o mqv.o nbtheory.o network.o oaep.o osrng.o panama.o pkcspad.o polynomi.o pssr.o pubkey.o queue.o rabin.o randpool.o rc2.o rc5.o rc6.o rdtables.o rijndael.o ripemd.o rng.o rsa.o rw.o safer.o salsa.o seal.o seed.o serpent.o sha.o sha3.o shacal2.o shark.o sharkbox.o simple.o skipjack.o socketft.o sosemanuk.o square.o squaretb.o strciphr.o tea.o tftables.o tiger.o tigertab.o trdlocal.o ttmac.o twofish.o vmac.o wait.o wake.o whrlpool.o winpipes.o xtr.o xtrcrypt.o zdeflate.o zinflate.o zlib.o
socketft.o: In function `ZN8CryptoPP14SocketReceiver16GetReceiveResultEv':
c:\cryptopp-master/socketft.cpp:372: undefined reference to `WSAGetOverlappedResult@20'
c:\cryptopp-master/socketft.cpp:379: undefined reference to `WSAGetLastError@0'
socketft.o: In function `ZN8CryptoPP12SocketSender13GetSendResultEv':
c:\cryptopp-master/socketft.cpp:469: undefined reference to `WSAGetOverlappedResult@20'
socketft.o: In function `ZN8CryptoPP12SocketSender4SendEPKhj':
c:\cryptopp-master/socketft.cpp:418: undefined reference to `WSASend@28'
c:\cryptopp-master/socketft.cpp:425: undefined reference to `WSAGetLastError@0'
socketft.o: In function `ZN8CryptoPP6Socket8ShutDownEi':
c:\cryptopp-master/socketft.cpp:209: undefined reference to `shutdown@8'
socketft.o: In function `ZN8CryptoPP12SocketSender7SendEofEv':
c:\cryptopp-master/socketft.cpp:437: undefined reference to `WSAEventSelect@12'
socketft.o: In function `ZN8CryptoPP14SocketReceiver7ReceiveEPhj':
c:\cryptopp-master/socketft.cpp:337: undefined reference to `WSARecv@28'
c:\cryptopp-master/socketft.cpp:344: undefined reference to `WSAGetLastError@0'
socketft.o: In function `ZN8CryptoPP6Socket11CloseSocketEv':
c:\cryptopp-master/socketft.cpp:85: undefined reference to `closesocket@4'
socketft.o: In function `ZN8CryptoPP6Socket6CreateEi':
c:\cryptopp-master/socketft.cpp:73: undefined reference to `socket@12'
socketft.o: In function `ZN8CryptoPP6Socket11CloseSocketEv':
c:\cryptopp-master/socketft.cpp:85: undefined reference to `closesocket@4'
socketft.o: In function `ZN8CryptoPP6Socket4BindEjPKc':
c:\cryptopp-master/socketft.cpp:104: undefined reference to `inet_addr@4'
c:\cryptopp-master/socketft.cpp:113: undefined reference to `htons@4'
socketft.o: In function `ZN8CryptoPP6Socket4BindEPK8sockaddri':
c:\cryptopp-master/socketft.cpp:122: undefined reference to `bind@12'
socketft.o: In function `ZN8CryptoPP6Socket12SetLastErrorEi':
c:\cryptopp-master/socketft.cpp:300: undefined reference to `WSASetLastError@4'
socketft.o: In function `ZN8CryptoPP6Socket4BindEjPKc':
c:\cryptopp-master/socketft.cpp:101: undefined reference to `htonl@4'
socketft.o: In function `ZN8CryptoPP6Socket4BindEPK8sockaddri':
c:\cryptopp-master/socketft.cpp:122: undefined reference to `bind@12'
socketft.o: In function `ZN8CryptoPP6Socket6ListenEi':
c:\cryptopp-master/socketft.cpp:128: undefined reference to `listen@8'
socketft.o: In function `ZN8CryptoPP6Socket7ConnectEPKcj':
c:\cryptopp-master/socketft.cpp:138: undefined reference to `inet_addr@4'
c:\cryptopp-master/socketft.cpp:152: undefined reference to `htons@4'
socketft.o: In function `ZN8CryptoPP6Socket7ConnectEPK8sockaddri':
c:\cryptopp-master/socketft.cpp:160: undefined reference to `connect@12'
socketft.o: In function `ZN8CryptoPP6Socket7ConnectEPKcj':
c:\cryptopp-master/socketft.cpp:142: undefined reference to `gethostbyname@4'
socketft.o: In function `ZN8CryptoPP6Socket12GetLastErrorEv':
c:\cryptopp-master/socketft.cpp:291: undefined reference to `WSAGetLastError@0'
socketft.o: In function `ZN8CryptoPP6Socket12SetLastErrorEi':
c:\cryptopp-master/socketft.cpp:300: undefined reference to `WSASetLastError@4'
socketft.o: In function `ZN8CryptoPP6Socket7ConnectEPK8sockaddri':
c:\cryptopp-master/socketft.cpp:160: undefined reference to `connect@12'
socketft.o: In function `ZN8CryptoPP6Socket12GetLastErrorEv':
c:\cryptopp-master/socketft.cpp:291: undefined reference to `WSAGetLastError@0'
socketft.o: In function `ZN8CryptoPP6Socket6AcceptERS0_P8sockaddrPi':
c:\cryptopp-master/socketft.cpp:170: undefined reference to `accept@12'
socketft.o: In function `ZN8CryptoPP6Socket11CloseSocketEv':
c:\cryptopp-master/socketft.cpp:85: undefined reference to `closesocket@4'
socketft.o: In function `ZN8CryptoPP6Socket12GetLastErrorEv':
c:\cryptopp-master/socketft.cpp:291: undefined reference to `WSAGetLastError@0'
socketft.o: In function `ZN8CryptoPP6Socket11GetSockNameEP8sockaddrPi':
c:\cryptopp-master/socketft.cpp:181: undefined reference to `getsockname@12'
socketft.o: In function `ZN8CryptoPP6Socket11GetPeerNameEP8sockaddrPi':
c:\cryptopp-master/socketft.cpp:187: undefined reference to `getpeername@12'
socketft.o: In function `ZN8CryptoPP6Socket4SendEPKhji':
c:\cryptopp-master/socketft.cpp:193: undefined reference to `send@16'
socketft.o: In function `ZN8CryptoPP6Socket7ReceiveEPhji':
c:\cryptopp-master/socketft.cpp:201: undefined reference to `recv@16'
socketft.o: In function `ZN8CryptoPP6Socket8ShutDownEi':
c:\cryptopp-master/socketft.cpp:209: undefined reference to `shutdown@8'
socketft.o: In function `ZN8CryptoPP6Socket5IOCtlElPm':
c:\cryptopp-master/socketft.cpp:217: undefined reference to `ioctlsocket@12'
socketft.o: In function `ZN8CryptoPP6Socket9SendReadyEPK7timeval':
c:\cryptopp-master/socketft.cpp:234: undefined reference to `select@20'
socketft.o: In function `ZN8CryptoPP6Socket12ReceiveReadyEPK7timeval':
c:\cryptopp-master/socketft.cpp:251: undefined reference to `select@20'
socketft.o: In function `ZN8CryptoPP6Socket12SetLastErrorEi':
c:\cryptopp-master/socketft.cpp:300: undefined reference to `WSASetLastError@4'
socketft.o: In function `ZN8CryptoPP6Socket12StartSocketsEv':
c:\cryptopp-master/socketft.cpp:273: undefined reference to `WSAStartup@8'
socketft.o: In function `ZN8CryptoPP6Socket15ShutdownSocketsEv':
c:\cryptopp-master/socketft.cpp:282: undefined reference to `WSACleanup@0'
socketft.o: In function `ZN8CryptoPP6Socket12GetLastErrorEv':
c:\cryptopp-master/socketft.cpp:291: undefined reference to `WSAGetLastError@0'
socketft.o: In function `ZN8CryptoPP6Socket11CloseSocketEv':
c:\cryptopp-master/socketft.cpp:85: undefined reference to `closesocket@4'
c:\cryptopp-master/socketft.cpp:85: undefined reference to `closesocket@4'
socketft.o: In function `ZN8CryptoPP12SocketSender7EofSentEv':
c:\cryptopp-master/socketft.cpp:446: undefined reference to `WSAEnumNetworkEvents@12'
socketft.o: In function `ZN8CryptoPP6Socket16PortNameToNumberEPKcS2_':
c:\cryptopp-master/socketft.cpp:263: undefined reference to `getservbyname@8'
c:\cryptopp-master/socketft.cpp:266: undefined reference to `ntohs@4'
socketft.o: In function `ZN8CryptoPP6Socket12GetLastErrorEv':
c:\cryptopp-master/socketft.cpp:291: undefined reference to `WSAGetLastError@0'
collect2.exe: error: ld returned 1 exit status
make: *** [libcryptopp.so] Error 1
IlyaBizyaev commented 9 years ago

Nearly same output on MinGW-w64:

socketft.o: In function `CryptoPP::SocketReceiver::GetReceiveResult()':
c:\cryptopp/socketft.cpp:372: undefined reference to `__imp_WSAGetOverlappedResult'
c:\cryptopp/socketft.cpp:379: undefined reference to `__imp_WSAGetLastError'
socketft.o: In function `CryptoPP::SocketSender::GetSendResult()':
c:\cryptopp/socketft.cpp:469: undefined reference to `__imp_WSAGetOverlappedResult'
socketft.o: In function `CryptoPP::SocketSender::Send(unsigned char const*, unsigned long long)':
c:\cryptopp/socketft.cpp:418: undefined reference to `__imp_WSASend'
c:\cryptopp/socketft.cpp:425: undefined reference to `__imp_WSAGetLastError'
socketft.o: In function `CryptoPP::Socket::ShutDown(int)':
c:\cryptopp/socketft.cpp:209: undefined reference to `__imp_shutdown'
socketft.o: In function `CryptoPP::SocketSender::SendEof()':
c:\cryptopp/socketft.cpp:437: undefined reference to `__imp_WSAEventSelect'
socketft.o: In function `CryptoPP::SocketReceiver::Receive(unsigned char*, unsigned long long)':
c:\cryptopp/socketft.cpp:337: undefined reference to `__imp_WSARecv'
c:\cryptopp/socketft.cpp:344: undefined reference to `__imp_WSAGetLastError'
socketft.o: In function `CryptoPP::Socket::CloseSocket()':
c:\cryptopp/socketft.cpp:85: undefined reference to `__imp_closesocket'
socketft.o: In function `CryptoPP::Socket::Create(int)':
c:\cryptopp/socketft.cpp:73: undefined reference to `__imp_socket'
socketft.o: In function `CryptoPP::Socket::CloseSocket()':
c:\cryptopp/socketft.cpp:85: undefined reference to `__imp_closesocket'
socketft.o: In function `CryptoPP::Socket::Bind(unsigned int, char const*)':
c:\cryptopp/socketft.cpp:104: undefined reference to `__imp_inet_addr'
c:\cryptopp/socketft.cpp:113: undefined reference to `__imp_htons'
socketft.o: In function `CryptoPP::Socket::Bind(sockaddr const*, int)':
c:\cryptopp/socketft.cpp:122: undefined reference to `__imp_bind'
socketft.o: In function `CryptoPP::Socket::SetLastError(int)':
c:\cryptopp/socketft.cpp:300: undefined reference to `__imp_WSASetLastError'
socketft.o: In function `CryptoPP::Socket::Bind(unsigned int, char const*)':
c:\cryptopp/socketft.cpp:101: undefined reference to `__imp_htonl'
socketft.o: In function `CryptoPP::Socket::Bind(sockaddr const*, int)':
c:\cryptopp/socketft.cpp:122: undefined reference to `__imp_bind'
socketft.o: In function `CryptoPP::Socket::Listen(int)':
c:\cryptopp/socketft.cpp:128: undefined reference to `__imp_listen'
socketft.o: In function `CryptoPP::Socket::Connect(char const*, unsigned int)':
c:\cryptopp/socketft.cpp:138: undefined reference to `__imp_inet_addr'
c:\cryptopp/socketft.cpp:152: undefined reference to `__imp_htons'
socketft.o: In function `CryptoPP::Socket::Connect(sockaddr const*, int)':
c:\cryptopp/socketft.cpp:160: undefined reference to `__imp_connect'
socketft.o: In function `CryptoPP::Socket::Connect(char const*, unsigned int)':
c:\cryptopp/socketft.cpp:142: undefined reference to `__imp_gethostbyname'
socketft.o: In function `CryptoPP::Socket::GetLastError()':
c:\cryptopp/socketft.cpp:291: undefined reference to `__imp_WSAGetLastError'
socketft.o: In function `CryptoPP::Socket::SetLastError(int)':
c:\cryptopp/socketft.cpp:300: undefined reference to `__imp_WSASetLastError'
socketft.o: In function `CryptoPP::Socket::Connect(sockaddr const*, int)':
c:\cryptopp/socketft.cpp:160: undefined reference to `__imp_connect'
socketft.o: In function `CryptoPP::Socket::GetLastError()':
c:\cryptopp/socketft.cpp:291: undefined reference to `__imp_WSAGetLastError'
socketft.o: In function `CryptoPP::Socket::Accept(CryptoPP::Socket&, sockaddr*, int*)':
c:\cryptopp/socketft.cpp:170: undefined reference to `__imp_accept'
socketft.o: In function `CryptoPP::Socket::CloseSocket()':
c:\cryptopp/socketft.cpp:85: undefined reference to `__imp_closesocket'
socketft.o: In function `CryptoPP::Socket::GetLastError()':
c:\cryptopp/socketft.cpp:291: undefined reference to `__imp_WSAGetLastError'
socketft.o: In function `CryptoPP::Socket::GetSockName(sockaddr*, int*)':
c:\cryptopp/socketft.cpp:181: undefined reference to `__imp_getsockname'
socketft.o: In function `CryptoPP::Socket::GetPeerName(sockaddr*, int*)':
c:\cryptopp/socketft.cpp:187: undefined reference to `__imp_getpeername'
socketft.o: In function `CryptoPP::Socket::Send(unsigned char const*, unsigned long long, int)':
c:\cryptopp/socketft.cpp:193: undefined reference to `__imp_send'
socketft.o: In function `CryptoPP::Socket::Receive(unsigned char*, unsigned long long, int)':
c:\cryptopp/socketft.cpp:201: undefined reference to `__imp_recv'
socketft.o: In function `CryptoPP::Socket::ShutDown(int)':
c:\cryptopp/socketft.cpp:209: undefined reference to `__imp_shutdown'
socketft.o: In function `CryptoPP::Socket::IOCtl(long, unsigned long*)':
c:\cryptopp/socketft.cpp:217: undefined reference to `__imp_ioctlsocket'
socketft.o: In function `CryptoPP::Socket::SendReady(timeval const*)':
c:\cryptopp/socketft.cpp:234: undefined reference to `__imp_select'
c:\cryptopp/socketft.cpp:230: undefined reference to `__imp_select'
socketft.o: In function `CryptoPP::Socket::ReceiveReady(timeval const*)':
c:\cryptopp/socketft.cpp:251: undefined reference to `__imp_select'
c:\cryptopp/socketft.cpp:247: undefined reference to `__imp_select'
socketft.o: In function `CryptoPP::Socket::GetLastError()':
c:\cryptopp/socketft.cpp:291: undefined reference to `__imp_WSAGetLastError'
socketft.o: In function `CryptoPP::Socket::SetLastError(int)':
c:\cryptopp/socketft.cpp:300: undefined reference to `__imp_WSASetLastError'
socketft.o: In function `CryptoPP::SocketSender::EofSent()':
c:\cryptopp/socketft.cpp:446: undefined reference to `__imp_WSAEnumNetworkEvents'
socketft.o: In function `CryptoPP::Socket::GetLastError()':
c:\cryptopp/socketft.cpp:291: undefined reference to `__imp_WSAGetLastError'
socketft.o: In function `CryptoPP::Socket::CloseSocket()':
c:\cryptopp/socketft.cpp:85: undefined reference to `__imp_closesocket'
c:\cryptopp/socketft.cpp:85: undefined reference to `__imp_closesocket'
socketft.o: In function `CryptoPP::Socket::ShutdownSockets()':
c:\cryptopp/socketft.cpp:282: undefined reference to `__imp_WSACleanup'
socketft.o: In function `CryptoPP::Socket::StartSockets()':
c:\cryptopp/socketft.cpp:273: undefined reference to `__imp_WSAStartup'
socketft.o: In function `CryptoPP::Socket::PortNameToNumber(char const*, char const*)':
c:\cryptopp/socketft.cpp:263: undefined reference to `__imp_getservbyname'
c:\cryptopp/socketft.cpp:266: undefined reference to `__imp_ntohs'
collect2.exe: error: ld returned 1 exit status
make: *** [libcryptopp.so] Error 1
noloader commented 9 years ago

This appeared to be a problem recently introduced in the detection of MinGW. I believe the Makefile was interpreting a character that was meant for the shell. When the shell got the modified command and arguments, it failed to detect MinGW.

mouse07410 commented 9 years ago

Are we making a mistake trying to keep everything in one Makefile, rather than several for different OS/compilers?

Sent from my iPad

On Oct 25, 2015, at 04:51, Jeffrey Walton notifications@github.com<mailto:notifications@github.com> wrote:

This appeared to be a problem recently introduced in the detection of MinGW. I believe the Makefile was interpreting a character that was meant for the shell. When the shell got the modified command and arguments, it failed to detect MinGW.

— Reply to this email directly or view it on GitHubhttps://github.com/weidai11/cryptopp/issues/25#issuecomment-150902160.

noloader commented 9 years ago

Are we making a mistake trying to keep everything in one Makefile, rather than several for different OS/compilers?

Good question .... Two part answer. First, I feel the Makefile is a bit too busy or large. I split the cross-compile Makefile out for that reason.

Second, there was a gap in testing. It was a process failure, and it was resolved with improved testing procedures. The testing procedures I have been following are located at Release Testing.

Now if I could only get MinGW to run most of the time. I have it installed in three places, and only one of them works (the Windows 7 installation).