gcc,pkg-config,libyaml and etc..
21067 단어 tools
order of lib imports in gcc/lib are importants
the order of lib imports in gcc/lib are importants.
I used to have this command line, the code is as follow.
rm -f ../../.ext/i386-mingw32/openssl.so gcc -shared -o ../../.ext/i386-mingw32/openssl.so openssl_missing.o ossl.o ossl_asn1.o ossl_bio.o ossl_bn.o ossl_cipher.o ossl_config.o ossl_digest.o ossl_engine.o ossl_hmac.o ossl_ns_spki.o ossl_ocsp.o ossl_pkcs12.o ossl_pkcs5.o ossl_pkcs7.o ossl_pkey.o ossl_pkey_dh.o ossl_pkey_dsa.o ossl_pkey_ec.o ossl_pkey_rsa.o ossl_rand.o ossl_ssl.o ossl_ssl_session.o ossl_x509.o ossl_x509attr.o ossl_x509cert.o ossl_x509crl.o ossl_x509ext.o ossl_x509name.o ossl_x509req.o ossl_x509revoked.o ossl_x509store.o -L.-L../..-L/mingw:/local32/lib -L.-L/local32/lib -mthreads -L/mingw/lib -L/local32/lib -LC:/MinGW/local32/lib -Wl,--enable-auto-image-base,--enable-auto-import-L/mingw/lib -L/local32/lib openssl-i386-mingw32.def-lmsvcrt-ruby210 -lcrypto -lgdi32 -lws2_32 -lwsock32 -lssl -lgmp -lshell32 -liphlpapi -limagehlp -lshlwapi
while it has error complaining that undefined referenced to
CreateDAC@16
and etc.. then I changed the order of -l{libs}, where the
from
-lcrypto -lgdi32 -lws2_32 -lwsock32 -lssl
to
-lssl -lcrypto -lws2_32 -lgdi32 -lwsock32
so basically I have moved -lssl, and -lcrypto in front of their dependent libraries, then the compiles just worked fine.
References: [ITS#5603) Linking OpenSSL on Windows requires libgdi32 and libws2_32 after libcrypto] ( http://www.openldap.org/lists/openldap-bugs/200807/msg00050.html )
pkg-config, the libs.private
you might find that the following lines in the pkg-config’s config files.
Libs:-L${libdir}-lssl -lcrypto Libs.private:-lws2_32 -lgdi32 -lcrypt32
that means, if static linked, the
-lws2_32 -lgdi32 -lcrypt32
are required, though they are not parts of libraries that are exposed by this package. http://linux.die.net/man/1/pkg-conf
–with-opt-dir
the
--with-opt-dir
if present tells the build system where to find necessary additional library and header files. e.g.
wget-chttp://ftp.ruby-lang.org/pub/ruby/1.9/ruby-1.9.3-p125.tar.gz tar zvxf ruby-1.9.3-p125.tar.gz cd ruby-1.9.3-p125 ./configure--prefix=/usr/local--enable-shared--disable-install-doc--with-opt-dir=/usr/local/lib make&&install
where mine is
PATH_SEPARATOR=":"./configure --prefix=${LOCALDESTDIR}--enable-shared --disable-install-doc --with-opt-dir=/mingw/lib:${LOCALDESTDIR}&& \ make && \ make install
References: 루비 설치에 libyaml-devel이 없는 패키지
Compiling libyaml on Windows
References:
Compiling libyaml on Windows Compile error while compiling libyaml under windows 7
the key is to modify the code
#lif defined _WIN32# if defined(YAML_DECLARE_STATIC)# define YAML_DECLARE(type) type# elif defined(YAML_DECLARE_EXPORT)# define YAML_DECLARE(type) __declspec(dllexport) type# else# define YAML_DECLARE(type) __declspec(dllimport) type# endif #else# define YAML_DECLARE(type) type #endif
to
#if defined(__MINGW32__)# define YAML_DECLARE(type) type#elifdefined _WIN32 # if defined(YAML_DECLARE_STATIC)# define YAML_DECLARE(type) type# elif defined(YAML_DECLARE_EXPORT)# define YAML_DECLARE(type) __declspec(dllexport) type# else# define YAML_DECLARE(type) __declspec(dllimport) type# endif #else# define YAML_DECLARE(type) type #endif
StackEdit Viewer
이 내용에 흥미가 있습니까?
현재 기사가 여러분의 문제를 해결하지 못하는 경우 AI 엔진은 머신러닝 분석(스마트 모델이 방금 만들어져 부정확한 경우가 있을 수 있음)을 통해 가장 유사한 기사를 추천합니다:
PHP CS Fixer는 무엇이며 코드를 더 깔끔하게 유지하는 데 어떻게 도움이 됩니까?PHP CS Fixer는 PHP Coding Standards Fixer의 약자입니다. 인기 있는 및 PHP 프레임워크 상호 운용성 그룹에서 게시한 과 같이 따를 수 있는 다양한 PHP 코딩 표준이 있습니다(PSR ...
텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
CC BY-SA 2.5, CC BY-SA 3.0 및 CC BY-SA 4.0에 따라 라이센스가 부여됩니다.