Skip to content

Commit e5e8fe8

Browse files
authored
[docs] Add tip about posix_memalign not working on Musl (#1236)
1 parent 8708a63 commit e5e8fe8

File tree

1 file changed

+22
-3
lines changed

1 file changed

+22
-3
lines changed

docs/src/troubleshooting.md

Lines changed: 22 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,26 @@ The build environment provided by `BinaryBuilder` is a `x86_64-linux-musl`, and
103103
./foreign.exe: line 1: syntax error: unexpected end of file (expecting ")")
104104
```
105105

106-
This is one of worst cases when cross-compiling, and there isn't a simple solution. You have to look into the build process to see if running the executable can be skipped (see for example the patch to not run `dot` in [#351](https://github.com/JuliaPackaging/Yggdrasil/pull/351)), or replaced by something else. If the executable is a compile-time only utility, try to build it with the native compiler (see for example the patch to build a native `mkdefs` in [#351](https://github.com/JuliaPackaging/Yggdrasil/pull/351))
106+
This is one of worst cases when cross-compiling, and there isn't a simple solution. You have to look into the build process to see if running the executable can be skipped (see for example the patch to not run `dot` in [Yggdrasil#351](https://github.com/JuliaPackaging/Yggdrasil/pull/351)), or replaced by something else. If the executable is a compile-time only utility, try to build it with the native compiler (see for example the patch to build a native `mkdefs` in [Yggdrasil#351](https://github.com/JuliaPackaging/Yggdrasil/pull/351))
107+
108+
## Musl Linux
109+
110+
Compiling for Musl platforms can sometimes fail with the error message
111+
112+
```
113+
/opt/x86_64-linux-musl/x86_64-linux-musl/sys-root/usr/include/stdlib.h:99:5: error: from previous declaration ‘int posix_memalign(void**, size_t, size_t)’
114+
int posix_memalign (void **, size_t, size_t);
115+
^
116+
```
117+
118+
This is due to a bug in older versions of GCC targeting this libc, see [BinaryBuilder.jl#387](https://github.com/JuliaPackaging/BinaryBuilder.jl/issues/387) for more details.
119+
There are two options to solve this issue:
120+
121+
* require GCC 6 by using `build_tarballs(...; preferred_gcc_version=v"6")`.
122+
This may be the simplest option in some cases.
123+
See for example [Yggdrasil#3974](https://github.com/JuliaPackaging/Yggdrasil/pull/3974)
124+
* if using older versions of GCC is important for wider compatibility, you can apply [this patch](https://github.com/JuliaPackaging/Yggdrasil/blob/48ac662cd53e02aff0189c81008874a04f7172c7/Z/ZeroMQ/bundled/patches/mm_malloc.patch) to the build toolchain.
125+
See for example [ZeroMQ](https://github.com/JuliaPackaging/Yggdrasil/blob/48ac662cd53e02aff0189c81008874a04f7172c7/Z/ZeroMQ/build_tarballs.jl#L20-L26) recipe.
107126

108127
## PowerPC Linux
109128

@@ -142,7 +161,7 @@ make -j${nprocs}
142161
make install
143162
```
144163

145-
See for example [#354](https://github.com/JuliaPackaging/Yggdrasil/pull/354) and [#982](https://github.com/JuliaPackaging/Yggdrasil/pull/982).
164+
See for example [Yggdrasil#354](https://github.com/JuliaPackaging/Yggdrasil/pull/354) and [Yggdrasil#982](https://github.com/JuliaPackaging/Yggdrasil/pull/982).
146165

147166
### ```undefined reference to `environ'```
148167

@@ -182,7 +201,7 @@ make -j${nprocs} "${FLAGS[@]}"
182201
make install
183202
```
184203

185-
Note that setting `LDFLAGS=-no-undefined` before `./configure` would make this fail because it would run a command like `cc -no-undefined conftest.c`, which upsets the compiler). See for example [#170](https://github.com/JuliaPackaging/Yggdrasil/pull/170), [#354](https://github.com/JuliaPackaging/Yggdrasil/pull/354).
204+
Note that setting `LDFLAGS=-no-undefined` before `./configure` would make this fail because it would run a command like `cc -no-undefined conftest.c`, which upsets the compiler). See for example [Yggdrasil#170](https://github.com/JuliaPackaging/Yggdrasil/pull/170), [Yggdrasil#354](https://github.com/JuliaPackaging/Yggdrasil/pull/354).
186205

187206
### Libtool refuses to build shared library because '-lmingw32' is not a real file
188207

0 commit comments

Comments
 (0)