Skip to content

Autotools project fails to compile with -save-temps #133

@orestisfl

Description

@orestisfl

Hello, I am trying to compile libsodium which has a shell script to build with WebAssembly support, using wasi-sdk.

The script executes correctly by default but when I try to add -save-temps to the CFLAGS, compilation stops after a bit with the following error:

  CC       crypto_onetimeauth/poly1305/libsodium_la-onetimeauth_poly1305.lo
  CC       crypto_onetimeauth/poly1305/donna/libsodium_la-poly1305_donna.lo
  CC       crypto_pwhash/argon2/libsodium_la-argon2-core.lo
  CC       crypto_pwhash/argon2/libsodium_la-argon2-encoding.lo
  CC       crypto_pwhash/argon2/libsodium_la-argon2-fill-block-ref.lo
  CC       crypto_pwhash/argon2/libsodium_la-argon2.lo
  CC       crypto_pwhash/argon2/libsodium_la-blake2b-long.lo
onetimeauth_poly1305.s:15:20: error: Unexpected token in operand: (
        i32.call_indirect       (i32, i32, i64, i32) -> (i32)
                                ^
onetimeauth_poly1305.s:33:20: error: Unexpected token in operand: (
        i32.call_indirect       (i32, i32, i64, i32) -> (i32)
                                ^
onetimeauth_poly1305.s:49:20: error: Unexpected token in operand: (
        i32.call_indirect       (i32, i32) -> (i32)
                                ^
onetimeauth_poly1305.s:66:20: error: Unexpected token in operand: (
        i32.call_indirect       (i32, i32, i64) -> (i32)
                                ^
onetimeauth_poly1305.s:82:20: error: Unexpected token in operand: (
        i32.call_indirect       (i32, i32) -> (i32)

I have confirmed that if I remove wasi-sdk and compile without a wasm target & modified sysroot, compilation works with -save-temps and I can see the temporary files as a result.

To illustrate, I have created 2 docker files for easy reproduction: https://gist.github.com/orestisfl/5b5b333d5da7001dc799abea719ad9cf
One patches out wasi-sdk from the script and adds -save-temps and one that just adds the -save-temps flag to $CFLAGS.

$ curl https://gist.githubusercontent.com/orestisfl/5b5b333d5da7001dc799abea719ad9cf/raw/bec7b18fb231bd768b42bcef82851e103b7333b5/remove-wasi.Dockerfile | docker build -t tmp - && docker run tmp
… succeeds
$ curl https://gist.githubusercontent.com/orestisfl/5b5b333d5da7001dc799abea719ad9cf/raw/363817ee21247e68890030f4fecf1dd2480e9957/wasm32-wasi.Dockerfile | docker build -t tmp - && docker run tmp
…
  CC       crypto_onetimeauth/libsodium_la-crypto_onetimeauth.lo
  CC       crypto_onetimeauth/poly1305/libsodium_la-onetimeauth_poly1305.lo
  CC       crypto_onetimeauth/poly1305/donna/libsodium_la-poly1305_donna.lo
  CC       crypto_pwhash/argon2/libsodium_la-argon2-core.lo
  CC       crypto_pwhash/argon2/libsodium_la-argon2-encoding.lo
  CC       crypto_pwhash/argon2/libsodium_la-argon2-fill-block-ref.lo
  CC       crypto_pwhash/argon2/libsodium_la-argon2.lo
  CC       crypto_pwhash/argon2/libsodium_la-blake2b-long.lo
onetimeauth_poly1305.s:15:20: error: Unexpected token in operand: (
        i32.call_indirect       (i32, i32, i64, i32) -> (i32)
                                ^
onetimeauth_poly1305.s:33:20: error: Unexpected token in operand: (
        i32.call_indirect       (i32, i32, i64, i32) -> (i32)
                                ^
onetimeauth_poly1305.s:49:20: error: Unexpected token in operand: (
        i32.call_indirect       (i32, i32) -> (i32)
                                ^
onetimeauth_poly1305.s:66:20: error: Unexpected token in operand: (
        i32.call_indirect       (i32, i32, i64) -> (i32)
                                ^
onetimeauth_poly1305.s:82:20: error: Unexpected token in operand: (
        i32.call_indirect       (i32, i32) -> (i32)
                                ^
Makefile:2512: recipe for target 'crypto_onetimeauth/poly1305/libsodium_la-onetimeauth_poly1305.lo' failed
make[3]: *** [crypto_onetimeauth/poly1305/libsodium_la-onetimeauth_poly1305.lo] Error 1
make[3]: *** Waiting for unfinished jobs....
make[3]: Leaving directory '/libsodium/src/libsodium'
make[2]: *** [check-recursive] Error 1
Makefile:3106: recipe for target 'check-recursive' failed
make[2]: Leaving directory '/libsodium/src/libsodium'
Makefile:400: recipe for target 'check-recursive' failed
make[1]: Leaving directory '/libsodium/src'
make[1]: *** [check-recursive] Error 1
Makefile:515: recipe for target 'check-recursive' failed
make: *** [check-recursive] Error 1

Any workaround suggestions are extremely welcome.

Thank you

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions