V2EX = way to explore
V2EX 是一个关于分享和探索的地方
Sign Up Now
For Existing Member  Sign In
shylockhg
V2EX  ›  问与答

请教一个 c++编译链接问题

  •  1
     
  •   shylockhg · Oct 14, 2019 · 1733 views
    This topic created in 2392 days ago, the information mentioned may be changed or developed.

    一个 c++程序会使用到 libcurl,我这里是通过 gcc 编译,通过-L<xxpath>,-lcurl_7_26 选项链接了一个工程下的 libcurl_7_26.a,但是 ldd 的时候发现链接到了系统的 libcurl.so 上面,这个是什么情况?</xxpath>

    Supplement 1  ·  Oct 15, 2019
    发现问题了,cmake -DCURL_DISABLE_LDAP -DCURL_STATICLIB 编译出来的 libcurl.a 居然实际上是 shared library....
    aarch64 环境。。。
    Supplement 2  ·  Oct 15, 2019
    cmake -DCURL_DISABLE_LDAP=ON -DCURL_STATICLIB=ON
    1 replies    2019-10-14 12:11:13 +08:00
    ghonfir
        1
    ghonfir  
       Oct 14, 2019
    默认链接先是动态库 然后是静态库
    假如需要链接静态库 显式的写-l xxx/libcurl_7_26.a 试试
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   2564 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 31ms · UTC 07:47 · PVG 15:47 · LAX 00:47 · JFK 03:47
    ♥ Do have faith in what you're doing.