emscripten-core/emscripten

Documentation for porting Unix-style build process (configure/make)

Open

#6,509 创建于 2018年5月7日

在 GitHub 查看
 (7 评论) (8 反应) (0 负责人)C++ (3,519 fork)batch import
good first bughelp wantedwontfix

仓库指标

Star
 (27,361 star)
PR 合并指标
 (平均合并 19天 10小时) (30 天内合并 147 个 PR)

描述

Documentation on doing builds of existing libraries with Unix-style configure/make build processes is a bit scarce, and there are some tricks. Would be nice to add a documentation page summarizing porting concerns.

A few things off the top of my head:

  • passing CFLAGS, PKG_CONFIG_PATH, and other env variables usually should be done as parameters to configure: emconfigure configure --blah CFLAGS="-s WASM=1" etc
  • recommended build steps for multiple libraries / dependencies
    • using out-of-tree build directories for your sanity
    • use --prefix to install multiple libraries into one pseudo system root
    • set include, library paths and PKG_CONFIG_PATH var to point into that root, allowing libraries to find each other
  • use emconfigure along with EMCONFIGURE_JS=2 to make sure configure script code is built for the JS target and not for native!
    • (I'm not sure why the default is to build anything as native, it produces incorrect results for all kinds of detections.)
    • running test compilations through emconfigure instead of emmake? For libffi's test suite, this gets them built as node scripts. Not sure this is really ideal though.
  • issues with dynamic linking vs static linking?
    • I've sometimes had trouble with -lfoo when the default static library generation created libfoo.a.
    • Shared libraries can produce .so or .dylib files based on the build system, which are actually LLVM bitcode (same as .bc)
    • Not sure how to force the autoconf stack to produce a .bc extension for a static library...?
  • recent versions of autoconf support asmjs-unknown-unknown and wasm32-unknown-unknown host triples, so you can pass --host=asmjs or --host=wasm32 on the configure line to flip things into a mode where they know they're cross-compiling! This can help programs know what they're targeting, for instance my in-progress port of libffi needs this or it'll try to build x86_64 assembly stuff.
  • best way to obtain proper dependencies? installing autoconf/automake/pkg-config/libtool/etc on Linux, on Mac, and on Windows?
  • how to get anything working on Windows??
    • note you can't just exec() a configure script, you need to run it through a shell, and other mysteries

贡献者指南