runtime icon indicating copy to clipboard operation
runtime copied to clipboard

ARM: cross compile configure fail with version.cpp not found

Open seanshpark opened this issue 10 years ago • 14 comments

Failed with Cannot find source file: bin/obj/Linux.arm.Debug/version.cpp when clean build

-- Configuring done
CMake Error at functions.cmake:174 (add_library):
  Cannot find source file:

    /.../coreclr/bin/obj/Linux.arm.Debug/version.cpp

  Tried extensions .c .C .c++ .cc .cpp .cxx .m .M .mm .h .hh .h++ .hm .hpp
  .hxx .in .txx
Call Stack (most recent call first):
  src/corefx/System.Globalization.Native/CMakeLists.txt:55 (_add_library)

I try to build from clean like;

ROOTFS_DIR=/home/maxwell/zarm-rootfs-wily ./build.sh arm cross skipmscorlib clean

master hash is 661e5d078fdbbb4b0acd98a023d8a66762af5a4a

seanshpark avatar Apr 25 '16 11:04 seanshpark

@joperezr , I get this problem in x86-64, Ubuntu 14.04. Can you check this ? But inside ARM machine (RPi2) build is going OK.

seanshpark avatar Apr 25 '16 11:04 seanshpark

mm I'm unable to repro this on my ubuntu box. Can you try re-getting latest code and try again? Also if that doens't work, can you pass in param skipgenerateversion to your build.sh call to see if that fixes it?

joperezr avatar Apr 25 '16 17:04 joperezr

I still get above error. And I think while in configure msbuild.exe is called before Tools are prepared

/../coreclr/init-tools.sh: line 122: /../coreclr/packages/Microsoft.DotNet.BuildTools/1.0.25-prerelease-00321-01/lib/init-tools.sh: No such file or directory
chmod: cannot access ‘/../coreclr/Tools/corerun’: No such file or directory
Running: "/../coreclr/Tools/corerun" "/../coreclr/Tools/MSBuild.exe" "/../coreclr/build.proj" /t:GenerateVersionSourceFile /p:NativeVersionSourceFile=/../coreclr/bin/obj/Linux.arm.Debug/version.cpp /p:GenerateVersionSourceFile=true /v:minimal 
./build.sh: line 155: /../coreclr/Tools/corerun: No such file or directory

When I search for this init-tools.sh, I get this.

$ find . -name init-tools.sh
./packages/Microsoft.DotNet.BuildTools/1.0.25-prerelease-00307-04/lib/init-tools.sh
./init-tools.sh

Tools was not upgraded somehow and also does not after deleting Tools folder.

The reason for this was that I'm using shared Linux machine with others and I had no write authority for /tmp/NuGetScratch folder somehow.

After changing lock folder to 777, the whole thing is OK.

seanshpark avatar Apr 25 '16 22:04 seanshpark

I see, ok glad it all works now! :smile:

joperezr avatar Apr 25 '16 23:04 joperezr

Similar issue (Ubuntu 14.04.4, x86_64, commit f38508b):

./build.sh arm debug clean verbose ... Cannot find source file: .../coreclr/bin/obj/Linux.arm.Debug/version.cpp

coreclr/init-tools.log:

error: Unable to resolve 'Microsoft.DotNet.BuildTools (>= 1.0.25-prerelease-00327-01)' for 'DNXCore,Version=v5.0'.

I own "/tmp/NuGetScratch" and have all permissions for it (including contents).

The same result with:

ROOTFS_DIR=${HOME}/CROSS-ROOTFS/arm ./build.sh arm cross skipmscorlib clean

With 'skipgenerateversion' parameter it fails later:

./build.sh arm debug clean verbose ... curl -sSL --create-dirs -o .../coreclr/Tools/dotnetcli/dotnet.tar https://dotnetcli.blob.core.windows.net/dotnet/beta/Binaries/1.0.0-beta-002173/dotnet-dev-ubuntu-x64.1.0.0-beta-002173.tar.gz log : Restoring packages for .../coreclr/Tools/1.0.25-prerelease-00327-01/project.json... error: Failed to retrieve information from remote source '.../coreclr/packages'.

Looks like it happens due to missing "coreclr/packages" folder.

