zoukankan      html  css  js  c++  java
  • 「android」gomobile argument unused during compilation: '-stdlib=libc++'

    【问题】

    android基于go的NDK开发中配置gomobile参考官方WIKI:https://github.com/golang/go/wiki/Mobile,大致步骤:

    1、下载gomobile:$ go get golang.org/x/mobile/cmd/gomobile

    2、初始化 $ gomobile init
    但是使用gomobile编译官方例子($ gomobile build -target=android golang.org/x/mobile/example/basic)

    时提示错误:argument unused during compilation: '-stdlib=libc++'

    版本:go 1.11,mac os10.13.1

    【解决】

    网上居然没搜到该问题,难道就我遇到了这个问题? 开始以为是clang,gcc引起的,更新了go版本,无效。

    从字面上理解这个错误,是编译时带了-stdlib=libc++,但是却没有用到该参数???

    libc++是针对clang编译器特别重写的C++标准库,libstdc++是gcc的,单独编译用gcc和clang编译cpp文件,无论是否带-stdlib=libc++,均正常。

    在官方的github上不小心搜到了一样的问题,我去!花了这么多时间。

    修改android的ndk中的build/tools/make_standalone_toolchain.py,去掉-stdlib=libc++,两个地方:

    1、flags = '-target {} -stdlib=libc++'.format(target)改为flags = '-target {}'.format(target)

    2、cxx_flags = flags + ' -stdlib=libc++'改为cxx_flags = flags

    修改之后重新 $ gomobile init

  • 相关阅读:
    01 WEB白帽子Python入门
    07 SSRF漏洞
    JAVA基础学习day04--IDEA、方法
    一些常用的计算机快捷指令
    记录一次xss平台的安装
    upload-labs
    蓝队防护基础
    bagecms的代码审计
    window入侵排查基本
    常用端口总结
  • 原文地址:https://www.cnblogs.com/ftrako/p/10299948.html
Copyright © 2011-2022 走看看