-
Notifications
You must be signed in to change notification settings - Fork 561
Build Tricks
Mosè Giordano edited this page Jan 2, 2020
·
16 revisions
This page collects some known build errors and trick how to fix them
If compilation fails because of the following errors
undefined reference to `backtrace_symbols'
undefined reference to `backtrace'
then you need to link to execinfo
:
if [[ "${target}" == *-freebsd* ]]; then
export LDFLAGS="-lexecinfo"
fi
./configure --prefix=${prefix} --build=${MACHTYPE} --host=${target}
make -j ${nprocs}
make install
When building for Windows, sometimes libtool refuses to build the shared library. For example you can get
libtool: warning: undefined symbols not allowed in i686-w64-mingw32 shared libraries; building static only
or
libtool: error: can't build i686-w64-mingw32 shared library unless -no-undefined is specified
In these cases you have to pass the -no-undefined
option to the linker, as explicitly suggested by the second message.
Doing this properly is a bit tricky: I couldn't make CFLAGS=-Wl,-no-undefined
work, instead setting LDFLAGS=-no-undefined
before ./configure
make this fail (because it will run a command like cc -no-undefined conftest.c
). What I use to do is to pass LDFLAGS=-no-undefined
only to make
:
FLAGS=()
if [[ "${target}" == *-mingw* ]]; then
FLAGS+=(LDFLAGS="-no-undefined")
fi
./configure --prefix=${prefix} --build=${MACHTYPE} --host=${target}
make -j ${nprocs} "${FLAGS[@]}"
make install