Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

emcc 在windows平台上无法构建 #951

Closed
shiliupingGitHub opened this issue Sep 15, 2020 · 19 comments
Closed

emcc 在windows平台上无法构建 #951

shiliupingGitHub opened this issue Sep 15, 2020 · 19 comments
Milestone

Comments

@shiliupingGitHub
Copy link

请尽量清晰精准地描述你所期待的结果。

错误信息

如果可能,请尽量附加程序运行过程中的错误输出信息。

如果是xmake相关编译问题,请加上-vD参数运行,并给出详细编译输出信息。

相关环境

请提供编译和运行环境信息,下面是一些必须填写的基础信息,便于我们针对性排查问题:

  • xmake版本:2.3.7
  • xmake运行平台:windows
  • xmake目标平台:emcc

其他信息

请提供其他附加信息帮助我们诊断问题(比如截图,xmake.lua或者可复现的demo),以及你遇到的问题的一些背景信息。

@waruqi
Copy link
Member

waruqi commented Sep 15, 2020

我现在没有 emcc/windows 环境,你先在 cmd 下执行 xmake f lib.detect.find_tool emcc 给我看下输出结果 (在非xmake工程目录下执行,避免缓存干扰)

@Gaubee
Copy link

Gaubee commented Sep 16, 2020

xmake f lib.detect.find_tool emcc 
xmake v2.3.7+202009151508, A cross-platform build utility based on Lua
Copyright (C) 2015-2020 Ruki Wang, tboox.org, xmake.io
                         _        
    __  ___ __  __  __ _| | ______ 
    \ \/ / |  \/  |/ _  | |/ / __ \
     >  <  | \__/ | /_| |   <  ___/
    /_/\_\_|_|  |_|\__ \|_|\_\____| 
                         by ruki, tboox.org
    
    👉  Manual: https://xmake.io/#/getting_started    
    🙏  Donate: https://xmake.io/#/sponsor


Usage: $xmake config|f [options] [target]

Configure the project.

Common options:
    -q, --quiet                            Quiet operation.
    -y, --yes                              Input yes by default if need user confirm.
        --confirm=CONFIRM                  Input the given result if need user confirm.
                                               - yes
                                               - no
                                               - def
    -v, --verbose                          Print lots of verbose information for users.
        --root                             Allow to run xmake as root.
    -D, --diagnosis                        Print lots of diagnosis information (backtrace, check info ..) only for
                                           developers.
                                           And we can append -v to get more whole information.
                                               e.g. $ xmake -vD
        --profile                          Print performance data only for developers.
        --version                          Print the version number and exit.
    -h, --help                             Print this help message and exit.

    -F FILE, --file=FILE                   Read a given xmake.lua file.
    -P PROJECT, --project=PROJECT          Change to the given project directory.
                                           Search priority:
                                               1. The Given Command Argument
                                               2. The Envirnoment Variable: XMAKE_PROJECT_DIR
                                               3. The Current Directory

Command options (config):
    -c, --clean                            Clean the cached configure and configure all again.
        --menu                             Configure project with a menu-driven user interface.

    -p PLAT, --plat=PLAT                   Compile for the given platform. (default: windows)
                                               - android
                                               - bsd
                                               - cross
                                               - cygwin
                                               - iphoneos
                                               - linux
                                               - macosx
                                               - mingw
                                               - msys
                                               - watchos
                                               - windows
    -a ARCH, --arch=ARCH                   Compile for the given architecture. (default: auto)
                                               - android: armeabi armeabi-v7a arm64-v8a x86 x86_64 mips mip64
                                               - bsd: i386 x86_64
                                               - cross: i386 x86_64 armv7 armv7s arm64-v8a mips mips64
                                               - cygwin: i386 x86_64
                                               - iphoneos: arm64 armv7 armv7s i386 x86_64
                                               - linux: i386 x86_64 armv7 armv7s arm64-v8a mips mips64
                                               - macosx: i386 x86_64
                                               - mingw: i386 x86_64
                                               - msys: i386 x86_64
                                               - watchos: armv7k i386
                                               - windows: x86 x64
    -m MODE, --mode=MODE                   Compile for the given mode. (default: release)
                                               - debug
                                               - release
                                               - ... (custom)
    -k KIND, --kind=KIND                   Compile for the given target kind. (default: static)
                                               - static
                                               - shared
                                               - binary
        --host=HOST                        The Current Host Environment. (default: windows)

        --require=REQUIRE                  Require all dependent packages?
                                               - y: force to enable
                                               - n: disable
        --pkg_searchdirs=PKG_SEARCHDIRS    The search directories of the remote package.
                                               e.g.
                                               - xmake f --pkg_searchdirs=/dir1;/dir2

        --cross=CROSS                      The Cross Toolchains Prefix
                                           e.g.
                                               - i386-mingw32-
                                               - arm-linux-androideabi-
        --bin=BIN                          The Cross Toolchains Bin Directory
                                           e.g.
                                               - sdk/bin (/arm-linux-gcc ..)
        --sdk=SDK                          The Cross SDK Directory
                                           e.g.
                                               - sdk/bin
                                               - sdk/lib
                                               - sdk/include
        --toolchain=TOOLCHAIN              The Toolchain Name
                                           e.g.
                                               - xmake f --toolchain=clang
                                               - xmake f --toolchain=[cross|llvm|sdcc ..] --sdk=/xxx
                                               - run `xmake show -l toolchains` to get all toolchains

        --cc=CC                            The C Compiler
        --cxx=CXX                          The C++ Compiler
        --cpp=CPP                          The C Preprocessor

        --ld=LD                            The Linker
        --ar=AR                            The Static Library Linker
        --sh=SH                            The Shared Library Linker
        --ranlib=RANLIB                    The Static Library Index Generator

        --cflags=CFLAGS                    The C Compiler Flags
        --cxflags=CXFLAGS                  The C/C++ compiler Flags
        --cxxflags=CXXFLAGS                The C++ Compiler Flags

        --ldflags=LDFLAGS                  The Binary Linker Flags
        --arflags=ARFLAGS                  The Static Library Linker Flags
        --shflags=SHFLAGS                  The Shared Library Linker Flags

        --links=LINKS                      The Link Libraries
        --syslinks=SYSLINKS                The System Link Libraries
        --linkdirs=LINKDIRS                The Link Search Directories
        --includedirs=INCLUDEDIRS          The Include Search Directories
        --frameworks=FRAMEWORKS            The Frameworks
        --frameworkdirs=FRAMEWORKDIRS      The Frameworks Search Directories

        --rc=RC                            The Rust Compiler

        --rcld=RCLD                        The Rust Linker
        --rcar=RCAR                        The Rust Static Library Archiver
        --rcsh=RCSH                        The Rust Shared Library Linker

        --fc=FC                            The Fortran Compiler

        --fcld=FCLD                        The Fortran Linker
        --fcsh=FCSH                        The Fortran Shared Library Linker

        --mm=MM                            The Objc Compiler
        --mxx=MXX                          The Objc++ Compiler

        --mflags=MFLAGS                    The Objc Compiler Flags
        --mxflags=MXFLAGS                  The Objc/c++ Compiler Flags
        --mxxflags=MXXFLAGS                The Objc++ Compiler Flags

        --go=GO                            The Golang Compiler

        --gcld=GCLD                        The Golang Linker
        --go-ar=GO-AR                      The Golang Static Library Linker

        --sc=SC                            The Swift Compiler

        --scld=SCLD                        The Swift Linker
        --scsh=SCSH                        The Swift Shared Library Linker

        --zc=ZC                            The Zig Compiler

        --zcld=ZCLD                        The Zig Linker
        --zcar=ZCAR                        The Zig Static Library Archiver
        --zcsh=ZCSH                        The Zig Shared Library Linker

        --dc=DC                            The Dlang Compiler

        --dcld=DCLD                        The Dlang Linker
        --dcar=DCAR                        The Dlang Static Library Archiver
        --dcsh=DCSH                        The Dlang Shared Library Linker

        --as=AS                            The Assembler

        --asflags=ASFLAGS                  The Assembler Flags

        --cu=CU                            The Cuda Compiler
        --cu-ccbin=CU-CCBIN                The Cuda Host C++ Compiler
        --culd=CULD                        The Cuda Linker

        --cuflags=CUFLAGS                  The Cuda Compiler Flags
        --culdflags=CULDFLAGS              The Cuda Linker Flags

        --mrc=MRC                          The Microsoft Resource Compiler

        --mrcflags=MRCFLAGS                The Microsoft Resource Flags

        --ndk=NDK                          The NDK Directory
        --ndk_sdkver=NDK_SDKVER            The SDK Version for NDK (default: auto)
        --android_sdk=ANDROID_SDK          The Android SDK Directory
        --build_toolver=BUILD_TOOLVER      The Build Tool Version of Android SDK
        --ndk_stdcxx=[y|n]                 Use stdc++ library for NDK (default: y)
        --ndk_cxxstl=NDK_CXXSTL            The stdc++ stl library for NDK
                                               - c++_static
                                               - c++_shared
                                               - gnustl_static
                                               - gnustl_shared
                                               - stlport_shared
                                               - stlport_static

        --cuda=CUDA                        The Cuda SDK Directory (default: auto)

        --qt=QT                            The Qt SDK Directory (default: auto)
        --qt_sdkver=QT_SDKVER              The Qt SDK Version (default: auto)

        --vcpkg=VCPKG                      The Vcpkg Directory (default: auto)

        --mingw=MINGW                      The MingW SDK Directory

        --vs=VS                            The Microsoft Visual Studio (default: auto)
                                             e.g. --vs=2017
        --vs_toolset=VS_TOOLSET            The Microsoft Visual Studio Toolset Version
                                             e.g. --vs_toolset=14.0
        --vs_sdkver=VS_SDKVER              The Windows SDK Version of Visual Studio
                                             e.g. --vs_sdkver=10.0.15063.0

        --wdk=WDK                          The WDK Directory (default: auto)
        --wdk_sdkver=WDK_SDKVER            The WDK Version (default: auto)
        --wdk_winver=WDK_WINVER            The WDK Windows Version (default: auto)
                                               - win10[|_rs3]
                                               - win81
                                               - win8
                                               - win7[|_sp1|_sp2|_sp3]

        --debugger=DEBUGGER                The Debugger (default: auto)
        --ccache=[y|n]                     Enable or disable the c/c++ compiler cache. (default: y)
        --trybuild=TRYBUILD                Enable try-build mode and set the third-party buildsystem tool.
                                           e.g.
                                               - xmake f --trybuild=auto; xmake
                                               - xmake f --trybuild=autotools -p android --ndk=xxx; xmake

                                           the third-party buildsystems:
                                               - auto
                                               - make
                                               - autotools
                                               - cmake
                                               - scons
                                               - meson
                                               - bazel
                                               - ninja
                                               - msbuild
                                               - xcodebuild
                                               - ndkbuild
        --tryconfigs=TRYCONFIGS            Set the extra configurations of the third-party buildsystem for the try-     
                                           build mode.
                                           e.g.
                                               - xmake f --trybuild=autotools --tryconfigs='--enable-shared=no'
    -o BUILDIR, --buildir=BUILDIR          Set the build directory. (default: build)

          target                           Configure for the given target.
error: invalid argument: emcc

@waruqi
Copy link
Member

waruqi commented Sep 16, 2020

抱歉,笔误,应该是 xmake l lib.detect.find_tool emcc

@Gaubee
Copy link

Gaubee commented Sep 16, 2020

抱歉,笔误,应该是 xmake l lib.detect.find_tool emcc

这个没有任何输出呀:
image

@waruqi
Copy link
Member

waruqi commented Sep 16, 2020

执行下 emcc --version 给我看看呢

@Gaubee
Copy link

Gaubee commented Sep 16, 2020

执行下 emcc --version 给我看看呢

image

@waruqi
Copy link
Member

waruqi commented Sep 16, 2020

你更新脚本到 dev 应该可以,xmake update -s dev

emcc 在windows上通过 emcc.bat 去 wrap的,工具链配置时候 没兼容到,现在可以了

@waruqi waruqi added this to the v2.3.8 milestone Sep 16, 2020
@Gaubee
Copy link

Gaubee commented Sep 16, 2020

xmake update -s dev

我跑完后现在xmake的任何操作都是没反应了……
image

@waruqi
Copy link
Member

waruqi commented Sep 16, 2020

不要到xmake.lua工程目录下执行,有缓存,不行就下载安装包重装下:https://github.com/xmake-io/xmake/actions/runs/256804787

@Gaubee
Copy link

Gaubee commented Sep 16, 2020

不要到xmake.lua工程目录下执行,有缓存,不行就下载安装包重装下:https://github.com/xmake-io/xmake/actions/runs/256804787

我是刻意清楚缓存后去运行的,整个目录干干净净。
image

我重新安装一下试试

@waruqi
Copy link
Member

waruqi commented Sep 16, 2020

我觉得还是你这没更新到dev版本导致,我这里重新拉取dev脚本都是可以的。

Snip20200916_155

@waruqi
Copy link
Member

waruqi commented Sep 16, 2020

你可以到你的安装目录下看下这个 https://github.com/xmake-io/xmake/blob/dev/xmake/toolchains/emcc/xmake.lua 文件内容,对比下,是否一样,来确认是否更新了

@waruqi
Copy link
Member

waruqi commented Sep 16, 2020

还是不行么 确认更新到dev了么

@Gaubee
Copy link

Gaubee commented Sep 17, 2020

还是不行么 确认更新到dev了么

image

我清空文件夹中的.xmake和build之后,又跑了一下,可以找到emcc。但没输出.wasm文件。请问需要怎么配置呢?文档中没有看到相关的……

@waruqi
Copy link
Member

waruqi commented Sep 17, 2020

上图没看到你有执行 编译命令,仅仅只是配置

执行下面的命令,给我看下输出:

xmake f --toolchain=emcc -c -vD
xmake -r -vD

@Gaubee
Copy link

Gaubee commented Sep 17, 2020

上图没看到你有执行 编译命令,仅仅只是配置

执行下面的命令,给我看下输出:

xmake f --toolchain=emcc -c -vD
xmake -r -vD

image

可以正确输出了,不过输出的文件是.exe后缀,但内容确实是.wasm。还不熟悉怎么配置,希望尽快完善文档~

@waruqi
Copy link
Member

waruqi commented Sep 17, 2020

只是后缀不同而已,自己通过 set_filename("") 设置下就行了,文档里自己找下,有这个接口说明

target("test")
    set_kind("binary")
    set_filename("test.wasm")

@waruqi
Copy link
Member

waruqi commented Sep 18, 2020

其他没啥问题,我就先close了,文件名自己改改就好。

@waruqi waruqi closed this as completed Sep 18, 2020
@waruqi
Copy link
Member

waruqi commented Sep 19, 2020

我在dev上新增了个 wasm 的平台(内置emcc工具链支持),默认生成的目标文件就是 .wasm 可以试试

xmake f -p wasm
xmake

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants