JaciBrunning / Pathfinder

Cross-Platform, Multi-Use Motion Profiling and Trajectory Generation
MIT License
255 stars 78 forks source link

Building Java for Windows #29

Closed duane701 closed 6 years ago

duane701 commented 6 years ago

How do I compile so that I can use the library to run a program on Windows?

The primary error is

No C compiler for Binary (shared library 'pathfinder:any64:sharedlibrary') with Toolchain clang on Platform any64. Skipping build.

Does the build require clang? I installed msys so that I have gcc.

What are the requirements and instructions for building the library so that I can build and run a program on Windows?

Thanks

JaciBrunning commented 6 years ago

On windows, you need to have Visual Studio installed in order to build native libraries with Gradle

duane701 commented 6 years ago

I've now installed visual studio (I'll have to work out which installer I ran if it's important).

After building I get LINK: fatal error LNK1104: cannot open file 'kernel32.lib'

The error is from Pathfinder-Core:linkPathfinderAny64SharedLibrary.

The program we have developed uses Java which of course uses the shared library to run.

I'm on a 64-bit system.

Thoughts?

JaciBrunning commented 6 years ago

This sounds like a problem during installation. Check that you've installed the windows desktop C++ SDK, and that you did indeed install the 64 bit version.

duane701 commented 6 years ago

same same 👎

I installed Visual Studio Community 2017 with "Desktop development with C++" and "Universal Windows Platform Development".

I've tried using the command prompt from "Developer Command Prompt for VS 2017" and "x64 Native Tools Command Prompt for VS 2017". Same error under both conditions.

Thanks for any tips.

(I'm not a Windows person. The library works great on the Mac.)

duane701 commented 6 years ago

It sounds like other people are able to compile Pathfinder-Tool on Windows. I would appreciate any tips that might help me work out where I am running into a problem.

duane701 commented 6 years ago

C:\Program Files (x86)\Windows Kits\10\bin\Lib\winv6.3\um\x64 does not exist, starting at Lib\winv6.3\um\x64. That is there is no Lib directory at all.

Thanks

duane701 commented 6 years ago

The correct path seems to be C:\Program Files (x86)\Windows Kits\10\Lib\10.0.16299.0\ucrt\x64 at least that's where kernel32.lib is located.

Why is gradle searching in this other location?

dkt01 commented 6 years ago

I was able to build in Windows 10 with the Visual Studio 2017 build tools, but I had to download an additional Windows 10 SDK version using the installer. For some reason the default SDK wouldn't link correctly. Think it was the version just before the latest SDK version that worked correctly.

virtuald commented 6 years ago

I was able to build in Windows 7 with the Visual Studio 2015 build tools, with default settings.

JaciBrunning commented 6 years ago

Gradle discovers the directory for VS based on the installation of vswhere with VS2017, since Gradle 4.4. That may be pointing to the wrong location. Can you run vswhere manually?

duane701 commented 6 years ago

After only installing the community version

C:\workspace2018\Pathfinder>"\Program Files (x86)\Microsoft Visual Studio\Installer\vswhere.exe"
Visual Studio Locator version 2.2.11+gf1a9c6c78d [query version 1.14.192.55101]
Copyright (C) Microsoft Corporation. All rights reserved.

instanceId: a60f67cc
installDate: 2/20/2018 5:19:02 PM
installationName: VisualStudio/15.5.7+27130.2036
installationPath: C:\Program Files (x86)\Microsoft Visual Studio\2017\Community
installationVersion: 15.5.27130.2036
productId: Microsoft.VisualStudio.Product.Community
productPath: C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\IDE\devenv.exe
isPrerelease: 0
displayName: Visual Studio Community 2017
description: Free, fully-featured IDE for students, open-source and individual developers
channelId: VisualStudio.15.Release
channelPath: C:\Users\VandenRobotics\AppData\Local\Microsoft\VisualStudio\Packages\_Channels\4CB340F5\catalog.json
channelUri: https://aka.ms/vs/15/release/channel
enginePath: C:\Program Files (x86)\Microsoft Visual Studio\Installer\resources\app\ServiceHub\Services\Microsoft.VisualStudio.Setup.Service
releaseNotes: https://go.microsoft.com/fwlink/?LinkId=660692#15.5.7
temporaryCache: C:\Users\VandenRobotics\AppData\Local\Temp\as3imrly
thirdPartyNotices: https://go.microsoft.com/fwlink/?LinkId=660708
catalog_buildBranch: d15svc
catalog_buildVersion: 15.5.27130.2036
catalog_id: VisualStudio/15.5.7+27130.2036
catalog_localBuild: build-lab
catalog_manifestName: VisualStudio
catalog_manifestType: installer
catalog_productDisplayVersion: 15.5.7
catalog_productLine: Dev15
catalog_productLineVersion: 2017
catalog_productMilestone: RTW
catalog_productMilestoneIsPreRelease: False
catalog_productName: Visual Studio
catalog_productPatchVersion: 7
catalog_productPreReleaseMilestoneSuffix: 0.0
catalog_productRelease: RTW
catalog_productSemanticVersion: 15.5.7+27130.2036
properties_campaignId: 1221852542.1518221442
properties_channelManifestId: VisualStudio.15.Release/15.5.7+27130.2036
properties_nickname: 2
properties_setupEngineFilePath: C:\Program Files (x86)\Microsoft Visual Studio\Installer\vs_installershell.exe
duane701 commented 6 years ago

I tried on another computer (control variables) with the same result. Following @dkt01, I installed the additional SDKs one at a time. The requirement appears to be "Windows 10 SDK (10.0.14393.0)" in order get linking to work correctly.

Now that the library is compiled, I'll see if I can run the app.

duane701 commented 6 years ago

My app compiled and executed. Closing this issue.

JaciBrunning commented 6 years ago

Thanks for looking into it, it's a particularly hard issue to reproduce. Glad you found the dep required