Closed izgzhen closed 6 years ago
first error I met...
Error when running Shake build system:
* _build/stage1/bin/arm-linux-gnueabihf-unlit
* _build/stage0/bin/arm-linux-gnueabihf-unlit
* OracleQ (PackageDataFile (Context {stage = Stage0, package = Package {pkgLanguage = Haskell, pkgType = Program, pkgName = "unlit", pkgPath = "utils/unlit"}, way = v}))
* _build/stage0/utils/unlit/setup-config
EDIT: resolve. dup of #579
I believe that build.sh
's -c
can't be passed a --target=arm-linux-gnueabihf
?
user error (Development.Shake.cmd, system command failed
Command: /usr/local/bin/ghc -Wall -hisuf hi -osuf o -hcsuf hc -static -hide-all-packages -no-user-package-db '-package-db _build/stage0/lib/package.conf.d' '-this-unit-id ghc-8.5' '-package-id array-0.5.2.0' '-package-id base-4.10.1.0' '-package-id binary-0.8.5.1' '-package-id bytestring-0.10.8.2' '-package-id containers-0.5.10.2' '-package-id deepseq-1.4.3.0' '-package-id directory-1.3.0.2' '-package-id filepath-1.4.1.2' '-package-id ghc-boot-8.5' '-package-id ghc-boot-th-8.5' '-package-id ghci-8.5' '-package-id hpc-0.6.0.3' '-package-id process-1.6.1.0' '-package-id template-haskell-2.14.0.0' '-package-id time-1.8.0.2' '-package-id transformers-0.5.5.0' '-package-id unix-2.7.2.2' -i -i_build/stage0/compiler/build -i_build/stage0/compiler/build/autogen -icompiler/backpack -icompiler/basicTypes -icompiler/cmm -icompiler/codeGen -icompiler/coreSyn -icompiler/deSugar -icompiler/ghci -icompiler/hsSyn -icompiler/iface -icompiler/llvmGen -icompiler/main -icompiler/nativeGen -icompiler/parser -icompiler/prelude -icompiler/profiling -icompiler/rename -icompiler/simplCore -icompiler/simplStg -icompiler/specialise -icompiler/stgSyn -icompiler/stranal -icompiler/typecheck -icompiler/types -icompiler/utils -icompiler/vectorise -I_build/generated -I_build/stage0/compiler/build -I_build/stage0/compiler/build/. -I_build/stage0/compiler/build/parser -I_build/stage0/compiler/build/utils -Icompiler/. -Icompiler/parser -Icompiler/utils -I/usr/local/haskell/ghc-8.2.2-x86_64/lib/ghc-8.2.2/process-1.6.1.0/include -I/usr/local/haskell/ghc-8.2.2-x86_64/lib/ghc-8.2.2/directory-1.3.0.2/include -I/usr/local/haskell/ghc-8.2.2-x86_64/lib/ghc-8.2.2/unix-2.7.2.2/include -I/usr/local/haskell/ghc-8.2.2-x86_64/lib/ghc-8.2.2/time-1.8.0.2/include -I/usr/local/haskell/ghc-8.2.2-x86_64/lib/ghc-8.2.2/bytestring-0.10.8.2/include -I/usr/local/haskell/ghc-8.2.2-x86_64/lib/ghc-8.2.2/base-4.10.1.0/include -I/usr/local/haskell/ghc-8.2.2-x86_64/lib/ghc-8.2.2/integer-gmp-1.0.1.0/include -I/usr/local/haskell/ghc-8.2.2-x86_64/lib/ghc-8.2.2/include -I_build/generated -optc-I_build/generated -optP-include -optP_build/stage0/compiler/build/autogen/cabal_macros.h -optc-fno-stack-protector -odir _build/stage0/compiler/build -hidir _build/stage0/compiler/build -stubdir _build/stage0/compiler/build -optc-Werror=unused-but-set-variable -optc-Wno-error=inline -c compiler/ghci/ByteCodeAsm.hs -o _build/stage0/compiler/build/ByteCodeAsm.o -O0 -H64m -Wall -Wno-name-shadowing -Wnoncanonical-monad-instances -Wnoncanonical-monadfail-instances -Wnoncanonical-monoid-instances -this-unit-id ghc -XHaskell2010 -XNoImplicitPrelude -DSTAGE=1 -O -fno-warn-deprecated-flags
Exit code: 1
Stderr:
compiler/ghci/ByteCodeAsm.hs:354:36: error:
Variable not in scope: bci_PUSH8 :: Word16
|
354 | PUSH8 o1 -> emit bci_PUSH8 [SmallOp o1]
| ^^^^^^^^^
compiler/ghci/ByteCodeAsm.hs:355:36: error:
Variable not in scope: bci_PUSH16 :: Word16
|
355 | PUSH16 o1 -> emit bci_PUSH16 [SmallOp o1]
| ^^^^^^^^^^
compiler/ghci/ByteCodeAsm.hs:356:36: error:
Variable not in scope: bci_PUSH32 :: Word16
|
356 | PUSH32 o1 -> emit bci_PUSH32 [SmallOp o1]
| ^^^^^^^^^^
compiler/ghci/ByteCodeAsm.hs:357:36: error:
Variable not in scope: bci_PUSH8_W :: Word16
|
357 | PUSH8_W o1 -> emit bci_PUSH8_W [SmallOp o1]
| ^^^^^^^^^^^
compiler/ghci/ByteCodeAsm.hs:358:36: error:
Variable not in scope: bci_PUSH16_W :: Word16
|
358 | PUSH16_W o1 -> emit bci_PUSH16_W [SmallOp o1]
| ^^^^^^^^^^^^
compiler/ghci/ByteCodeAsm.hs:359:36: error:
Variable not in scope: bci_PUSH32_W :: Word16
|
359 | PUSH32_W o1 -> emit bci_PUSH32_W [SmallOp o1]
| ^^^^^^^^^^^^
compiler/ghci/ByteCodeAsm.hs:374:36: error:
Variable not in scope: bci_PUSH_PAD8 :: Word16
|
374 | PUSH_PAD8 -> emit bci_PUSH_PAD8 []
| ^^^^^^^^^^^^^
compiler/ghci/ByteCodeAsm.hs:375:36: error:
• Variable not in scope: bci_PUSH_PAD16 :: Word16
• Perhaps you meant data constructor ‘PUSH_PAD16’ (imported from ByteCodeInstr)
|
375 | PUSH_PAD16 -> emit bci_PUSH_PAD16 []
| ^^^^^^^^^^^^^^
compiler/ghci/ByteCodeAsm.hs:376:36: error:
• Variable not in scope: bci_PUSH_PAD32 :: Word16
• Perhaps you meant data constructor ‘PUSH_PAD32’ (imported from ByteCodeInstr)
|
376 | PUSH_PAD32 -> emit bci_PUSH_PAD32 []
| ^^^^^^^^^^^^^^
compiler/ghci/ByteCodeAsm.hs:378:39: error:
Variable not in scope: bci_PUSH_UBX8 :: Word16
|
378 | emit bci_PUSH_UBX8 [Op np]
| ^^^^^^^^^^^^^
compiler/ghci/ByteCodeAsm.hs:380:39: error:
• Variable not in scope: bci_PUSH_UBX16 :: Word16
• Perhaps you meant data constructor ‘PUSH_UBX16’ (imported from ByteCodeInstr)
|
380 | emit bci_PUSH_UBX16 [Op np]
| ^^^^^^^^^^^^^^
compiler/ghci/ByteCodeAsm.hs:382:39: error:
• Variable not in scope: bci_PUSH_UBX32 :: Word16
• Perhaps you meant data constructor ‘PUSH_UBX32’ (imported from ByteCodeInstr)
|
382 | emit bci_PUSH_UBX32 [Op np]
| ^^^^^^^^^^^^^^
)
missing symbols defined in includes/rts/Bytecodes.h
adding -Iincludes
to the faulty cmd will work
--- a/src/Settings/Builders/Ghc.hs
+++ b/src/Settings/Builders/Ghc.hs
@@ -128,6 +128,7 @@ includeGhcArgs = do
autogen <- expr $ autogenPath context
mconcat [ arg "-i"
, arg $ "-i" ++ path
+ , arg $ "-Iincludes"
, arg $ "-i" ++ autogen
, pure [ "-i" ++ pkgPath pkg -/- dir | dir <- srcDirs ]
, cIncludeArgs
It was compiling STAGE 2 stuff now -- I suspect that Stage1Only is not respected.
STAGE=2 -optc-DTHREADED_RTS -DGHCI_TABLES_NEXT_TO_CODE -Wno-deprecated-flags -Wcpp-undef
| Run Ghc CompileHs Stage1: compiler/iface/LoadIface.hs => _build/stage1/compiler/build/LoadIface.o
_build/stage0/bin/arm-linux-gnueabihf-ghc -Wall -hisuf hi -osuf o -hcsuf hc -static -hide-all-packages -no-user-package-db '-package-db _build/stage1/lib/package.conf.d' '-this-unit-id ghc-8.5' '-package-id array-0.5.2.0' '-package-id base-4.12.0.0' '-package-id binary-0.8.5.1' '-package-id bytestring-0.10.8.2' '-package-id containers-0.5.11.0' '-package-id deepseq-1.4.4.0' '-package-id directory-1.3.2.3' '-package-id filepath-1.4.2' '-package-id ghc-boot-8.5' '-package-id ghc-boot-th-8.5' '-package-id ghci-8.5' '-package-id hpc-0.6.0.3' '-package-id process-1.6.3.0' '-package-id template-haskell-2.14.0.0' '-package-id time-1.8.0.2' '-package-id transformers-0.5.5.0' '-package-id unix-2.8.0.0' -i -i_build/stage1/compiler/build -Iincludes -i_build/stage1/compiler/build/autogen -icompiler/backpack -icompiler/basicTypes -icompiler/cmm -icompiler/codeGen -icompiler/coreSyn -icompiler/deSugar -icompiler/ghci -icompiler/hsSyn -icompiler/iface -icompiler/llvmGen -icompiler/main -icompiler/nativeGen -icompiler/parser -icompiler/prelude -icompiler/profiling -icompiler/rename -icompiler/simplCore -icompiler/simplStg -icompiler/specialise -icompiler/stgSyn -icompiler/stranal -icompiler/typecheck -icompiler/types -icompiler/utils -icompiler/vectorise -I_build/generated -I_build/stage1/compiler/build -I_build/stage1/compiler/build/. -I_build/stage1/compiler/build/parser -I_build/stage1/compiler/build/utils -I_build/stage1/compiler/build/../rts/dist/build -Icompiler/. -Icompiler/parser -Icompiler/utils -Icompiler/../rts/dist/build -I/home/zhen/repos/ghc/_build/stage1/lib/arm-linux-ghc-8.5.20180425/process-1.6.3.0/include -I/home/zhen/repos/ghc/_build/stage1/lib/arm-linux-ghc-8.5.20180425/unix-2.8.0.0/include -I/home/zhen/repos/ghc/_build/stage1/lib/arm-linux-ghc-8.5.20180425/time-1.8.0.2/include -I/home/zhen/repos/ghc/_build/stage1/lib/arm-linux-ghc-8.5.20180425/bytestring-0.10.8.2/include -I/home/zhen/repos/ghc/_build/stage1/lib/arm-linux-ghc-8.5.20180425/base-4.12.0.0/include -I/home/zhen/repos/ghc/_build/stage1/lib/arm-linux-ghc-8.5.20180425/rts-1.0/include -I_build/generated -optc-I_build/generated -optP-include -optP_build/stage1/compiler/build/autogen/cabal_macros.h -optc-marm -optc-fno-stack-protector -optP-DGHCI -odir _build/stage1/compiler/build -hidir _build/stage1/compiler/build -stubdir _build/stage1/compiler/build -Wnoncanonical-monad-instances -optc-Werror=unused-but-set-variable -optc-Wno-error=inline -c compiler/iface/LoadIface.hs -o _build/stage1/compiler/build/LoadIface.o -O0 -H64m -Wall -Wno-name-shadowing -Wnoncanonical-monad-instances -Wnoncanonical-monadfail-instances -Wnoncanonical-monoid-instances -this-unit-id ghc -XHaskell2010 -XNoImplicitPrelude -ghcversion-file=/home/zhen/repos/ghc/_build/generated/ghcversion.h -DSTAGE=2 -optc-DTHREADED_RTS -DGHCI_TABLES_NEXT_TO_CODE -Wno-deprecated-flags -Wcpp-undef
You are using an unsupported version of LLVM!
Currently only 5.0 is supported.
We will try though...
You are using an unsupported version of LLVM!
Currently only 5.0 is supported.
We will try though...
| Run Ghc CompileHs Stage1: compiler/main/HeaderInfo.hs => _build/stage1/compiler/build/HeaderInfo.o
_build/stage0/bin/arm-linux-gnueabihf-ghc -Wall -hisuf hi -osuf o -hcsuf hc -static -hide-all-packages -no-user-package-db '-package-db _build/stage1/lib/package.conf.d' '-this-unit-id ghc-8.5' '-package-id array-0.5.2.0' '-package-id base-4.12.0.0' '-package-id binary-0.8.5.1' '-package-id bytestring-0.10.8.2' '-package-id containers-0.5.11.0' '-package-id deepseq-1.4.4.0' '-package-id directory-1.3.2.3' '-package-id filepath-1.4.2' '-package-id ghc-boot-8.5' '-package-id ghc-boot-th-8.5' '-package-id ghci-8.5' '-package-id hpc-0.6.0.3' '-package-id process-1.6.3.0' '-package-id template-haskell-2.14.0.0' '-package-id time-1.8.0.2' '-package-id transformers-0.5.5.0' '-package-id unix-2.8.0.0' -i -i_build/stage1/compiler/build -Iincludes -i_build/stage1/compiler/build/autogen -icompiler/backpack -icompiler/basicTypes -icompiler/cmm -icompiler/codeGen -icompiler/coreSyn -icompiler/deSugar -icompiler/ghci -icompiler/hsSyn -icompiler/iface -icompiler/llvmGen -icompiler/main -icompiler/nativeGen -icompiler/parser -icompiler/prelude -icompiler/profiling -icompiler/rename -icompiler/simplCore -icompiler/simplStg -icompiler/specialise -icompiler/stgSyn -icompiler/stranal -icompiler/typecheck -icompiler/types -icompiler/utils -icompiler/vectorise -I_build/generated -I_build/stage1/compiler/build -I_build/stage1/compiler/build/. -I_build/stage1/compiler/build/parser -I_build/stage1/compiler/build/utils -I_build/stage1/compiler/build/../rts/dist/build -Icompiler/. -Icompiler/parser -Icompiler/utils -Icompiler/../rts/dist/build -I/home/zhen/repos/ghc/_build/stage1/lib/arm-linux-ghc-8.5.20180425/process-1.6.3.0/include -I/home/zhen/repos/ghc/_build/stage1/lib/arm-linux-ghc-8.5.20180425/unix-2.8.0.0/include -I/home/zhen/repos/ghc/_build/stage1/lib/arm-linux-ghc-8.5.20180425/time-1.8.0.2/include -I/home/zhen/repos/ghc/_build/stage1/lib/arm-linux-ghc-8.5.20180425/bytestring-0.10.8.2/include -I/home/zhen/repos/ghc/_build/stage1/lib/arm-linux-ghc-8.5.20180425/base-4.12.0.0/include -I/home/zhen/repos/ghc/_build/stage1/lib/arm-linux-ghc-8.5.20180425/rts-1.0/include -I_build/generated -optc-I_build/generated -optP-include -optP_build/stage1/compiler/build/autogen/cabal_macros.h -optc-marm -optc-fno-stack-protector -optP-DGHCI -odir _build/stage1/compiler/build -hidir _build/stage1/compiler/build -stubdir _build/stage1/compiler/build -Wnoncanonical-monad-instances -optc-Werror=unused-but-set-variable -optc-Wno-error=inline -c compiler/main/HeaderInfo.hs -o _build/stage1/compiler/build/HeaderInfo.o -O0 -H64m -Wall -Wno-name-shadowing -Wnoncanonical-monad-instances -Wnoncanonical-monadfail-instances -Wnoncanonical-monoid-instances -this-unit-id ghc -XHaskell2010 -XNoImplicitPrelude -ghcversion-file=/home/zhen/repos/ghc/_build/generated/ghcversion.h -DSTAGE=2 -optc-DTHREADED_RTS -DGHCI_TABLES_NEXT_TO_CODE -Wno-deprecated-flags -Wcpp-undef
You are using an unsupported version of LLVM!
Currently only 5.0 is supported.
We will try though...
| Run Ghc CompileHs Stage1: compiler/codeGen/StgCmmExpr.hs => _build/stage1/compiler/build/StgCmmExpr.o
_build/stage0/bin/arm-linux-gnueabihf-ghc -Wall -hisuf hi -osuf o -hcsuf hc -static -hide-all-packages -no-user-package-db '-package-db _build/stage1/lib/package.conf.d' '-this-unit-id ghc-8.5' '-package-id array-0.5.2.0' '-package-id base-4.12.0.0' '-package-id binary-0.8.5.1' '-package-id bytestring-0.10.8.2' '-package-id containers-0.5.11.0' '-package-id deepseq-1.4.4.0' '-package-id directory-1.3.2.3' '-package-id filepath-1.4.2' '-package-id ghc-boot-8.5' '-package-id ghc-boot-th-8.5' '-package-id ghci-8.5' '-package-id hpc-0.6.0.3' '-package-id process-1.6.3.0' '-package-id template-haskell-2.14.0.0' '-package-id time-1.8.0.2' '-package-id transformers-0.5.5.0' '-package-id unix-2.8.0.0' -i -i_build/stage1/compiler/build -Iincludes -i_build/stage1/compiler/build/autogen -icompiler/backpack -icompiler/basicTypes -icompiler/cmm -icompiler/codeGen -icompiler/coreSyn -icompiler/deSugar -icompiler/ghci -icompiler/hsSyn -icompiler/iface -icompiler/llvmGen -icompiler/main -icompiler/nativeGen -icompiler/parser -icompiler/prelude -icompiler/profiling -icompiler/rename -icompiler/simplCore -icompiler/simplStg -icompiler/specialise -icompiler/stgSyn -icompiler/stranal -icompiler/typecheck -icompiler/types -icompiler/utils -icompiler/vectorise -I_build/generated -I_build/stage1/compiler/build -I_build/stage1/compiler/build/. -I_build/stage1/compiler/build/parser -I_build/stage1/compiler/build/utils -I_build/stage1/compiler/build/../rts/dist/build -Icompiler/. -Icompiler/parser -Icompiler/utils -Icompiler/../rts/dist/build -I/home/zhen/repos/ghc/_build/stage1/lib/arm-linux-ghc-8.5.20180425/process-1.6.3.0/include -I/home/zhen/repos/ghc/_build/stage1/lib/arm-linux-ghc-8.5.20180425/unix-2.8.0.0/include -I/home/zhen/repos/ghc/_build/stage1/lib/arm-linux-ghc-8.5.20180425/time-1.8.0.2/include -I/home/zhen/repos/ghc/_build/stage1/lib/arm-linux-ghc-8.5.20180425/bytestring-0.10.8.2/include -I/home/zhen/repos/ghc/_build/stage1/lib/arm-linux-ghc-8.5.20180425/base-4.12.0.0/include -I/home/zhen/repos/ghc/_build/stage1/lib/arm-linux-ghc-8.5.20180425/rts-1.0/include -I_build/generated -optc-I_build/generated -optP-include -optP_build/stage1/compiler/build/autogen/cabal_macros.h -optc-marm -optc-fno-stack-protector -optP-DGHCI -odir _build/stage1/compiler/build -hi
I believe that
build.sh
's-c
can't be passed a--target=arm-linux-gnueabihf
?
@izgzhen What do you mean? Can't you simply add a new flag in UserSettings
?
It was compiling STAGE 2 stuff now -- I suspect that Stage1Only is not respected.
This might well be due to the recent major changes.
Can't you simply add a new flag in UserSettings?
Oh, I just realized that. Thanks!
And regarding the purpose of this issue, I've completed the build and it looks fine to me. Only the -iIncludes
problem above.
@izgzhen By the way, there is also this issue: #432 -- perhaps you can close it as well while you're working on cross compilation?
Good, I will take a look later
@izgzhen What do you mean? Can't you simply add a new flag in UserSettings?
When doing #583, I found that there is also a TargetPlatform
in cfg/system.config
, but this looks confusing to me since the system.config.in
was only populated after running configure
, and the TargetPlatform
can be only defined by ./configure --target=<...>
. So it seems impossible to run ./build.sh -c
to configure a cross-compiling build correctly.
Unless we if some targetPlatform :: Maybe String
is not Nothing
, we override the Oracle one, and use it in Configure "."
I'd like to hear your input here @snowleopard
Maybe we just don't support -c
for these configurations? I am still not convinced of the benefit of -c
. It mixes the configure and build phases. And there is a reason why configure
and make
are separate as well; and hadrian is (to me) a make
replacement. I do understand that some feel the need to run ./boot
and configure
too burdensome. And while I disagree and think it just tries to hide some complexity that really ought to be understood, I don't mind retaining -c
for the casual use case. But any more advanced use case will likely require to run ./configure
outside of hadrian.
Or are we going to start trying to add some options to hadrian option parsers to pass flags verbatim to configure?
I personally will keep invoking ./configure
separately as my default workflow for packaging and local development, and I expect Hadrian to keep supporting that workflow as first-class citizen and keep the configure and build phases cleanly separated.
Maybe we just don't support
-c
for these configurations?
I think I agree with this. This could be as simple as adding a bold sentence in the README and in https://ghc.haskell.org/trac/ghc/wiki/Building/Hadrian/QuickStart that warns people that unless they don't need to pass any option to ./configure, they're better off running ./boot and ./configure explicitly. It's enough work to keep Hadrian in sync with GHC development, so I think it makes sense not to expose any configure argument parsing, because that would have to be kept in sync too.
So it seems impossible to run
./build.sh -c
to configure a cross-compiling build correctly.
@izgzhen Why can't you add builder (Configure ".") ? arg "--target=<...>"
to your UserSettings
?
@angerman @hvr @alpmestan I don't understand your concern: noone is forced to use -c
and it's off by default. It's a convenience option for people like me who don't want to run configure
manually. You are free to use your usual workflow.
My primary concern is the tight coupling of hadrian and configure. When ever I add something to the configure script, I might need to invest into mirroring that in hadrian?
Example use case:
$ ./boot --hadrian
$ ./configure --target=aarch64-apple-ios
$ ./hadrian/build.sh --root=_ios64
$ ./configure --target=aarch64-linux-android
$ ./hadrian/build.sh --root=_android64
$ ./configure --target=arm-linux-android
$ ./hadrian/build.sh --root=_android32
So we are either going to need a way to pass arbitrary configure flags to ./build.sh -c
or hadrian ends up mirroring all possible configure flags.
Now, if your proposed way of using hadrian is to use the UserSettings
for this kind of setup then
./build.sh -c
does not need to support cross compilation (as an argument -- which was the point I was trying to make).
When ever I add something to the configure script, I might need to invest into mirroring that in hadrian?
No, of course not: -c
was never meant to support all possible flags you might want to pass to configure
.
Now, if your proposed way of using hadrian is to use the
UserSettings
for this kind of setup then./build.sh -c
does not need to support cross compilation
This is completely up to you. If you think your work on cross compilation could be helped by automating the execution of configure
and appropriately tracking the files it generates, so that you don't need to remember to reconfigure every time you, say, change ghc.cabal.in
then you have two options:
configure
flags you are currently working on to your UserSettings
.-c=arm
that passes the right combination of flags to configure
. The -c
flag is there only for convenience. You don't need to care about it if you don't use it.
The
-c
flag is there only for convenience. You don't need to care about it if you don't use it.
Maybe you misunderstood, but @angerman and I did not say otherwise. I was personally just suggesting that we make it clear (in the README etc) that for building cross compilers and more generally whenever you need to pass some flags to configure
, -c
is not an option because there's no way to pass additional configure flags.
-c
is not an option because there's no way to pass additional configure flags.
But there is! You can just add them in UserSettings
. This is why we have UserSettings
after all.
I meant on the command line, that you can't say -c --config-args="--target=foo"
for example. But this can indeed be achieved through custom UserSettings
, absolutely. Maybe spelling out both ways in the documentation would be good.
@alpmestan Yes, I've just checked the user settings docs and I think we should add an example of adding arguments to configure
. Moreover, right now UserSettings
is not very convenient to use: I'd like it to be easier to do a quick edit to modify some command line arguments, perhaps by expanding the definition of user flavours: userFlavour = defaultFlavour { name = "user" }
.
according to steps in
docs/cross-compile.md