-
Notifications
You must be signed in to change notification settings - Fork 37
Error: at least ftruncate or _chsize functions are required to build #523
Comments
This looks similar to https://mail.haskell.org/pipermail/ghc-devs/2018-March/015425.html. Are you sure you've updated submodules? |
I supposed "yes", but I tried again from scratch anyway:
again error. |
gcc
failed in phase Linker
I guess the above error is related to Lines 80 to 82 in 9eef6a7
|
@izgzhen Note: this is a different error! Now it is consistent with what we have in CI. Thanks for recording this: I'm unlikely to have time to look into this during this week, but if anyone would like to fix Hadrian (presumably this failure is caused by some changes in GHC), I'm happy to review a PR. |
this problem seems to be resolved by: diff --git a/src/Rules/Gmp.hs b/src/Rules/Gmp.hs
index 46fad8a..4dbbfff 100644
--- a/src/Rules/Gmp.hs
+++ b/src/Rules/Gmp.hs
@@ -78,8 +78,7 @@ gmpRules = do
-- This causes integerGmp package to be configured, hence creating the files
[gmpBase -/- "config.mk", gmpBuildInfoPath] &%> \_ -> do
- dataFile <- pkgDataFile gmpContext
- need [dataFile]
+ build $ target gmpContext (Configure $ pkgPath integerGmp) [gmpBuildInfoPath <.> "in"] [gmpBuildInfoPath]
-- Run GMP's configure script
-- TODO: Get rid of hard-coded @gmp@. |
But there is more problem coming:
this internal error msg can be reproduced by running |
@izgzhen @snowleopard the error was coming because "struct MD5Context" was not found. |
I think this is a good (and urgent!) issue for a beginner. Potential GSoC applicants, give it a try! |
The error is coming due to the inclusion of this line in libraries/base/configure.ac::240. AC_CHECK_TYPE([struct MD5Context], [], [AC_MSG_ERROR([internal error])], [#include "include/md5.h"]). But the file "include/md5.h" is present and is containing struct MD5Context. I have seen the earlier implementations. Earlier implementation returned with value "no" but new implementation causes an error. |
@chitrak7 How does the Make build system deal with this? Why does it succeed? Presumably, it calls the |
I have been trying to figure it out. There are no recent changes in any of the concerned makefiles, but I believe that we have been doing this step wrong since the start. Just we were not able to detect it as it didn't cause any errors. Can you give any pointers on where to look @snowleopard |
@snowleopard The make system is somehow copying a few c libraries from ghc/includes to ghc/libraries/base/include. This is because md5.h has some headers files which are not present with it, but are present in ghc/includes. After this, ./configure runs fine. But the problem is still persisting. |
@chitrak7 Aha, that's a very useful piece of information! Can you link to these specific lines in Makefiles? |
@snowleopard I have not been able to find this in the Makefile. I am deducing this because the file ghc/libraries/base/include/md5.h has a lot of header files such as "HsFFi.h" which are required for configure to compile. These are present in ghc/includes. Hence, some copying must be done. |
"inplace/bin/ghc-cabal" configure libraries/base dist-install --with-ghc="/home/chitrak/ghc/inplace/bin/ghc-stage1" --with-ghc-pkg="/home/chitrak/ghc/inplace/bin/ghc-pkg" --flags=integer-gmp --disable-library-for-ghci --enable-library-vanilla --enable-library-for-ghci --enable-library-profiling --enable-shared --with-hscolour="/usr/bin/HsColour" --configure-option=CFLAGS="-Wall -fno-stack-protector -Werror=unused-but-set-variable -Wno-error=inline" --configure-option=LDFLAGS=" " --configure-option=CPPFLAGS=" " --gcc-options="-Wall -fno-stack-protector -Werror=unused-but-set-variable -Wno-error=inline " --with-gcc="gcc" --with-ld="ld.gold" --with-ar="ar" --with-alex="/usr/bin/alex" --with-happy="/usr/bin/happy" |
_build/stage0/utils/ghc-cabal/ghc-cabal configure libraries/base /home/chitrak/ghc/_build/stage1/libraries/base --with-ghc=/home/chitrak/ghc/inplace/bin/ghc-stage1 --with-ghc-pkg=/home/chitrak/ghc/inplace/bin/ghc-pkg --enable-library-vanilla --enable-library-for-ghci --enable-library-profiling --enable-shared '--configure-option=CFLAGS=-fno-stack-protector -I/home/chitrak/ghc/_build/generated' --configure-option=LDFLAGS=-fuse-ld=gold --configure-option=CPPFLAGS=-I_build/generated '--gcc-options=-fno-stack-protector -I/home/chitrak/ghc/_build/generated -fuse-ld=gold' --configure-option=--with-cc=/usr/bin/gcc --with-gcc=/usr/bin/gcc --with-ld=/usr/bin/ld.gold --with-ar=/usr/bin/ar --with-alex=/usr/bin/alex --with-happy=/usr/bin/happy --flags=integer-gmp |
@snowleopard It looks like the is supposed to be packagePath/dist-dir and not _build/stage1/packagePath. Can you look into this? |
@chitrak7 Hadrian takes a different approach than Make in this respect. Make builds GHC right in the source tree, polluting it with build artefacts. Hadrian tries to put everything into the Note: this issue might still be related to what you've found. But, changing |
@snowleopard There is an interesting error in config.log: |
@chitrak7 Thanks for investigating further! I've made a PR with a simple fix that works for me locally: #526. Let's see if it also works for you and our CI instances. Note that my build still fails, but later:
|
@snowleopard It is because we are not including package directory in cflags. I think its a typo. The C file looks for a constatnt HAVE_UNISTD_H and HAVE_FTRUNCATE. This constant is stored in config log. so we have to include config.log along with this. I tried to include library -I_build/stage1/libraries/base/build which didn't work. But including -Ilibraries/base did. both these directories contain the same config.log, but one is generated manually by me and other by hadrian. |
Continued.. But this command works without error: The changes in the above two commands are: Can anyone please check into this. |
Changes done by me to pass for libraries/base. diff --git a/src/Settings/Builders/Common.hs b/src/Settings/Builders/Common.hs
index bfcddeb..a8b7fdf 100644
--- a/src/Settings/Builders/Common.hs
+++ b/src/Settings/Builders/Common.hs
@@ -29,7 +29,9 @@ cIncludeArgs = do
mconcat [ not (cross && compilerOrGhc) ? arg "-Iincludes"
, arg $ "-I" ++ root -/- generatedDir
, arg $ "-I" ++ path
+ , arg $ "-I" ++ path -/- "build"
, pure [ "-I" ++ pkgPath pkg -/- dir | dir <- incDirs ]
+ , pure [ "-I" ++ dir | dir <- incDirs ]
, pure [ "-I" ++ unifyPath dir | dir <- depDirs ] ] |
@chitrak7 I would like to help you but when I tried to build the latest source with |
Hi @izgzhen. |
@chitrak7 thanks for your reply! I just
|
Can you plaese run this command from ghc directory with sudo: |
@chitrak7 same result:
|
|
I think we should include this as well...Err, bug is everywhere |
-Ilibraries/integer-gmp//home/zhen/repos/ghc/_build/stage1/libraries/integer-gmp/build/include |
@izgzhen odd, I replaced /zhen/repos to /chitrak in your command and ran it on my terminal. It worked. Are you sure you executed it from ghc and not hadrian? |
sure, otherwise the |
@chitrak7 https://github.com/snowleopard/hadrian/blob/master/src/Settings/Builders/Common.hs#L33 this line should be the one producing the wrong |
@izgzhen |
@izgzhen The issue is much deeper. Actually package-data.mk is supposed to keep these paths in the category INCLUDE_DEPS. But unfortunately, there one is relative and other absolute. Please refer to my earlier comment:
|
Oh, I see why you patch looks like that. I am waiting for my build to finish with your patch. Thanks! |
Hopefully my patch will give error with process or unix library. Do inform me about the result. Also, did the HsIntegerConfig.hs error resolve by updating commands? |
@chitrak7 My build stopped at |
With process library?? Or unix library? Can you give the final command. |
process library. I am trying out the change you described above now, wait a bit. |
the diff I made is changing |
@izgzhen |
it is true -- how can we generalize this solution? |
@izgzhen
|
I’m not sure I know the solution but I guess it is related to how package-data.mk is formulated by Hadrian. I’ll take further look once I got some time ;) |
@izgzhen @chitrak7 Thank you for investigating this further -- I hope I'll soon find some time to join! Just wanted to quickly add that we have a function that post-processes https://github.com/snowleopard/hadrian/blob/master/src/Rules/PackageData.hs#L100-L117 Maybe this is what needs to be tweaked. Note that this issue will likely be gone after #445 is merged, since there will no longer be any |
Yes. @alpmestan has a working variant of #445 that drops |
See PR #531. |
I will close this now, please reopen if something is left to be done |
./build.sh -j --verbose --no-progress --progress-colour=never --progress-info=brief --profile=-
The text was updated successfully, but these errors were encountered: