emscripten-core / emscripten-core/emscripten

Using <wordexp.h> leads to "error: undefined symbol" / POSIX support?

Open
#10,403 17 comments 0 reactions 0 assignees View on GitHub
Dominant language
C++
Stars
27.6k
Forks
3.6k
Avg merge
1d 1h
Merged PRs (30d)
105

Description

I am a beginner to emcc and not sure, if emscripten is supposed to support `` at all (or in general any of the POSIX library's headers), so feel free to kill/close this issue if this is out of scope. (In this case I'll need to change the source I am porting right now to get rid of POSIX.)

Let's use the sample code from http://man7.org/linux/man-pages/man3/wordexp.3.html as an example:

```
#include
#include
#include

int main(int argc, char **argv)
{
wordexp_t p;
char **w;
int i;

wordexp("[a-c]*.c", &p, 0);
w = p.we_wordv;
for (i = 0; i < p.we_wordc; i++)
printf("%s\n", w[i]);
wordfree(&p);
exit(EXIT_SUCCESS);
}
```

Compiling this with any standard compiler works fine.

Using emcc this yields:

```
error: undefined symbol: wordexp
warning: To disable errors for undefined symbols use `-s ERROR_ON_UNDEFINED_SYMBOLS=0`
error: undefined symbol: wordfree
Error: Aborting compilation due to previous errors
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.