External Publication
Visit Post

[wasm] `warning: return type of 'main' is not 'int' ' [-Wmain-return-type]`

Haskell Community [Unofficial] April 14, 2026
Source

I forked @Tritlo 's wasm-game for the upcoming Ludum Dare 59. I reworked the dev env to be Nix flake-based. It all builds and runs fine..but I get a warning at the C compiler level:

/var/folders/17/b_0jqlgs3gx_l0nph13_cbz40000gn/T/nix-shell.u5ayBH/ghc40510_tmp_6_0/ghc_tmp_418_0.c:11:1: error:
     warning: return type of 'main' is not 'int' [-Wmain-return-type]
       11 | HsJSVal main(void)
          | ^
   |
11 | HsJSVal main(void)
   | ^

/var/folders/17/b_0jqlgs3gx_l0nph13_cbz40000gn/T/nix-shell.u5ayBH/ghc40510_tmp_6_0/ghc_tmp_418_0.c:11:1: error:
     note: change return type to 'int'
       11 | HsJSVal main(void)
          | ^~~~~~~
          | int
   |
11 | HsJSVal main(void)
   | ^

1 warning generated.

The resulting code works..so I don’t think it’s a problem.

I tried telling cabal to ignore it with cc-options: -Wno-main-return-type in various ways, but it still happens. Maybe that isn’t getting propagated correctly? (I saw some GH issues about that)

But it feels like a GHC bug..maybe it is and I should cut GHC gitlab a ticket? But I figured I’d ask the crowd first

Discussion in the ATmosphere

Loading comments...