logo
Apache Lounge
Webmasters

 

About Forum Index Downloads Search Register Log in RSS X


Keep Server Online

If you find the Apache Lounge, the downloads and overall help useful, please express your satisfaction with a donation.

or

Bitcoin

A donation makes a contribution towards the costs, the time and effort that's going in this site and building.

Thank You! Steffen

Your donations will help to keep this site alive and well, and continuing building binaries. Apache Lounge is not sponsored.
Post new topic   Forum Index -> Building & Member Downloads View previous topic :: View next topic
Reply to topic   Topic: Failed linking C shared library mod_md.so Page 1, 2  Next
Author
tanquang



Joined: 21 Mar 2020
Posts: 58
Location: Vietnam

PostPosted: Mon 09 May '22 13:32    Post subject: Failed linking C shared library mod_md.so Reply with quote

This bug comes from at least version 2.4.48, but to the current version is still not fixed.
Before compiling Apache httpd-2, I have successfully compiled (also compile order) before using VS 2013 with Update 5 (Ultimate) + CMAKE v3.23.1 (x86_64): zlib v1.2.12, PCRE v8.45, Expat v2.4.8, OpenSSL v1.1.1o, libxml2 v2.9.14, jansson v2.14, Brotli v1.0.9, Lua v5.4.4, APR v1.7.0, APR-Util v1.6.1, Nghttp2 v1.47.0, cURL v7.83.0. All are the latest version!
With cURL, I compiled both dynamic libraries (before) and static libraries (after).
But when comes to Apache httpd-2 compile:
Code:
--
-- Summary of feature detection:
--
-- LIBXML2_FOUND ............ : TRUE
-- LUA51_FOUND .............. : TRUE
-- NGHTTP2_FOUND ............ : TRUE
-- OPENSSL_FOUND ............ : TRUE
-- ZLIB_FOUND ............... : TRUE
-- BROTLI_FOUND ............. : TRUE
-- CURL_FOUND ............... : TRUE
-- JANSSON_FOUND ............ : TRUE
-- APR_HAS_LDAP ............. : TRUE
-- APR_HAS_XLATE ............ : FALSE
-- APU_HAVE_CRYPTO .......... : TRUE
--
...
--
--
-- Apache httpd configuration summary:
--
--   Build type ...................... : Release
--   Install .pdb (if available)...... : OFF
--   Install manual .................. : ON
--   Install prefix .................. : /phpStudy/Apache
--   C compiler ...................... : C:/Program Files (x86)/Microsoft Visual Studio 12.0/VC/bin/cl.exe
--   APR include directory ........... : /phpStudy/Apache/include
--   APR libraries ................... : /phpStudy/Apache/lib/libapr-1.lib;/phpStudy/Apache/lib/libaprutil-1.lib;/phpStudy/Apache/lib/apr_ldap1.lib
--   OpenSSL include directory ....... : /phpStudy/Apache/include
--   OpenSSL libraries ............... : /phpStudy/Apache/lib/libssl.lib;/phpStudy/Apache/lib/libcrypto.lib
--   PCRE include directory .......... : /phpStudy/Apache/include
--   PCRE libraries .................. : /phpStudy/Apache/lib/pcre.lib
--   libxml2 iconv prereq include dir. :
--   libxml2 iconv prereq libraries .. :
--   Brotli include directory......... : /phpStudy/Apache/include
--   Brotli libraries ................ : /phpStudy/Apache/lib/brotlienc.lib;/phpStudy/Apache/lib/brotlicommon.lib
--   Curl include directory........... :
--   Jansson libraries ............... : /phpStudy/Apache/lib/jansson.lib
--   Extra include directories ....... :
--   Extra compile flags ............. :
--   Extra libraries ................. :

Then I use nmake:

...
[ 40%] Building C object CMakeFiles/mod_md.dir/modules/md/mod_md_ocsp.c.obj
mod_md_ocsp.c
[ 40%] Building RC object CMakeFiles/mod_md.dir/build/win32/httpd.rc.res
Microsoft (R) Windows (R) Resource Compiler Version 6.3.9600.17336
Copyright (C) Microsoft Corporation.  All rights reserved.

[ 40%] Linking C shared library mod_md.so
LINK: command "C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\bin\link.exe /nologo @CMakeFiles\mod_md.dir\objects1.rsp /out:mod_md.so /implib:mod_md.lib /pdb:C:\httpd\bin\mod_md.pdb /dll /version:0.0 /base:@C:/httpd/bin/BaseAddr.ref,mod_md.so /machine:X86 /INCREMENTAL:NO \phpStudy\Apache\lib\libssl.lib \phpStudy\Apache\lib\libcrypto.lib \phpStudy\Apache\lib\jansson.lib mod_watchdog.lib libhttpd.lib \phpStudy\Apache\lib\libapr-1.lib \phpStudy\Apache\lib\libaprutil-1.lib \phpStudy\Apache\lib\apr_ldap-1.lib ws2_32.lib mswsock.lib \phpStudy\Apache\lib\pcre.lib ws2_32.lib mswsock.lib kernel32.lib user32.lib gdi32.lib winspool.lib shell32.lib ole32.lib oleaut32.lib uuid.lib comdlg32.lib advapi32.lib /MANIFEST /MANIFESTFILE:mod_md.so.manifest" failed (exit code 1120) with the following output:
   Creating library mod_md.lib and object mod_md.exp
md_curl.c.obj : error LNK2019: unresolved external symbol __imp__curl_global_init referenced in function _md_curl_init
md_curl.c.obj : error LNK2019: unresolved external symbol __imp__curl_slist_append referenced in function _curlify_headers
md_curl.c.obj : error LNK2019: unresolved external symbol __imp__curl_slist_free_all referenced in function _md_curl_req_cleanup
md_curl.c.obj : error LNK2019: unresolved external symbol __imp__curl_easy_strerror referenced in function _md_curl_perform
md_curl.c.obj : error LNK2019: unresolved external symbol __imp__curl_easy_initreferenced in function _internals_setup
md_curl.c.obj : error LNK2019: unresolved external symbol __imp__curl_easy_setopt referenced in function _internals_setup
md_curl.c.obj : error LNK2019: unresolved external symbol __imp__curl_easy_perform referenced in function _md_curl_perform
md_curl.c.obj : error LNK2019: unresolved external symbol __imp__curl_easy_cleanup referenced in function _md_curl_req_cleanup
md_curl.c.obj : error LNK2019: unresolved external symbol __imp__curl_easy_getinfo referenced in function _md_curl_perform
md_curl.c.obj : error LNK2019: unresolved external symbol __imp__curl_multi_init referenced in function _md_curl_multi_perform
md_curl.c.obj : error LNK2019: unresolved external symbol __imp__curl_multi_add_handle referenced in function _md_curl_multi_perform
md_curl.c.obj : error LNK2019: unresolved external symbol __imp__curl_multi_remove_handle referenced in function _md_curl_multi_perform
md_curl.c.obj : error LNK2019: unresolved external symbol __imp__curl_multi_wait referenced in function _md_curl_multi_perform
md_curl.c.obj : error LNK2019: unresolved external symbol __imp__curl_multi_perform referenced in function _md_curl_multi_perform
md_curl.c.obj : error LNK2019: unresolved external symbol __imp__curl_multi_cleanup referenced in function _md_curl_multi_perform
md_curl.c.obj : error LNK2019: unresolved external symbol __imp__curl_multi_info_read referenced in function _md_curl_multi_perform
md_curl.c.obj : error LNK2019: unresolved external symbol __imp__curl_multi_strerror referenced in function _md_curl_multi_perform
mod_md.so : fatal error LNK1120: 17 unresolved externals
NMAKE : fatal error U1077: '"C:\Program Files\CMake\bin\cmake.exe"' : return code '0xffffffff'
Stop.
NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\BIN\nmake.exe"' : return code '0x2'
Stop.
NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\BIN\nmake.exe"' : return code '0x2'
Stop.

P/s: The error code above I copied from my previous error report on ASF Bugzilla – Bug 65602. The latest version is still the same.
During the HTTPD compilation, the compiler (apparently) didn't find cURL.
Previously, I have asked questions on StackOverflow about this error. No one has a solid solution, but they have come up with a "pretty good" solution: Compile again cURL during HTTPD compilation (i.e. cURL will be compiled a total of 3 times).
All relevant information will probably be on the report on ASF Bugzilla, I will add more information if missing. So I posted this topic in the hope that everyone could help me solve this error!
Quote:
I don't understand the syntax of CMakeLists.txt (latest - v2.4.53), it seems to variable CURL_INCLUDE_DIR that exists but not SET.
Because JANSSON_INCLUDE_DIR variable, it appears 3 times, the first SET in the 97 line before being put into the SET in line 499.
Although I'm not sure, but CURL_INCLUDE_DIR has been created but has not been "assigned" so it couldn't find curl library...
Back to top
nono303



Joined: 20 Dec 2016
Posts: 205
Location: Lille, FR, EU

PostPosted: Mon 09 May '22 15:27    Post subject: Reply with quote

Hi @tanquang,
What is your httpd cmake cmd line ?$

On my side:
Code:
cmake  -G "Ninja" ^
-DCMAKE_INSTALL_PREFIX=C:\sdk\release\vs17_x64-avx ^
-DCMAKE_BUILD_TYPE=RelWithDebInfo -DINSTALL_PDB=ON ^
-DINSTALL_MANUAL=OFF ^
-DENABLE_MODULES=A ^
-DLUA_LIBRARIES=C:/sdk/release/vs17_x64-avx/lib/liblua.lib ^
-DLUA_INCLUDE_DIR=C:/sdk/release/vs17_x64-avx/include ^
-DLIBXML2_ICONV_INCLUDE_DIR=C:/sdk/release/vs17_x64-avx/include ^
-DLIBXML2_ICONV_LIBRARIES=C:/sdk/release/vs17_x64-avx/lib/libiconv.lib ^
-DZLIB_LIBRARIES=C:/sdk/release/vs17_x64-avx/lib/zlib.lib ^
-DJANSSON_INCLUDE_DIR=C:/sdk/release/vs17_x64-avx/include ^
-DJANSSON_LIBRARIES=C:/sdk/release/vs17_x64-avx/lib/jansson.lib ^
-DMAXMIND_LIBRARIES=C:\sdk\release\vs17_x64-avx/lib/maxminddb.lib ^
-DOPENSSL_ROOT_DIR=C:/sdk/release/vs17_x64-avx ^
-DCURL_LIBRARY=C:/sdk/release/vs17_x64-avx/lib/libcurl.lib ^
-DCURL_INCLUDE_DIR=C:/sdk/release/vs17_x64-avx/include ^
-DEXTRA_INCLUDES=C:/sdk/src/openssl ^
C:\sdk\src\httpd

result:
Code:
--
--
-- Apache httpd configuration summary:
--
--   Build type ...................... : RelWithDebInfo
--   Install .pdb (if available)...... : ON
--   Install manual .................. : OFF
--   Install prefix .................. : C:/sdk/release/vs17_x64-avx
--   C compiler ...................... : C:/sdk/softs/vs22/Community/VC/Tools/MSVC/14.32.31326/bin/Hostx64/x64/cl.exe
--   APR include directory ........... : C:/sdk/release/vs17_x64-avx/include
--   APR libraries ................... : C:/sdk/release/vs17_x64-avx/lib/libapr-1.lib;C:/sdk/release/vs17_x64-avx/lib/libaprutil-1.lib;C:/sdk/release/vs17_x64-avx/lib/apr_ldap-1.lib
--   OpenSSL include directory ....... : C:/sdk/release/vs17_x64-avx/include
--   OpenSSL libraries ............... : C:/sdk/release/vs17_x64-avx/lib/libssl.lib;C:/sdk/release/vs17_x64-avx/lib/libcrypto.lib
--   PCRE include directory .......... : C:/sdk/release/vs17_x64-avx/include
--   PCRE libraries .................. : C:/sdk/release/vs17_x64-avx/lib/pcre2-8.lib
--   libxml2 iconv prereq include dir. : C:/sdk/release/vs17_x64-avx/include
--   libxml2 iconv prereq libraries .. : C:/sdk/release/vs17_x64-avx/lib/libiconv.lib
--   Brotli include directory......... : C:/sdk/release/vs17_x64-avx/include
--   Brotli libraries ................ : C:/sdk/release/vs17_x64-avx/lib/brotlienc.lib;C:/sdk/release/vs17_x64-avx/lib/brotlicommon.lib
--   Curl include directory........... : C:/sdk/release/vs17_x64-avx/include
--   Jansson libraries ............... : C:/sdk/release/vs17_x64-avx/lib/jansson.lib
--   Extra include directories ....... : C:/sdk/src/openssl
--   Extra compile flags ............. :
--   Extra libraries ................. :

with Curl include directory set and compile working
Code:
...
-- Installing: C:/sdk/release/vs16_x86/modules/mod_md.so
...
Back to top
tanquang



Joined: 21 Mar 2020
Posts: 58
Location: Vietnam

PostPosted: Mon 09 May '22 22:28    Post subject: Reply with quote

nono303 wrote:
Hi @tanquang,
What is your httpd cmake cmd line ?$
...

The CMAKE command line when compiling HTTPD is:
Code:
cmake -G "NMake Makefiles" -DCMAKE_INSTALL_PREFIX=\phpStudy\Apache -DCMAKE_BUILD_TYPE=Release -DENABLE_MODULES=i -DINSTALL_PDB=OFF ..

Looking at your command line, it seems that you had to manually assign the entire path to the relevant folders and libraries?
Exactly is CMake was unable to automatically find the directory and the library of cURL? This is a bug of CMake, or of the CMakeLists.txt file of HTTPD?
I used
Code:
-DENABLE_MODULES=i
because I skipped compiling APR-ICONV because I didn't know how to compile it using the CMake command line. So some modules like mod_charset_lite.so were not created.
P/s: Here are all my compiled command lines, can you take a look at it?!
Back to top
nono303



Joined: 20 Dec 2016
Posts: 205
Location: Lille, FR, EU

PostPosted: Tue 10 May '22 8:30    Post subject: Reply with quote

Looking on FindCURL.cmake:
Code:
# Look for the header file.
find_path(CURL_INCLUDE_DIR

find_package_handle_standard_args(CURL
                                  REQUIRED_VARS CURL_LIBRARY CURL_INCLUDE_DIR

So, you MUST set CURL_LIBRARY & CURL_INCLUDE_DIR to have cmake be able to link it to httpd
Path might be relative or absolute
You ca have a look on my build files here: https://github.com/nono303/win-build-scripts/tree/master/modules
Back to top
tanquang



Joined: 21 Mar 2020
Posts: 58
Location: Vietnam

PostPosted: Tue 10 May '22 14:57    Post subject: Reply with quote

Hello, I "guessed" the right problem.
First, I don't know the syntax used in CMake, so I will use the syntax in Java to explain.
The cause of the error is due to the CURL_INCLUDE_DIR and CURL_LIBRARIES variables which are declared but not have been initialized. That is why CMake has not been able to find the directory and library file of cURL.
I tried to change a bit, namely the value SET for CURL_INCLUDE_DIR and CURL_LIBRARIES variables inside the CMakeLists.txt file (please see the difference between the default version and the version I changed here). And praiseworthy, it found cURL and conducted normal compilation!
Anyway, I really hope they will update this change in the next version.
Back to top
nono303



Joined: 20 Dec 2016
Posts: 205
Location: Lille, FR, EU

PostPosted: Thu 12 May '22 18:44    Post subject: Reply with quote

Hi @tanquang,
I Clearly don’t understand what you mean with Java syntax or want to do patching CMakeLists.txt but… just simply change your cmd line from
Code:
cmake -G "NMake Makefiles" -DCMAKE_INSTALL_PREFIX=\phpStudy\Apache -DCMAKE_BUILD_TYPE=Release -DENABLE_MODULES=i -DINSTALL_PDB=OFF ...

to
Code:
cmake -G "NMake Makefiles" -DCMAKE_INSTALL_PREFIX=\phpStudy\Apache -DCMAKE_BUILD_TYPE=Release -DENABLE_MODULES=i -DINSTALL_PDB=OFF -DCURL_LIBRARY=**YOUR_LIB_PATH**/libcurl.lib -DCURL_INCLUDE_DIR=**YOUR_INCLUDE_PATH**/ ...

It might (must) works Wink
Back to top
tanquang



Joined: 21 Mar 2020
Posts: 58
Location: Vietnam

PostPosted: Fri 13 May '22 18:52    Post subject: Reply with quote

Yes. In fact both of you and I can help compile successfully. But I like something "more automatically". In my way, CMake can automatically find cURL that you don't need to manually specify the path to cURL.
Back to top
tanquang



Joined: 21 Mar 2020
Posts: 58
Location: Vietnam

PostPosted: Tue 31 May '22 19:58    Post subject: Reply with quote

nono303 wrote:
Hi @tanquang,
I Clearly don’t understand what you mean with Java syntax or want to do patching CMakeLists.txt but… just simply change your cmd line from
Code:
cmake -G "NMake Makefiles" -DCMAKE_INSTALL_PREFIX=\phpStudy\Apache -DCMAKE_BUILD_TYPE=Release -DENABLE_MODULES=i -DINSTALL_PDB=OFF ...

to
Code:
cmake -G "NMake Makefiles" -DCMAKE_INSTALL_PREFIX=\phpStudy\Apache -DCMAKE_BUILD_TYPE=Release -DENABLE_MODULES=i -DINSTALL_PDB=OFF -DCURL_LIBRARY=**YOUR_LIB_PATH**/libcurl.lib -DCURL_INCLUDE_DIR=**YOUR_INCLUDE_PATH**/ ...

It might (must) works Wink

Hello
What is the cURL compilation command line that you are using?
I'm using these commands to compile cURL:
Code:
==================== Compile Dynamic Libraries ====================
cmake -G "NMake Makefiles" -DCMAKE_INSTALL_PREFIX=\phpStudy\Apache -DCMAKE_BUILD_TYPE=Release -DCURL_USE_OPENSSL=ON -DCURL_USE_SCHANNEL=ON -DCURL_WINDOWS_SSPI=ON -DCURL_BROTLI=ON -DUSE_NGHTTP2=ON -DHAVE_LDAP_SSL=ON -DENABLE_UNICODE=ON -DCURL_STATIC_CRT=OFF -DBUILD_SHARED_LIBS=ON ..
nmake
nmake install

==================== Compile Static Libraries ====================
cmake -G "NMake Makefiles" -DCMAKE_INSTALL_PREFIX=\phpStudy\Apache -DCMAKE_BUILD_TYPE=Release -DCURL_USE_OPENSSL=ON -DCURL_USE_SCHANNEL=ON -DCURL_WINDOWS_SSPI=ON -DCURL_BROTLI=ON -DUSE_NGHTTP2=ON -DHAVE_LDAP_SSL=ON -DENABLE_UNICODE=ON -DCURL_STATIC_CRT=OFF -DBUILD_SHARED_LIBS=OFF ..
nmake
nmake install

I compiled cURL twice at the same time: First as dynamic libraries, then static libraries.
At this point, it will form two files: libcurl_imp.lib and libcurl.lib.
Then, if I specify -DCURL_LIBRARY as a libcurl.lib file just like you did during httpd compilation, I'll have the same error at the linking C shared library mod_md.so step. But if I specify -DCURL_LIBRARY is a libcurl_imp.lib file. It will compile normally without errors occurring.
Why is that?
Back to top
nono303



Joined: 20 Dec 2016
Posts: 205
Location: Lille, FR, EU

PostPosted: Thu 02 Jun '22 16:48    Post subject: Reply with quote

Hi @tanquang,
my curl build script is https://github.com/nono303/win-build-scripts/blob/master/modules/curl.bat with this patch https://github.com/nono303/win-build-scripts/blob/master/modules/curl.patch
- I use shared lib for mod_md / httpd link
Back to top
tanquang



Joined: 21 Mar 2020
Posts: 58
Location: Vietnam

PostPosted: Thu 02 Jun '22 18:37    Post subject: Reply with quote

nono303 wrote:
Hi @tanquang,
my curl build script is https://github.com/nono303/win-build-scripts/blob/master/modules/curl.bat with this patch https://github.com/nono303/win-build-scripts/blob/master/modules/curl.patch
- I use shared lib for mod_md / httpd link

I have seen your curl build script. It can be seen, you are indicating -DBUILD_SHARED_LIBS as ON, but according to the library file you receive must be libcurl_imp.lib rather than libcurl.lib. Do you use a 3rd party curl library file?
I only received the file libcurl.lib after completing the Static Library compilation step (please see my compiled command line above).
Back to top
nono303



Joined: 20 Dec 2016
Posts: 205
Location: Lille, FR, EU

PostPosted: Fri 03 Jun '22 21:33    Post subject: Reply with quote

Quote:
Do you use a 3rd party curl library file?

see https://github.com/nono303/win-build-scripts/blob/master/modules/curl.bat l.55
Quote:
for %%Y in (libcurl-target.cmake lib\cmake_install.cmake build.ninja) do (sed -i 's/libcurl_imp\.lib/libcurl\.lib/g' %CYGPATH_BUILD%/%1/%%Y)

I had changed shared lib name for other purpose
Back to top
Jan-E



Joined: 09 Mar 2012
Posts: 1266
Location: Amsterdam, NL, EU

PostPosted: Tue 07 Jun '22 14:15    Post subject: Reply with quote

When building with a static libcurl (with VS16 or the like) there has to be an extra flag CURL_STATICLIB. Quoting my own remarks about mod_md:
Quote:
NB. use libcurl_a.lib from curl schannel

perl -pi.bak -e "s/NDEBUG;WIN32/NDEBUG;CURL_STATICLIB;WIN32/gi" modules/md/mod_md.vcxproj

mod_md.dsp
/D "NDEBUG"
/D "NDEBUG" /D "CURL_STATICLIB"
Back to top
tanquang



Joined: 21 Mar 2020
Posts: 58
Location: Vietnam

PostPosted: Tue 07 Jun '22 21:27    Post subject: Reply with quote

nono303 wrote:
I had changed shared lib name for other purpose

Therefore, it is! :o
Back to top
tanquang



Joined: 21 Mar 2020
Posts: 58
Location: Vietnam

PostPosted: Tue 07 Jun '22 21:35    Post subject: Reply with quote

I have searched for documents related to the CURL_STATICLIB flag that you said. Incidentally, I found this article: CURL_STATICLIB + Visual Studio + CMake
So, you mean is that I need to change the cURL static library compiling command line to (I add it in front of the flag -DCURL_STATIC_CRT):
Code:
cmake -G "NMake Makefiles" -DCMAKE_INSTALL_PREFIX=\phpStudy\Apache -DCMAKE_BUILD_TYPE=Release -DCURL_USE_OPENSSL=ON -DCURL_USE_SCHANNEL=ON -DCURL_WINDOWS_SSPI=ON -DCURL_BROTLI=ON -DUSE_NGHTTP2=ON -DHAVE_LDAP_SSL=ON -DENABLE_UNICODE=ON -DCURL_STATICLIB=ON -DCURL_STATIC_CRT=OFF -DBUILD_SHARED_LIBS=OFF ..

Then use the libcurl.lib file (instead of libcurl_imp.lib file) during the HTTPD compilation process?
Back to top
Jan-E



Joined: 09 Mar 2012
Posts: 1266
Location: Amsterdam, NL, EU

PostPosted: Wed 08 Jun '22 7:34    Post subject: Reply with quote

Either use a shared libcurl without the flag or use a static libcurl with the CURL_STATICLIB flag. Both should work.
Back to top
tanquang



Joined: 21 Mar 2020
Posts: 58
Location: Vietnam

PostPosted: Wed 08 Jun '22 12:51    Post subject: Reply with quote

Jan-E wrote:
Either use a shared libcurl without the flag or use a static libcurl with the CURL_STATICLIB flag. Both should work.

So, with the dynamic library (libcurl_imp.lib file), I can build without any problems. But with the static library, I will have to use the CURL_STATICLIB flag (to use the libcurl.lib file) during the HTTPD compiler.
Back to top
nono303



Joined: 20 Dec 2016
Posts: 205
Location: Lille, FR, EU

PostPosted: Thu 09 Jun '22 12:04    Post subject: Reply with quote

Jan-E wrote:
Either use a shared libcurl without the flag or use a static libcurl with the CURL_STATICLIB flag. Both should work.

I can confirm that static or shared works Wink
Back to top
tanquang



Joined: 21 Mar 2020
Posts: 58
Location: Vietnam

PostPosted: Thu 09 Jun '22 20:19    Post subject: Reply with quote

nono303 wrote:
Jan-E wrote:
Either use a shared libcurl without the flag or use a static libcurl with the CURL_STATICLIB flag. Both should work.

I can confirm that static or shared works Wink

I also confirmed the use of libcurl_imp.lib file (dynamic library) will work. I haven't tried on the static library (with CURL_STATICLIB flag) so I can't confirm ...
Back to top
tanquang



Joined: 21 Mar 2020
Posts: 58
Location: Vietnam

PostPosted: Sun 12 Jun '22 21:15    Post subject: Reply with quote

Jan-E wrote:
Either use a shared libcurl without the flag or use a static libcurl with the CURL_STATICLIB flag. Both should work.

Seems like something is not right for me...
I added the flag -DCURL_STATICLIB=ON when compiling the static cURL, specifically:
First, I will compile the dynamic library with the following commands:
Code:
cmake -G "NMake Makefiles" -DCMAKE_INSTALL_PREFIX=\phpStudy\Apache -DCMAKE_BUILD_TYPE=Release -DCURL_USE_OPENSSL=ON -DCURL_USE_SCHANNEL=ON -DCURL_WINDOWS_SSPI=ON -DCURL_BROTLI=ON -DUSE_NGHTTP2=ON -DHAVE_LDAP_SSL=ON -DENABLE_UNICODE=ON -DCURL_STATIC_CRT=OFF ..

Quote:
P/s: According to cURL's CMakeLists.txt file, line 75, flag -DBUILD_SHARED_LIBS is set as ON by default. Therefore, I don't need to put that flag in the command line.

After that, I proceeded to compile a static library with the following command line:
Code:
cmake -G "NMake Makefiles" -DCMAKE_INSTALL_PREFIX=\phpStudy\Apache -DCMAKE_BUILD_TYPE=Release -DCURL_USE_OPENSSL=ON -DCURL_USE_SCHANNEL=ON -DCURL_WINDOWS_SSPI=ON -DCURL_BROTLI=ON -DUSE_NGHTTP2=ON -DHAVE_LDAP_SSL=ON -DENABLE_UNICODE=ON -DCURL_STATICLIB=ON -DCURL_STATIC_CRT=OFF -DBUILD_SHARED_LIBS=OFF ..

I have specified the flag -DCURL_STATICLIB as ON, this is what it printed:
Quote:
-- curl version=[7.83.1]
CMake Warning (dev) at C:/Program Files/CMake/share/cmake-3.23/Modules/FindPackageHandleStandardArgs.cmake:438 (message):
The package name passed to `find_package_handle_standard_args` (BROTLI) does not match the name of the calling package (Brotli). This can lead to problems in calling code that expects `find_package` result variables (e.g., `_FOUND`) to follow a certain pattern.
Call Stack (most recent call first):
CMake/FindBrotli.cmake:29 (find_package_handle_standard_args)
CMakeLists.txt:721 (find_package)
This warning is for project developers. Use -Wno-dev to suppress it.

-- Could NOT find LibSSH2 (missing: LIBSSH2_LIBRARY LIBSSH2_INCLUDE_DIR)
-- Enabled features: SSL IPv6 unixsockets libz brotli AsynchDNS Largefile SSPI alt-svc HSTS SPNEGO Kerberos NTLM HTTP2 MultiSSL HTTPS-proxy unicode
-- Enabled protocols: DICT FILE FTP FTPS GOPHER GOPHERS HTTP HTTPS IMAP IMAPS LDAP LDAPS MQTT POP3 POP3S RTSP SMB SMBS SMTP SMTPS TELNET TFTP
-- Enabled SSL backends: OpenSSL Schannel
-- Configuring done
-- Generating done
-- Build files have been written to: C:/httpd/srclib/curl/bin

(It seems) It is a warning related to Brotli, so I switched to Apache compilation.
Apache found a static library file (libcurl.lib file) but it still had the same error in the step [ 65%] Linking C shared library mod_md.so.
I don't understand why it still appears?!
Back to top
tanquang



Joined: 21 Mar 2020
Posts: 58
Location: Vietnam

PostPosted: Sun 12 Jun '22 21:16    Post subject: Reply with quote

nono303 wrote:
I can confirm that static or shared works Wink

Now, I can confirm that it doesn't work...
Back to top


Reply to topic   Topic: Failed linking C shared library mod_md.so View previous topic :: View next topic
Post new topic   Forum Index -> Building & Member Downloads Page 1, 2  Next