Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build on Windows fails due to a path-limit error #61

Closed
Mik4sa opened this issue Dec 20, 2017 · 14 comments
Closed

Build on Windows fails due to a path-limit error #61

Mik4sa opened this issue Dec 20, 2017 · 14 comments

Comments

@Mik4sa
Copy link

Mik4sa commented Dec 20, 2017

I currently don't have much time, so forgive me if there is not much detail.

I was able to successfully create the solution by following your description(s), but sadly I got some errors when building the project/solution in VS2017 (latest version).

Added the log, may you can see something.
retdec build log.txt

My setup:
Win 10 Pro x64 (latest version)
VS2017 (latest version)

@stonedreamforest
Copy link

similar issue here

@s3rvac
Copy link
Member

s3rvac commented Dec 21, 2017

Hi. Could you please provide output from the following two files so we can investigate this further?

retdec/build/deps/fileformat/deps/retdec-config/deps/jsoncpp/jsoncpp-project-prefix/src/jsoncpp-project-stamp/jsoncpp-project-build-err.log
retdec/build/deps/fileformat/deps/retdec-config/deps/jsoncpp/jsoncpp-project-prefix/src/jsoncpp-project-stamp/jsoncpp-project-build-out.log

@Mik4sa
Copy link
Author

Mik4sa commented Dec 21, 2017

So, I made a new clean build, this is the result (sry thats it's in german, do you need it in english? Can I change the language for msbuild output?)
cmake log.txt
msbuild retdec.sln log.txt
msbuild INSTALL.vcxproj log.txt

jsoncpp-project-build-out.log

The jsoncpp-project-build-err log is empty.

@s3rvac
Copy link
Member

s3rvac commented Dec 21, 2017

Thank you for the outputs. German is alright I guess :-). In the outputs, I found the following two errors:

1:

error MSB3491: In die Datei
"jsoncpp_lib_static.dir\Release\jsoncpp_.2BEF112F.tlog\jsoncpp_lib_static.lastbuildstate"
konnten keine Zeilen geschrieben werden. Der angegebene Pfad und/oder Dateiname
ist zu lang. Der vollstandig qualifizierte Dateiname muss kurzer als 260
Zeichen und der Pfadname kurzer als 248 Zeichen sein.
[C:\Users\Kai\Documents\Programmierung\Gamehacking\retdec\build\deps\fileformat\deps\retdec-config\deps\jsoncpp\jsoncpp-project-prefix\src\jsoncpp-project-build\src\lib_json\jsoncpp_lib_static.vcxproj]

This says that the complete path to the file is too long (longer than 260 characters, which represents a limit on Windows). Could you please try to clone the repository into a shorter path (e.g. C:\retdec) and try the build again from there? If this turns out to be the reason why the build does not work for you, we will have to try to reduce the size of our build-directory structure.

2:

89: #error:  "Unknown Visual Studio version."
[C:\Users\Kai\Documents\Programmierung\Gamehacking\retdec\build\deps\capstone2llvmir\deps\llvm\llvm-project-prefix\src\llvm-project-build\lib\DebugInfo\PDB\LLVMDebugInfoPDB.vcxproj]
[C:\Users\Kai\Documents\Programmierung\Gamehacking\retdec\build\deps\capstone2llvmir\deps\llvm\llvm-project.vcxproj]

This is a similar error that is reported here. However, we were not able to reproduce it (see this comment). Maybe this is caused by the previous error. I would suggest you to try the build in a shorter path first (see above) and let us know.

@Mik4sa
Copy link
Author

Mik4sa commented Dec 21, 2017

ah nice, I was able to fix it.
So, first I moved it to another folder (I just read that with Win10 we can disable this limit :), testing it now.).
I also had to make changes to all DIASession.cpp files (similar to https://github.com/avast-tl/fileformat/issues/4#issuecomment-352960721)
...\retdec\deps\llvm\src\lib\DebugInfo\PDB\DIA\DIASession.cpp
...\retdec\deps\fnc-patterns\deps\fileformat\deps\llvm\src\lib\DebugInfo\PDB\DIA\DIASession.cpp
...\retdec\deps\capstone2llvmir\deps\llvm\src\lib\DebugInfo\PDB\DIA\DIASession.cpp
...\retdec\deps\fileformat\deps\llvm\src\lib\DebugInfo\PDB\DIA\DIASession.cpp

I changed there

#if _MSC_VER == 1900
  msdia_dll = L"msdia140.dll"; // VS2015
#elif _MSC_VER == 1800
  msdia_dll = L"msdia120.dll"; // VS2013
#else
#error "Unknown Visual Studio version."
#endif

to

#if _MSC_VER >= 1910
  msdia_dll = L"msdia140.dll"; // VS2017
#elif _MSC_VER == 1900
  msdia_dll = L"msdia140.dll"; // VS2015
#elif _MSC_VER == 1800
  msdia_dll = L"msdia120.dll"; // VS2013
#else
#error "Unknown Visual Studio version."
#endif

I simply took >= 1910 because my _MSC_VER was 1912

EDIT: Well, the path limit fix does not work with msbuild

@s3rvac
Copy link
Member

s3rvac commented Dec 22, 2017

I am going to fix DBASession.cpp based on this comment and will let you know.

@s3rvac s3rvac added the bug label Dec 22, 2017
s3rvac added a commit to avast/llvm that referenced this issue Dec 22, 2017
On VS 2017, _MSC_VER is > 1910, and so the build fails with the following
error:

    Unknown Visual Studio version

The fix is based on the sources of LLVM 5.0, where this has been fixed:

    https://github.com/llvm-mirror/llvm/blob/master/lib/DebugInfo/PDB/DIA/DIASession.cpp#L76

The reason we were unable to reproduce this build issue is that when you open
llvm/src/lib/DebugInfo/PDB/CMakeLists.txt, you can see that DIASession.cpp is
built only if you have Debug Interface Access SDK (DIA SDK) in your system.

For more information, see the following issues:
* https://github.com/avast-tl/fileformat/issues/4
* avast/retdec#61
@s3rvac
Copy link
Member

s3rvac commented Dec 22, 2017

In 9ab4f56e3, I have fixed the compilation of DIASession.cpp with VS 2017 when DIA SDK is installed, so the build should work now.

EDIT: Well, the path limit fix does not work with msbuild

Please, can you elaborate? Did it fail with the same error as before or with a different one?

@Mik4sa
Copy link
Author

Mik4sa commented Dec 22, 2017

Please, can you elaborate? Did it fail with the same error as before or with a different one?

With exactly the same error. As far as I can see there is nothing you can do about it (except changing the directory structure). MSBuild needs to be "patched" which seems to be quite hard.
Due to the path limit I can't even load the json tester (or something similar) project in Visual Studio, trying so throws the path error again.

@s3rvac
Copy link
Member

s3rvac commented Dec 22, 2017

This is strange as we are able to build it on Windows. Nevertheless, we will most definitely try to reduce the length and depth of the directory structure.

@s3rvac s3rvac changed the title VS2017 build error(s) Build with VS 2017 fails ("unknown visual studio version" + path limit error) Dec 22, 2017
@s3rvac s3rvac changed the title Build with VS 2017 fails ("unknown visual studio version" + path limit error) Build on Windows fails due to a path-limit error Dec 22, 2017
@Mik4sa
Copy link
Author

Mik4sa commented Dec 22, 2017

This is strange as we are able to build it on Windows. Nevertheless, we will most definitely try to reduce the length and depth of the directory structure.

Just to clarify, I can also build the project(s), but just not from my normal path where my other projects are located. Building it from C:\retdec directly works just fine.

@s3rvac
Copy link
Member

s3rvac commented Dec 22, 2017

Ah, I see. OK. We will try to do something with the long paths that we create during the build.

s3rvac added a commit that referenced this issue Dec 25, 2017
This reduces path lengths, which is important on Windows as there is a limit on
how long a path can be (#61).
@s3rvac
Copy link
Member

s3rvac commented Dec 25, 2017

In ecba1a6, I have reduced the length of paths created by external projects. In the case of jsoncpp (the offending library), the path lengths got decreased by 60 characters.

Would you be able to test the build of the current master branch in the original location (C:\Users\Kai\Documents\Programmierung\Gamehacking\retdec) to see whether this fixed the build for you?

@Mik4sa
Copy link
Author

Mik4sa commented Dec 25, 2017

Works fine now, thx for the fast changes :)

@s3rvac
Copy link
Member

s3rvac commented Dec 25, 2017

Perfect, thanks for the verification!

@s3rvac s3rvac closed this as completed Dec 25, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants