flutter-rs icon indicating copy to clipboard operation
flutter-rs copied to clipboard

error: linking with `link.exe` failed: exit code: 1181; cannot open input file 'flutter_engine.lib'

Open usagi opened this issue 5 years ago • 5 comments

I tried build and run the example on Windows environmennt, but it was failed. Repro and errors is below:

Repro

  1. Install the flutter sdk ( git clone and append the bin dir to the PATH )
  2. cargo install cargo-flutter
  3. git clone https://github.com/flutter-rs/flutter-app-template
  4. cd flutter-app-template
  5. cargo flutter run

Then, I got the error in the below:

flutter build bundle lib/main.dart
   Compiling flutter-app-template v0.1.0 (C:\Users\usagi\tmp\flutter-app-template)
error: linking with `link.exe` failed: exit code: 1181
  |
  = note: "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.24.28314\\bin\\HostX64\\x64\\link.exe" "/NOLOGO" "/NXCOMPAT" "/LIBPATH:C:\\Users\\usagi\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib" ( ... very long list ... ) "ws2_32.lib" "advapi32.lib" "ws2_32.lib" "userenv.lib" "msvcrt.lib"
  = note: LINK : fatal error LNK1181: cannot open input file 'flutter_engine.lib'

I was search the flutter_engine.lib in the target directory and flutter sdk directory, but the file is not found.

usagi avatar Mar 09 '20 13:03 usagi

Could you copy the output of flutter --version?

I haven't tested windows in a while, however it did at least build.

csnewman avatar Mar 10 '20 09:03 csnewman

@csnewman

PS C:\Users\usagi\tmp\flutter-app-template> flutter --version
Flutter 1.12.13+hotfix.8 • channel stable • https://github.com/flutter/flutter.git
Framework • revision 0b8abb4724 (4 weeks ago) • 2020-02-11 11:44:36 -0800
Engine • revision e1e6ced81d
Tools • Dart 2.7.0

Thank you supporting. I'm newbie about flutter but I want solve the situation.

usagi avatar Mar 10 '20 11:03 usagi

Yep, same error, flutter-engine\[SHA1]\x86_64-pc-windows-msvc\debug_unopt isn't in LIBPATH so it doesn't find it. I'm using the latest version that has a Windows build

Flutter 1.15.3-pre.34 • channel unknown • unknown source
Framework • revision b40cb088d4 (9 weeks ago) • 2020-02-07 19:55:04 -0500
Engine • revision 6158f03ef5
Tools • Dart 2.8.0 (build 2.8.0-dev.8.0 514a8d4c84)

anaisbetts avatar Apr 12 '20 21:04 anaisbetts

I have encountered this error as well.

thavlik avatar Apr 23 '20 19:04 thavlik

reference

Download and install the Build Tools for Visual Studio 2019. During installation select the C++ tools. It will download almost 5GB of data. Then restart the machine after installation and compiling the code will work fine.

schizobulia avatar Dec 02 '20 03:12 schizobulia