coreclr/init-tools.sh: line 122: .../coreclr/packages/Microsoft.DotNet.BuildTools/1.0.25-prerelease-00327-01/lib/init-tools.sh: No such file or directory chmod: cannot access ‘.../coreclr/Tools/corerun’: No such file or directory Failed to restore BuildTools.

However cross build is successfull:

ROOTFS_DIR=${HOME}/CROSS-ROOTFS/arm ./build.sh arm cross skipmscorlib clean skipgenerateversion

Non-cross build is also successful if I add 'skipmscorlib' but the whole point of this build is to get 'mscorlib' for ARM.

mkborg avatar Apr 29 '16 12:04 mkborg

Looks like nowadays it is expected: dotnet/runtime#5679 ;-)

mkborg avatar Apr 29 '16 12:04 mkborg

@mkborg, with my short experience in .net core with something like Looks like it happens due to missing "coreclr/packages" folder., looking inside the log carefully may give a hint. May be network problem, disk full, cache broken, write access maybe... What I know is that skipmscorlib will skip mscorlib build step that is, skip managed source compilation, so no need of Tools to be downloaded.

seanshpark avatar Apr 29 '16 14:04 seanshpark

Hardly it is problem with my environment since builds for some older commits (for example ae674a6) are successful.

mkborg avatar Apr 29 '16 14:04 mkborg

FYI. Here is another case. When I tried to compile the clang/llvm3.6 excluding lldb3.6 directly, I also got the same error message at build time of coreCLR as following:

  • ubuntu14.04@geunsik$> time ROOTFS_DIR=/work/dotnet/rootfs-coreclr/arm ./build.sh arm release clean cross
     . . . . . . Upper Omission  . . . . . 
-- Performing Test GETPWUID_R_SETS_ERRNO - Success
-- Performing Test FILE_OPS_CHECK_FERROR_OF_PREVIOUS_CALL
-- Performing Test FILE_OPS_CHECK_FERROR_OF_PREVIOUS_CALL - Failed
-- Performing Test UNWIND_CONTEXT_IS_UCONTEXT_T
-- Performing Test UNWIND_CONTEXT_IS_UCONTEXT_T - Failed
-- Configuring done
CMake Error at functions.cmake:174 (add_library):
  Cannot find source file:

    /work/dotnet/coreclr.git/bin/obj/Linux.arm.Debug/version.cpp

  Tried extensions .c .C .c++ .cc .cpp .cxx .m .M .mm .h .hh .h++ .hm .hpp
  .hxx .in .txx
Call Stack (most recent call first):
  src/corefx/System.Globalization.Native/CMakeLists.txt:55 (_add_library)

-- Build files have been written to: /work/dotnet/coreclr.git/bin/obj/Linux.arm.Debug
Failed to generate native component build project!

ubuntu14.04@geunsik$> 
ubuntu14.04@geunsik$> 

At that time, I could resolve the build-break of colreCLR after including lldb-3.6 source to ./llvm-3.6/tools/ folder.

leemgs avatar May 19 '16 08:05 leemgs

'version.cpp' shall be automatically generated by some C# code. Usually it fails if 'build tools' download failed. With 'skipgenerateversion' option 'version.cpp' is directly generated by build script without any additional dependency.

Note: In my case 'build tools' download was fixed by deleting '~/.local/share/NuGet/v3-cache'.

mkborg avatar May 19 '16 08:05 mkborg

@mkborg. Thanks. Actually, I have been looking for "skipgenerateversion" option.

leemgs avatar May 19 '16 11:05 leemgs

To clarify, the workaround seems to be to chmod 777 /tmp/NuGetScratch/lock and then ./build.sh skipgenerateversion

mspandit avatar May 19 '16 23:05 mspandit

The problem with /tmp/NuGetScratch/lock is that NuGet erroneously uses the same directory for all users.

It would be better if NuGet itself removed it on finish -- right now on my Linux that directory contains 7415 useless mostly zero-size several-weeks-old files.

mkborg avatar May 20 '16 12:05 mkborg

@mspandit, @mkborg , Yes. users need to get their 'tmp' folder instead of the '/tmp' folder to avoid the locking issue. Each user can easily set the below environment variable as following:

1st step:

vi ~/.bash_profile
export TMP=${HOME}/tmp
OR  export TMPDIR=${HOME}/tmp
OR export TEMP=${HOME}/tmp

2nd step: ./build.sh skipgenerateversion

leemgs avatar May 20 '16 12:05 leemgs