dsklzerpx64815631 2016-07-15 07:24 采纳率: 100%
浏览 185

GOLANG静态库链接

OS->Ubuntu 16.04 LTS | Go Vesrion-> 1.6.2 64 bit

I am using this github.com/xeodou/go-sqlcipher PKG

This Pkg need ->libcrypto library

This is the Link of program what i am compiling from _example folder from above pkg https://play.golang.org/p/drJGhsWiEi

when i am using-> go build encryption.go (encryption binary genrated)

command-> file ./encryption

encryption: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, for GNU/Linux 2.6.32, BuildID[sha1]=91d49d6db997f83dfc722b820e5cab4cc16854cf, not stripped

command-> ldd ./encrption

    linux-vdso.so.1 =>  (0x00007ffca8fba000)
    libcrypto.so.1.0.0 => /lib/x86_64-linux-gnu/libcrypto.so.1.0.0 (0x00007fa93c071000)
    libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007fa93be6d000)
    libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007fa93bc4f000)
    libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007fa93b886000)
    /lib64/ld-linux-x86-64.so.2 (0x000055f1aa574000)

command-> ./encryption

Output i am getting - {"name":"xeodou", "password": "123456"}

when i am using ->go build --ldflags '-extldflags "-static"' encryption.go

command-> file ./encryption

encryption: ELF 64-bit LSB executable, x86-64, version 1 (GNU/Linux), statically linked, for GNU/Linux 2.6.32, BuildID[sha1]=71fa3d0c30cc5c52dd4f8bea432f8e0468225f9a, not stripped

command-> ldd ./encryption

   not a dynamic executable

command-> ./encryption

Output i am getting - Segmentation fault (core dumped)

The thing i am not getting is when same binary run in other device some it worked some not.

Please guide me

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 如何在scanpy上做差异基因和通路富集?
    • ¥20 关于#硬件工程#的问题,请各位专家解答!
    • ¥15 关于#matlab#的问题:期望的系统闭环传递函数为G(s)=wn^2/s^2+2¢wn+wn^2阻尼系数¢=0.707,使系统具有较小的超调量
    • ¥15 FLUENT如何实现在堆积颗粒的上表面加载高斯热源
    • ¥30 截图中的mathematics程序转换成matlab
    • ¥15 动力学代码报错,维度不匹配
    • ¥15 Power query添加列问题
    • ¥50 Kubernetes&Fission&Eleasticsearch
    • ¥15 報錯:Person is not mapped,如何解決?
    • ¥15 c++头文件不能识别CDialog