[GHC] #15945: Unable to compile GHC from source: redefinition of '_DYNAMIC' as different kind of symbol (was: Unable to compile GHC from source on OpenBSD (-CURRENT))
GHC
ghc-devs at haskell.org
Sun Nov 25 16:15:32 UTC 2018
#15945: Unable to compile GHC from source: redefinition of '_DYNAMIC' as different
kind of symbol
-------------------------------------+-------------------------------------
Reporter: klomeli | Owner: (none)
Type: bug | Status: new
Priority: normal | Milestone: 8.6.3
Component: Build System | Version: 8.6.2
(make) |
Resolution: | Keywords: clang
Operating System: OpenBSD | Architecture: x86_64
Type of failure: Building GHC | (amd64)
failed | Test Case:
Blocked By: | Blocking:
Related Tickets: | Differential Rev(s):
Wiki Page: |
-------------------------------------+-------------------------------------
Old description:
> I am running the following script to build GHC from sources
> (ghc-8.6.2-src.tar.xz) on OpenBSD (-CURRENT):
>
> {{{
> #! /bin/sh
> set -e
>
> BUILD_DIR=/usr/local/tmp-build-ghc
>
> export AUTOCONF_VERSION=2.69
> export AUTOMAKE_VERSION=1.16
>
> if [ ! -n "$1" ]; then
> echo "ERROR: Provide path for ghc source."
> exit 1
> fi
>
> echo "Extracting ghc source files from ${1} to ${BUILD_DIR} ..."
> mkdir -p $BUILD_DIR
>
> cd $BUILD_DIR
> xzcat $1 | tar xvf -
>
> GHC_DIR=`ls | grep ghc`
> cd $GHC_DIR
>
> echo "Cleaning up OpenBSD-incompatible commands..."
> find . -type f | xargs sed -i -e 's|^ln -f -v |ln -f |'
>
> echo "Building GHC... "
> export CC=/usr/bin/clang
>
> ./boot
> ./configure --with-iconv-libraries=/usr/local/lib \
> --with-iconv-includes=/usr/local/include \
> --with-gmp-libraries=/usr/local/lib \
> --with-gmp-includes=/usr/local/include \
> --with-ffi-libraries=/usr/local/lib \
> --with-ffi-includes=/usr/local/include \
> --with-system-libffi
> gmake
> }}}
>
> I will file a separate bug report for the **ln** incompatibility with the
> unsupported **-v** flag.
>
> When compiling GHC, I get the following error:
>
> {{{
>
> ...
>
> "inplace/bin/ghc-stage1" -optc-fno-stack-protector -optc-Wall -optc-Wall
> -optc-Wextra -optc-Wstrict-prototypes -optc-Wmissing-prototypes -optc-
> Wmissing-declarations -optc-Winline -optc-Waggregate-return -optc-
> Wpointer-arith -optc-Wmissing-noreturn -optc-Wnested-externs -optc-
> Wredundant-decls -optc-Wundef -optc-Iincludes -optc-Iincludes/dist -optc-
> Iincludes/dist-derivedconstants/header -optc-Iincludes/dist-
> ghcconstants/header -optc-Irts -optc-Irts/dist/build -optc-DCOMPILING_RTS
> -optc-DFS_NAMESPACE=rts -optc-fno-strict-aliasing -optc-fno-common -optc-
> Irts/dist/build/./autogen -optc-Wno-unknown-pragmas -optc-O2 -optc-fomit-
> frame-pointer -optc-g -optc-DRtsWay=\"rts_v\" -optc-ffunction-sections
> -optc-fdata-sections -static -H32m -O -Wall -Iincludes -Iincludes/dist
> -Iincludes/dist-derivedconstants/header -Iincludes/dist-
> ghcconstants/header -Irts -Irts/dist/build -DCOMPILING_RTS
> -DFS_NAMESPACE=rts -this-unit-id rts -dcmm-lint -i -irts
> -irts/dist/build -Irts/dist/build -irts/dist/build/./autogen
> -Irts/dist/build/./autogen -O2 -Wcpp-undef -Wnoncanonical-
> monad-instances -c rts/RtsSymbols.c -o rts/dist/build/RtsSymbols.o
>
> rts/RtsSymbols.c:990:1: error:
> error: redefinition of '_DYNAMIC' as different kind of symbol
> |
> 990 | RTS_OPENBSD_ONLY_SYMBOLS
> | ^
> RTS_OPENBSD_ONLY_SYMBOLS
> ^
>
> rts/RtsSymbols.c:283:22: error:
> note: expanded from macro 'RTS_OPENBSD_ONLY_SYMBOLS'
> SymE_NeedsProto(_DYNAMIC)
> ^
> |
> 283 | SymE_NeedsProto(_DYNAMIC)
> | ^
>
> /usr/include/sys/exec_elf.h:765:17: error:
> note: previous definition is here
> |
> 765 | extern Elf_Dyn _DYNAMIC[];
> | ^
> extern Elf_Dyn _DYNAMIC[];
> ^
> 1 error generated.
> `clang' failed in phase `C Compiler'. (Exit code: 1)
> gmake[1]: *** [rts/ghc.mk:315: rts/dist/build/RtsSymbols.o] Error 1
> gmake: *** [Makefile:127: all] Error 2
> }}}
>
> Any suggestions appreciated. Thanks!
New description:
I am running the following script to build GHC from sources
(ghc-8.6.2-src.tar.xz) on OpenBSD (-CURRENT):
{{{
#! /bin/sh
set -e
BUILD_DIR=/usr/local/tmp-build-ghc
export AUTOCONF_VERSION=2.69
export AUTOMAKE_VERSION=1.16
if [ ! -n "$1" ]; then
echo "ERROR: Provide path for ghc source."
exit 1
fi
echo "Extracting ghc source files from ${1} to ${BUILD_DIR} ..."
mkdir -p $BUILD_DIR
cd $BUILD_DIR
xzcat $1 | tar xvf -
GHC_DIR=`ls | grep ghc`
cd $GHC_DIR
echo "Cleaning up OpenBSD-incompatible commands..."
find . -type f | xargs sed -i -e 's|^ln -f -v |ln -f |'
echo "Building GHC... "
export CC=/usr/bin/clang
./boot
./configure --with-iconv-libraries=/usr/local/lib \
--with-iconv-includes=/usr/local/include \
--with-gmp-libraries=/usr/local/lib \
--with-gmp-includes=/usr/local/include \
--with-ffi-libraries=/usr/local/lib \
--with-ffi-includes=/usr/local/include \
--with-system-libffi
gmake
}}}
I have filed a separate bug report for the **ln** incompatibility with the
unsupported **-v** flag.
When compiling GHC, I get the following error:
{{{
...
"inplace/bin/ghc-stage1" -optc-fno-stack-protector -optc-Wall -optc-Wall
-optc-Wextra -optc-Wstrict-prototypes -optc-Wmissing-prototypes -optc-
Wmissing-declarations -optc-Winline -optc-Waggregate-return -optc-
Wpointer-arith -optc-Wmissing-noreturn -optc-Wnested-externs -optc-
Wredundant-decls -optc-Wundef -optc-Iincludes -optc-Iincludes/dist -optc-
Iincludes/dist-derivedconstants/header -optc-Iincludes/dist-
ghcconstants/header -optc-Irts -optc-Irts/dist/build -optc-DCOMPILING_RTS
-optc-DFS_NAMESPACE=rts -optc-fno-strict-aliasing -optc-fno-common -optc-
Irts/dist/build/./autogen -optc-Wno-unknown-pragmas -optc-O2 -optc-fomit-
frame-pointer -optc-g -optc-DRtsWay=\"rts_v\" -optc-ffunction-sections
-optc-fdata-sections -static -H32m -O -Wall -Iincludes -Iincludes/dist
-Iincludes/dist-derivedconstants/header -Iincludes/dist-
ghcconstants/header -Irts -Irts/dist/build -DCOMPILING_RTS
-DFS_NAMESPACE=rts -this-unit-id rts -dcmm-lint -i -irts
-irts/dist/build -Irts/dist/build -irts/dist/build/./autogen
-Irts/dist/build/./autogen -O2 -Wcpp-undef -Wnoncanonical-
monad-instances -c rts/RtsSymbols.c -o rts/dist/build/RtsSymbols.o
rts/RtsSymbols.c:990:1: error:
error: redefinition of '_DYNAMIC' as different kind of symbol
|
990 | RTS_OPENBSD_ONLY_SYMBOLS
| ^
RTS_OPENBSD_ONLY_SYMBOLS
^
rts/RtsSymbols.c:283:22: error:
note: expanded from macro 'RTS_OPENBSD_ONLY_SYMBOLS'
SymE_NeedsProto(_DYNAMIC)
^
|
283 | SymE_NeedsProto(_DYNAMIC)
| ^
/usr/include/sys/exec_elf.h:765:17: error:
note: previous definition is here
|
765 | extern Elf_Dyn _DYNAMIC[];
| ^
extern Elf_Dyn _DYNAMIC[];
^
1 error generated.
`clang' failed in phase `C Compiler'. (Exit code: 1)
gmake[1]: *** [rts/ghc.mk:315: rts/dist/build/RtsSymbols.o] Error 1
gmake: *** [Makefile:127: all] Error 2
}}}
Any suggestions appreciated. Thanks!
--
Comment (by klomeli):
Updated title to reflect build issue.
--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/15945#comment:1>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the ghc-tickets
mailing list