Skip to content

Issues on compling libsquashfs for emscripten #135

@martenrichter

Description

@martenrichter

Thank you for the library!

I am currently trying to compile it for Emscripten. I encountered some minor compilation issues, which I was able to work around.
However, I thought it would be helpful to report them upstream, as it may also hurt other platforms.

1.) Issues with

# if SIZE_MAX <= UINT_MAX

This line is successfully selected, however, the compiler complains with (one example):

/workspaces/emscripten/cache/ports/libsquashfs/squashfs-tools-ng-1.3.2/lib/util/rbtree.c:194:40: warning: incompatible pointer types passing 'size_t *' (aka 'unsigned long *') to parameter of type 'unsigned int *' [-Wincompatible-pointer-types]
  194 |         if (SZ_ADD_OV(size, tree->value_size, &size))

It is a compiler error, which I downgraded with -Wno-error=incompatible-pointer-types, as I believe the overall behavior should be correct.

Another issue is at

/workspaces/emscripten/cache/ports/libsquashfs/squashfs-tools-ng-1.3.2/tests/libutil/xxhash.c:57:54: warning: format specifies type 'unsigned int' but the argument has type 'size_t' (aka 'unsigned long') [-Wformat]
   57 |                         fprintf(stderr, "Test case " PRI_SZ " failed!\n", I);

which I have downgraded with -Wno-error=format to a warning.
It may be that you have already taken care of the issues in your automake setup, and the emscripten build system may have skipped it. (E.g. the _GNU_SOURCE macro is an example that it missed.)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions