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

  • 相关阅读:
    python3 logging模块
    第二周作业购物车程序
    第一周作业-三级菜单
    第一周作业-模拟登陆
    python元组与购物车程序
    python之路-day1-while循环
    centos安装phpmyadmin
    第196天:js---调用函数的五种方式
    第195天:js---函数对象详解(call、apply)
    第194天:js---函数对象详解(arguments、length)
  • 原文地址:https://www.cnblogs.com/ftrako/p/10299948.html
Copyright © 2011-2022 走看看