找回密码
 立即注册
搜索
热搜: 活动 交友 discuz
查看: 37|回复: 5

交叉编译simple

[复制链接]

10

主题

317

回帖

668

积分

高级会员

积分
668
发表于 2017-7-29 19:05:39 | 显示全部楼层 |阅读模式
https://github.com/shadowsocks/simple-obfs

因为没有配置好的win环境,所以题主尝试在Debian上对simple-obfs进行了交叉编译,却在最终步骤不幸遇坑,遂前来求助万能的locer~

宿主机已正确配置libpthread,但执行configure时一直提示 "configure: error: Can not find pthreads.",stackoverflow上的各种hack也没有效果。

详细信息如下:

OS:Debian 8
编译器:gcc-4.9
win32 library: mingw

编译指令如下:
[ol]
  • ver=0.0.3
  • git clone https://github.com/shadowsocks/simple-obfs
  • cd simple-obfs
  • git checkout v$ver -b v$ver
  • git submodule init && git submodule update
  • ./autogen.sh
  • LIBS="-lpthread -lm" LDFLAGS="-Wl,-static -static -static-libgcc -L/projects/dists/libsodium/lib -L/projects/dists/libudns/lib -L/projects/dists/libev/lib" CFLAGS="-I/projects/dists/libsodium/include -I/projects/dists/libudns/include -I/projects/dists/libev/include" ./configure --host=i686-w64-mingw32 --prefix=/projects/dists/shadowsocks-libev --disable-ssp --disable-documentation
  • make && make install[/ol]复制代码

    错误日志如下:
    [ol]
  • checking how to convert x86_64-pc-linux-gnu file names to i686-w64-mingw32 format... func_convert_file_nix_to_w32
  • checking how to convert x86_64-pc-linux-gnu file names to toolchain format... func_convert_file_noop
  • checking for /usr/bin/ld option to reload object files... -r
  • checking for i686-w64-mingw32-objdump... no
  • checking for objdump... objdump
  • checking how to recognize dependent libraries... file_magic ^x86 archive import|^x86 DLL
  • checking for i686-w64-mingw32-dlltool... no
  • checking for dlltool... no
  • checking how to associate runtime and link libraries... func_cygming_dll_for_implib_fallback
  • checking for i686-w64-mingw32-ar... ar
  • checking for archiver @FILE support... @
  • checking for i686-w64-mingw32-strip... no
  • checking for strip... strip
  • checking for i686-w64-mingw32-ranlib... no
  • checking for ranlib... ranlib
  • checking command to parse nm output from gcc object... ok
  • checking for sysroot... no
  • checking for a working dd... /bin/dd
  • checking how to truncate binary pipes... /bin/dd bs=4096 count=1
  • checking for i686-w64-mingw32-mt... no
  • checking for mt... mt
  • checking if mt is a manifest tool... no
  • checking for dlfcn.h... yes
  • checking for objdir... .libs
  • checking if gcc supports -fno-rtti -fno-exceptions... no
  • checking for gcc option to produce PIC... -DDLL_EXPORT -DPIC
  • checking if gcc PIC flag -DDLL_EXPORT -DPIC works... yes
  • checking if gcc static flag -static works... yes
  • checking if gcc supports -c -o file.o... yes
  • checking if gcc supports -c -o file.o... (cached) yes
  • checking whether the gcc linker (/usr/bin/ld) supports shared libraries... yes
  • checking dynamic linker characteristics... Win32 ld.exe
  • checking how to hardcode library paths into programs... immediate
  • checking whether stripping libraries is possible... yes
  • checking if libtool supports shared libraries... yes
  • checking whether to build shared libraries... no
  • checking whether to build static libraries... yes
  • checking for i686-w64-mingw32-gcc... gcc
  • checking whether we are using the GNU C compiler... (cached) yes
  • checking whether gcc accepts -g... (cached) yes
  • checking for gcc option to accept ISO C89... (cached) none needed
  • checking whether gcc understands -c and -o together... (cached) yes
  • checking whether ln -s works... yes
  • checking whether make sets $(MAKE)... (cached) yes
  • checking for thread local storage (TLS) class... __thread
  • checking for C/C++ restrict keyword... __restrict
  • checking for netdb.h... yes
  • checking for library containing inet_ntop... no
  • checking for inet_ntop... no
  • checking whether inet_ntop is declared... yes
  • checking for what kind of host... MinGW
  • checking if compiler needs -Werror to reject unknown flags... no
  • checking for the pthreads library -lpthreads... no
  • checking whether pthreads work without any flags... no
  • checking whether pthreads work with -Kthread... no
  • checking whether pthreads work with -kthread... no
  • checking for the pthreads library -llthread... no
  • checking whether pthreads work with -pthread... no
  • checking whether pthreads work with -pthreads... no
  • checking whether pthreads work with -mthreads... no
  • checking for the pthreads library -lpthread... no
  • checking whether pthreads work with --thread-safe... no
  • checking whether pthreads work with -mt... no
  • checking for pthread-config... no
  • configure: error: Can not find pthreads.  This is required.
  • [/ol]复制代码
  • 回复

    使用道具 举报

    6

    主题

    61

    回帖

    158

    积分

    注册会员

    积分
    158
    发表于 2017-7-29 19:30:58 | 显示全部楼层
    不懂帮顶

    回复

    使用道具 举报

    12

    主题

    213

    回帖

    486

    积分

    中级会员

    积分
    486
    发表于 2017-7-29 19:32:38 | 显示全部楼层
    gcc 加参数 -pthreads
    回复

    使用道具 举报

    185

    主题

    3065

    回帖

    6771

    积分

    论坛元老

    积分
    6771
    发表于 2017-7-29 20:15:22 | 显示全部楼层
    交叉编译关你宿主机上pthreads毛事,编译出来还一起带着宿主机到你win机器上用么
    回复

    使用道具 举报

    3

    主题

    180

    回帖

    395

    积分

    中级会员

    积分
    395
    发表于 2017-7-29 23:04:21 | 显示全部楼层
    configure.ac 里面把 pthread 相关的一段删掉就行了
    回复

    使用道具 举报

    12

    主题

    213

    回帖

    486

    积分

    中级会员

    积分
    486
    发表于 2017-8-1 01:50:27 | 显示全部楼层
    ...交叉。。。没认真看,以为是直接编绎的。
    回复

    使用道具 举报

    您需要登录后才可以回帖 登录 | 立即注册

    本版积分规则

    Archiver|手机版|小黑屋|Discuz! X

    GMT+8, 2025-2-12 18:57 , Processed in 0.015916 second(s), 4 queries , Gzip On, Redis On.

    Powered by Discuz! X3.5

    © 2001-2024 Discuz! Team.

    快速回复 返回顶部 返回列表