bscarlet / llvm-general

Rich LLVM bindings for Haskell (with transfer of LLVM IR to and from C++, detailed compilation pass control, etc.)
http://hackage.haskell.org/package/llvm-general
132 stars 38 forks source link

Install on Windows: Missing dependencies on foreign libraries #156

Closed coder-mike closed 8 years ago

coder-mike commented 8 years ago

When I try to install llvm-general 3.6.0.0 in Windows, I get the error "Missing dependencies on foreign libraries", as seen below:

$ cabal install ./llvm-general
Resolving dependencies...
Configuring llvm-general-3.6.0.0...
Failed to install llvm-general-3.6.0.0
Build log ( C:\Users\elecm.DESKTOP-JQGRHSF\AppData\Roaming\cabal\logs\llvm-general-3.6.0.0.log ):
Configuring llvm-general-3.6.0.0...
setup.exe: Missing dependencies on foreign libraries:
* Missing C libraries: LLVMOption, LLVMIRReader, LLVMAsmParser, gtest_main,
gtest, LLVMInterpreter, LLVMXCoreDisassembler, LLVMXCoreCodeGen,
LLVMXCoreDesc, LLVMXCoreInfo, LLVMXCoreAsmPrinter, LLVMSystemZDisassembler,
LLVMSystemZCodeGen, LLVMSystemZAsmParser, LLVMSystemZDesc, LLVMSystemZInfo,
LLVMSystemZAsmPrinter, LLVMSparcDisassembler, LLVMSparcCodeGen,
LLVMSparcAsmParser, LLVMSparcDesc, LLVMSparcInfo, LLVMSparcAsmPrinter,
LLVMR600CodeGen, LLVMR600AsmParser, LLVMR600Desc, LLVMR600Info,
LLVMR600AsmPrinter, LLVMPowerPCDisassembler, LLVMPowerPCCodeGen,
LLVMPowerPCAsmParser, LLVMPowerPCDesc, LLVMPowerPCInfo, LLVMPowerPCAsmPrinter,
LLVMNVPTXCodeGen, LLVMNVPTXDesc, LLVMNVPTXInfo, LLVMNVPTXAsmPrinter,
LLVMMSP430CodeGen, LLVMMSP430Desc, LLVMMSP430Info, LLVMMSP430AsmPrinter,
LLVMMipsDisassembler, LLVMMipsCodeGen, LLVMMipsAsmParser, LLVMMipsDesc,
LLVMMipsInfo, LLVMMipsAsmPrinter, LLVMHexagonDisassembler, LLVMHexagonCodeGen,
LLVMHexagonDesc, LLVMHexagonInfo, LLVMCppBackendCodeGen, LLVMCppBackendInfo,
LLVMARMDisassembler, LLVMARMCodeGen, LLVMARMAsmParser, LLVMARMDesc,
LLVMARMInfo, LLVMARMAsmPrinter, LLVMAArch64Disassembler, LLVMAArch64CodeGen,
LLVMAArch64AsmParser, LLVMAArch64Desc, LLVMAArch64Info, LLVMAArch64AsmPrinter,
LLVMAArch64Utils, LLVMTableGen, LLVMX86Disassembler, LLVMX86AsmParser,
LLVMMCJIT, LLVMExecutionEngine, LLVMRuntimeDyld, LLVMInstrumentation,
LLVMX86CodeGen, LLVMX86Desc, LLVMX86Info, LLVMMCDisassembler,
LLVMX86AsmPrinter, LLVMX86Utils, LLVMSelectionDAG, LLVMAsmPrinter, LLVMLTO,
LLVMCodeGen, LLVMObjCARCOpts, LLVMLinker, LLVMipo, LLVMVectorize,
LLVMScalarOpts, LLVMProfileData, LLVMInstCombine, LLVMTransformUtils, LLVMipa,
LLVMAnalysis, LLVMTarget, LLVMBitWriter, LLVMDebugInfo, LLVMObject,
LLVMMCParser, LLVMMC, LLVMBitReader, LLVMCore, LLVMLineEditor, LLVMSupport,
tinfo
This problem can usually be solved by installing the system packages that
provide these libraries (you may need the "-dev" versions). If the libraries
are already installed but in a non-standard location then you can use the
flags --extra-include-dirs= and --extra-lib-dirs= to specify where they are.
cabal.exe: Error: some packages failed to install:
llvm-general-3.6.0.0 failed during the configure step. The exception was:
ExitFailure 1

(this is after building LLVM using MinGW, and adding the LLVM bin directory to my PATH)

The libraries that it lists as missing are present on my system, for example this is where the LLVMAsmParser file that it lists above is:

C:\LLVM-3.6\llvm-3.6.2.cmake.gcc\lib\libLLVMAsmParser.a

The LLVM bin directory is in my PATH, and invoking llvm-config --libdir yields the correct path to these libraries (I state this because I think that setup.hs seems to use this information to find the libraries):

$ llvm-config --libdir
C:/LLVM-3.6/llvm-3.6.2.cmake.gcc//lib

I've tried a number of solutions, but for the most part they give the same error.

I've tried to add the extra-include-dirs options, as per issue 76:

$ cabal install ./llvm-general --extra-include-dirs=C:/LLVM-3.6/llvm-3.6.2.cmake.gcc/include --extra-include-dirs=C:/LLVM-3.6/llvm-3.6.2.cmake.gcc/lib 
...
(same error)

I also tried to execute mingw32-make install first, as per the same issue.

I also tried adding --extra-lib-dirs=C:/LLVM-3.6/llvm-3.6.2.cmake.gcc/lib, as instructed by the error message itself.

I also tried defining environment variables C_INCLUDE_PATH and LIBRARY_PATH to new directories, as per here, and copying the libs and includes into those directories.

I've also tried manually editing the cabal file to add extra include-dirs and extra-lib-dirs, as listed in the Cabal FAQ in the section about build errors in Windows. The addition to the cabal file looks like this:

...
include-dirs: src
include-dirs: C:/LLVM-3.6/llvm-3.6.2.src/include
include-dirs: C:/LLVM-3.6/llvm-3.6.2.cmake.gcc/include

extra-lib-dirs: C:/LLVM-3.6/llvm-3.6.2.cmake.gcc/lib
...

(and I tried a few variations such as using double-backslash instead of forward slash, using quotes, and grouping all three include-dirs into one section with indentation).

In the above attempts, I was trying to install llvm-general from code downloaded directly from the llvm-general git repository. But I've also tried to install it from Hackage by just issuing the command cabal install llvm-general, including llvm-general versions 3.4.5.4 and 3.5.1.0, with corresponding LLVM versions 3.4 and 3.5.2 respectively.

I've built LLVM 3.6.2 (and the other versions) using cmake and MinGW (GCC 4.8.1) - and I adjust the PATH each time I changed to try a different version. By default LLVM seems to build the static libraries and executables, and it seems to me that by default llvm-general will use statically-linked libraries as well, which is ideal for me. (I did also start down the road of trying to build a shared LLVM library, but the build wasn't successful anyway).

I also tried with a build of LLVM using Visual Studio 2015. The build went fine, but outputs slightly different static library files, such as "LLVMAsmParser.lib" instead of "libLLVMAsmParser.a". I can't find any documentation that states which form I actually need. But nevertheless neither has worked so far.

I apologize if I'm missing something obvious, since I'm new to both Haskell and LLVM, and this is my first Haskell project. I've been struggling to solve this problem for 3 weeks now, and am looking forward to any possible direction.

bscarlet commented 8 years ago

Please use the llvm-3.5 branch of llvm-general, as the 3.6 support on the master branch is not yet complete.

Please do both build and install LLVM 3.5, point your path at the resulting installed llvm-config, and try a build.

Please remove all build artifacts between attempts.

Let me know the result from that specific attempt.

coder-mike commented 8 years ago

I'm still not having success.

I did a fresh clone of llvm-general, and then git checkout llvm-3.5. I did a mingw32-make and mingw32-make install of llvm 3.5.2, and I added the bin output to PATH.

$ cabal install ./llvm-general --extra-include-dirs=C:/LLVM-3.5/llvm-3.5.2.src/include --extra-include-dirs=C:/LLVM-3.5/llvm-3.5.2.cmake/include --extra-lib-dirs=C:/LLVM-3.5/llvm-3.5.2.cmake/lib
Resolving dependencies...
Configuring llvm-general-3.5.1.0...
Failed to install llvm-general-3.5.1.0
Build log ( C:\Users\elecm.DESKTOP-JQGRHSF\AppData\Roaming\cabal\logs\llvm-general-3.5.1.0.log ):
[1 of 1] Compiling Main             ( llvm-general\dist\setup\setup.hs, llvm-general\dist\setup\Main.o )
Linking ./llvm-general\dist\setup\setup.exe ...
Configuring llvm-general-3.5.1.0...
setup.exe: Missing dependencies on foreign libraries:
* Missing C libraries: LLVMJIT, LLVMInterpreter, LLVMXCoreDisassembler,
LLVMXCoreCodeGen, LLVMXCoreDesc, LLVMXCoreInfo, LLVMXCoreAsmPrinter,
LLVMX86Disassembler, LLVMX86AsmParser, LLVMSystemZDisassembler,
LLVMSystemZCodeGen, LLVMSystemZAsmParser, LLVMSystemZDesc, LLVMSystemZInfo,
LLVMSystemZAsmPrinter, LLVMSparcDisassembler, LLVMSparcCodeGen,
LLVMSparcAsmParser, LLVMSparcDesc, LLVMSparcInfo, LLVMSparcAsmPrinter,
LLVMR600CodeGen, LLVMR600Desc, LLVMR600Info, LLVMR600AsmPrinter,
LLVMPowerPCDisassembler, LLVMPowerPCCodeGen, LLVMPowerPCAsmParser,
LLVMPowerPCDesc, LLVMPowerPCInfo, LLVMPowerPCAsmPrinter, LLVMNVPTXCodeGen,
LLVMNVPTXDesc, LLVMNVPTXInfo, LLVMNVPTXAsmPrinter, LLVMMSP430CodeGen,
LLVMMSP430Desc, LLVMMSP430Info, LLVMMSP430AsmPrinter, LLVMMipsDisassembler,
LLVMMipsCodeGen, LLVMMipsAsmParser, LLVMMipsDesc, LLVMMipsInfo,
LLVMMipsAsmPrinter, LLVMHexagonCodeGen, LLVMHexagonAsmPrinter,
LLVMHexagonDesc, LLVMHexagonInfo, LLVMCppBackendCodeGen, LLVMCppBackendInfo,
LLVMARMDisassembler, LLVMARMCodeGen, LLVMARMAsmParser, LLVMARMDesc,
LLVMARMInfo, LLVMARMAsmPrinter, LLVMAArch64Disassembler, LLVMAArch64CodeGen,
LLVMAArch64AsmParser, LLVMAArch64Desc, LLVMAArch64Info, LLVMAArch64AsmPrinter,
LLVMAArch64Utils, LLVMLineEditor, LLVMDebugInfo, gtest_main, gtest,
LLVMInstrumentation, LLVMProfileData, LLVMLTO, LLVMObjCARCOpts, LLVMLinker,
LLVMipo, LLVMVectorize, LLVMBitWriter, LLVMMCDisassembler, LLVMMCJIT,
LLVMRuntimeDyld, LLVMExecutionEngine, LLVMIRReader, LLVMAsmParser,
LLVMMCAnalysis, LLVMOption, LLVMX86CodeGen, LLVMX86Desc, LLVMX86Info,
LLVMObject, LLVMBitReader, LLVMX86AsmPrinter, LLVMX86Utils, LLVMSelectionDAG,
LLVMAsmPrinter, LLVMMCParser, LLVMCodeGen, LLVMScalarOpts, LLVMInstCombine,
LLVMTransformUtils, LLVMipa, LLVMAnalysis, LLVMTarget, LLVMMC, LLVMCore,
LLVMTableGen, LLVMSupport
This problem can usually be solved by installing the system packages that
provide these libraries (you may need the "-dev" versions). If the libraries
are already installed but in a non-standard location then you can use the
flags --extra-include-dirs= and --extra-lib-dirs= to specify where they are.
cabal.exe: Error: some packages failed to install:
llvm-general-3.5.1.0 failed during the configure step. The exception was:
ExitFailure 1

(I tried with and without the extra-includes)

I notice that it says llvm-general-3.5.1.0, but I'm using LLVM 3.5.2. Will this make a difference?

bscarlet commented 8 years ago

With the hope that the LLVM API doesn't change between point releases, I tie llvm-general versions to LLVM versions only with the first two components. Of 3.5.1.0, the 1.0 are my versions (the major component for my API versions and the minor for internal-only changes (e.g. bug fixes), and the 3.5 indicates it ought to work with any LLVM 3.5.x.

coder-mike commented 8 years ago

I've confirmed that I get the same error with llvm-general 3.5.1.0, using LLVM 3.5.2. Do you have any ideas that might help me diagnose this issue?

To reiterate, I used MinGW, successfully built and installed LLVM from source, and added the resulting bin to the PATH. I'm working with a clean (freshly cloned) llvm-general directly from git, and working in the llvm-3.5 branch of llvm-general.

$ cabal install ./llvm-general --extra-include-dirs=C:/LLVM-3.5/llvm-3.5.git.src/include --extra-include-dirs=C:/LLVM-3.5/llvm-3.5.git.cmake/include --extra-lib-dirs=C:/LLVM-3.5/llvm-3.5.git.cmake/lib
Resolving dependencies...
Configuring llvm-general-3.5.1.0...
Failed to install llvm-general-3.5.1.0
Build log ( C:\Users\elecm.DESKTOP-JQGRHSF\AppData\Roaming\cabal\logs\llvm-general-3.5.1.0.log ):
[1 of 1] Compiling Main             ( llvm-general\dist\setup\setup.hs, llvm-general\dist\setup\Main.o )
Linking ./llvm-general\dist\setup\setup.exe ...
Configuring llvm-general-3.5.1.0...
setup.exe: Missing dependencies on foreign libraries:
* Missing C libraries: LLVMMCJIT, LLVMRuntimeDyld, LLVMMCDisassembler,
LLVMProfileData, LLVMJIT, LLVMDebugInfo, LLVMLTO, LLVMObjCARCOpts, LLVMLinker,
LLVMipo, LLVMVectorize, LLVMBitWriter, LLVMMCAnalysis, LLVMTableGen,
LLVMInterpreter, LLVMExecutionEngine, LLVMIRReader, LLVMAsmParser,
LLVMInstrumentation, LLVMLineEditor, gtest_main, gtest, LLVMOption,
LLVMXCoreDisassembler, LLVMXCoreCodeGen, LLVMXCoreDesc, LLVMXCoreInfo,
LLVMXCoreAsmPrinter, LLVMX86Disassembler, LLVMX86AsmParser, LLVMX86CodeGen,
LLVMX86Desc, LLVMObject, LLVMBitReader, LLVMX86Info, LLVMX86AsmPrinter,
LLVMX86Utils, LLVMSystemZDisassembler, LLVMSystemZCodeGen,
LLVMSystemZAsmParser, LLVMSystemZDesc, LLVMSystemZInfo, LLVMSystemZAsmPrinter,
LLVMSparcDisassembler, LLVMSparcCodeGen, LLVMSparcAsmParser, LLVMSparcDesc,
LLVMSparcInfo, LLVMSparcAsmPrinter, LLVMR600CodeGen, LLVMR600Desc,
LLVMR600Info, LLVMR600AsmPrinter, LLVMPowerPCDisassembler, LLVMPowerPCCodeGen,
LLVMPowerPCAsmParser, LLVMPowerPCDesc, LLVMPowerPCInfo, LLVMPowerPCAsmPrinter,
LLVMNVPTXCodeGen, LLVMNVPTXDesc, LLVMNVPTXInfo, LLVMNVPTXAsmPrinter,
LLVMMSP430CodeGen, LLVMMSP430Desc, LLVMMSP430Info, LLVMMSP430AsmPrinter,
LLVMMipsDisassembler, LLVMMipsCodeGen, LLVMMipsAsmParser, LLVMMipsDesc,
LLVMMipsInfo, LLVMMipsAsmPrinter, LLVMHexagonCodeGen, LLVMHexagonAsmPrinter,
LLVMHexagonDesc, LLVMHexagonInfo, LLVMCppBackendCodeGen, LLVMCppBackendInfo,
LLVMARMDisassembler, LLVMARMCodeGen, LLVMARMAsmParser, LLVMARMDesc,
LLVMARMInfo, LLVMARMAsmPrinter, LLVMAArch64Disassembler, LLVMAArch64CodeGen,
LLVMSelectionDAG, LLVMAsmPrinter, LLVMCodeGen, LLVMScalarOpts,
LLVMInstCombine, LLVMTransformUtils, LLVMipa, LLVMAnalysis, LLVMTarget,
LLVMCore, LLVMAArch64AsmParser, LLVMMCParser, LLVMAArch64Desc,
LLVMAArch64Info, LLVMAArch64AsmPrinter, LLVMMC, LLVMAArch64Utils, LLVMSupport
This problem can usually be solved by installing the system packages that
provide these libraries (you may need the "-dev" versions). If the libraries
are already installed but in a non-standard location then you can use the
flags --extra-include-dirs= and --extra-lib-dirs= to specify where they are.
cabal.exe: Error: some packages failed to install:
llvm-general-3.5.1.0 failed during the configure step. The exception was:
ExitFailure 1
bscarlet commented 8 years ago

That error message comes from cabal, which is checking during the configure step that the libraries it believes the linker will eventually need are indeed present. The list of libraries looks sensible for a build against static LLVM. Most likely, either: 1) the libraries aren't where they should be 2) the names aren't in the right format 3) cabal isn't looking in the right place

Since this process works fine on linux, whichever of those three were happening would likely be because of some peculiarity of the windows environment - e.g. the difference you note between the Visual Studio build and the mingw build, with the presence of the "lib" prefix changing.

So: Into what directory did you install LLVM? You seem to be passing a scattershot set of both build and install directories to cabal. What version of llvm-config is on your path, so it's found by Setup.hs ? What does it emit when you run llvm-config --libdir ? What is in that directory? What does it emit when you run llvm-config --libs ?

coder-mike commented 8 years ago

LLVM seems to install into C:\Program Files (x86)\LLVM. The directories I pointed it to are in the build directory, which in the latest case is C:\LLVM-3.5\llvm-3.5.git.cmake. I also added the include directory from the original source directory C:\LLVM-3.5\llvm-3.5.git.src. The "scattershot" is because I saw on a forum somewhere that somebody else specified both the source and the build directories and had it work. Note that I've also tried pointing everything to the install directory, with exactly the same effect.

At the moment, the version of llvm-config in my PATH is 3.5.2svn.

$ llvm-config --version
3.5.2svn

This is the latest version on the release_35 branch of the LLVM git repo.

To your last 3 questions, at the moment:

$ llvm-config --libdir
C:\Program Files (x86)\LLVM/lib

$ ls "`llvm-config --libdir`"
libgtest.a                    libLLVMARMCodeGen.a         libLLVMDebugInfo.a          libLLVMJIT.a             libLLVMMipsDisassembler.a  libLLVMOption.a               libLLVMRuntimeDyld.a        libLLVMSystemZCodeGen.a       libLLVMX86Disassembler.a
libgtest_main.a               libLLVMARMDesc.a            libLLVMExecutionEngine.a    libLLVMLineEditor.a      libLLVMMipsInfo.a          libLLVMPowerPCAsmParser.a     libLLVMScalarOpts.a         libLLVMSystemZDesc.a          libLLVMX86Info.a
libLLVMAArch64AsmParser.a     libLLVMARMDisassembler.a    libLLVMHexagonAsmPrinter.a  libLLVMLinker.a          libLLVMMSP430AsmPrinter.a  libLLVMPowerPCAsmPrinter.a    libLLVMSelectionDAG.a       libLLVMSystemZDisassembler.a  libLLVMX86Utils.a
libLLVMAArch64AsmPrinter.a    libLLVMARMInfo.a            libLLVMHexagonCodeGen.a     libLLVMLTO.a             libLLVMMSP430CodeGen.a     libLLVMPowerPCCodeGen.a       libLLVMSparcAsmParser.a     libLLVMSystemZInfo.a          libLLVMXCoreAsmPrinter.a
libLLVMAArch64CodeGen.a       libLLVMAsmParser.a          libLLVMHexagonDesc.a        libLLVMMC.a              libLLVMMSP430Desc.a        libLLVMPowerPCDesc.a          libLLVMSparcAsmPrinter.a    libLLVMTableGen.a             libLLVMXCoreCodeGen.a
libLLVMAArch64Desc.a          libLLVMAsmPrinter.a         libLLVMHexagonInfo.a        libLLVMMCAnalysis.a      libLLVMMSP430Info.a        libLLVMPowerPCDisassembler.a  libLLVMSparcCodeGen.a       libLLVMTarget.a               libLLVMXCoreDesc.a
libLLVMAArch64Disassembler.a  libLLVMBitReader.a          libLLVMInstCombine.a        libLLVMMCDisassembler.a  libLLVMNVPTXAsmPrinter.a   libLLVMPowerPCInfo.a          libLLVMSparcDesc.a          libLLVMTransformUtils.a       libLLVMXCoreDisassembler.a
libLLVMAArch64Info.a          libLLVMBitWriter.a          libLLVMInstrumentation.a    libLLVMMCParser.a        libLLVMNVPTXCodeGen.a      libLLVMProfileData.a          libLLVMSparcDisassembler.a  libLLVMVectorize.a            libLLVMXCoreInfo.a
libLLVMAArch64Utils.a         libLLVMCodeGen.a            libLLVMInterpreter.a        libLLVMMipsAsmParser.a   libLLVMNVPTXDesc.a         libLLVMR600AsmPrinter.a       libLLVMSparcInfo.a          libLLVMX86AsmParser.a         libLTO.dll.a
libLLVMAnalysis.a             libLLVMCore.a               libLLVMipa.a                libLLVMMipsAsmPrinter.a  libLLVMNVPTXInfo.a         libLLVMR600CodeGen.a          libLLVMSupport.a            libLLVMX86AsmPrinter.a        LLVMMCJIT.a
libLLVMARMAsmParser.a         libLLVMCppBackendCodeGen.a  libLLVMipo.a                libLLVMMipsCodeGen.a     libLLVMObjCARCOpts.a       libLLVMR600Desc.a             libLLVMSystemZAsmParser.a   libLLVMX86CodeGen.a
libLLVMARMAsmPrinter.a        libLLVMCppBackendInfo.a     libLLVMIRReader.a           libLLVMMipsDesc.a        libLLVMObject.a            libLLVMR600Info.a             libLLVMSystemZAsmPrinter.a  libLLVMX86Desc.a

$ llvm-config --libs
-lLLVMMCJIT -lLLVMRuntimeDyld -lLLVMMCDisassembler -lLLVMProfileData -lLLVMJIT -lLLVMDebugInfo -lLLVMLTO -lLLVMObjCARCOpts -lLLVMLinker -lLLVMipo -lLLVMVectorize -lLLVMBitWriter -lLLVMMCAnalysis -lLLVMTableGen -lLLVMInterpreter -lLLVMExecutionEngine -lLLVMIRReader -lLLVMAsmParser -lLLVMInstrumentation -lLLVMLineEditor -lLLVMOption -lLLVMXCoreDisassembler -lLLVMXCoreCodeGen -lLLVMXCoreDesc -lLLVMXCoreInfo -lLLVMXCoreAsmPrinter -lLLVMX86Disassembler -lLLVMX86AsmParser -lLLVMX86CodeGen -lLLVMX86Desc -lLLVMObject -lLLVMBitReader -lLLVMX86Info -lLLVMX86AsmPrinter -lLLVMX86Utils -lLLVMSystemZDisassembler -lLLVMSystemZCodeGen -lLLVMSystemZAsmParser -lLLVMSystemZDesc -lLLVMSystemZInfo -lLLVMSystemZAsmPrinter -lLLVMSparcDisassembler -lLLVMSparcCodeGen -lLLVMSparcAsmParser -lLLVMSparcDesc -lLLVMSparcInfo -lLLVMSparcAsmPrinter -lLLVMR600CodeGen -lLLVMR600Desc -lLLVMR600Info -lLLVMR600AsmPrinter -lLLVMPowerPCDisassembler -lLLVMPowerPCCodeGen -lLLVMPowerPCAsmParser -lLLVMPowerPCDesc -lLLVMPowerPCInfo -lLLVMPowerPCAsmPrinter -lLLVMNVPTXCodeGen -lLLVMNVPTXDesc -lLLVMNVPTXInfo -lLLVMNVPTXAsmPrinter -lLLVMMSP430CodeGen -lLLVMMSP430Desc -lLLVMMSP430Info -lLLVMMSP430AsmPrinter -lLLVMMipsDisassembler -lLLVMMipsCodeGen -lLLVMMipsAsmParser -lLLVMMipsDesc -lLLVMMipsInfo -lLLVMMipsAsmPrinter -lLLVMHexagonCodeGen -lLLVMHexagonAsmPrinter -lLLVMHexagonDesc -lLLVMHexagonInfo -lLLVMCppBackendCodeGen -lLLVMCppBackendInfo -lLLVMARMDisassembler -lLLVMARMCodeGen -lLLVMARMAsmParser -lLLVMARMDesc -lLLVMARMInfo -lLLVMARMAsmPrinter -lLLVMAArch64Disassembler -lLLVMAArch64CodeGen -lLLVMSelectionDAG -lLLVMAsmPrinter -lLLVMCodeGen -lLLVMScalarOpts -lLLVMInstCombine -lLLVMTransformUtils -lLLVMipa -lLLVMAnalysis -lLLVMTarget -lLLVMCore -lLLVMAArch64AsmParser -lLLVMMCParser -lLLVMAArch64Desc -lLLVMAArch64Info -lLLVMAArch64AsmPrinter -lLLVMMC -lLLVMAArch64Utils -lLLVMSupport

As an experiment, I removed the lib prefix from one of the libraries, but it still lands up being listed as one of the missing dependencies.

bscarlet commented 8 years ago

The next step would be to add code to Setup.hs to print the information extracted from llvm-config, to make sure it's doing what it ought. Under some circumstances, I know the behavior of environment variables (e.g. the path) on process spawning can be surprising on Windows; I don't know about mingw.

If it looks like Setup is putting together reasonable values, then we should talk to the Cabal folks to figure out why their pre-check code can't find the libraries which seem to be present.

coder-mike commented 8 years ago

I'm not very familiar with Cabal (or Haskell), but I've added the following lines to setup.hs, in the confHook before genericPackageDescription:

putStrLn $ "staticLibs: " ++ (intercalate "," staticLibs)
putStrLn $ "libDirs: " ++ (intercalate "," libDirs)

This is the output:

staticLibs: LLVMMCJIT,LLVMRuntimeDyld,LLVMMCDisassembler,LLVMProfileData,LLVMJIT,LLVMDebugInfo,LLVMLTO,LLVMObjCARCOpts,LLVMLinker,LLVMipo,LLVMVectorize,LLVMBitWriter,LLVMMCAnalysis,LLVMTableGen,LLVMInterpreter,LLVMExecutionEngine,LLVMIRReader,LLVMAsmParser,LLVMInstrumentation,LLVMLineEditor,LLVMOption,LLVMXCoreDisassembler,LLVMXCoreCodeGen,LLVMXCoreDesc,LLVMXCoreInfo,LLVMXCoreAsmPrinter,LLVMX86Disassembler,LLVMX86AsmParser,LLVMX86CodeGen,LLVMX86Desc,LLVMObject,LLVMBitReader,LLVMX86Info,LLVMX86AsmPrinter,LLVMX86Utils,LLVMSystemZDisassembler,LLVMSystemZCodeGen,LLVMSystemZAsmParser,LLVMSystemZDesc,LLVMSystemZInfo,LLVMSystemZAsmPrinter,LLVMSparcDisassembler,LLVMSparcCodeGen,LLVMSparcAsmParser,LLVMSparcDesc,LLVMSparcInfo,LLVMSparcAsmPrinter,LLVMR600CodeGen,LLVMR600Desc,LLVMR600Info,LLVMR600AsmPrinter,LLVMPowerPCDisassembler,LLVMPowerPCCodeGen,LLVMPowerPCAsmParser,LLVMPowerPCDesc,LLVMPowerPCInfo,LLVMPowerPCAsmPrinter,LLVMNVPTXCodeGen,LLVMNVPTXDesc,LLVMNVPTXInfo,LLVMNVPTXAsmPrinter,LLVMMSP430CodeGen,LLVMMSP430Desc,LLVMMSP430Info,LLVMMSP430AsmPrinter,LLVMMipsDisassembler,LLVMMipsCodeGen,LLVMMipsAsmParser,LLVMMipsDesc,LLVMMipsInfo,LLVMMipsAsmPrinter,LLVMHexagonCodeGen,LLVMHexagonAsmPrinter,LLVMHexagonDesc,LLVMHexagonInfo,LLVMCppBackendCodeGen,LLVMCppBackendInfo,LLVMARMDisassembler,LLVMARMCodeGen,LLVMARMAsmParser,LLVMARMDesc,LLVMARMInfo,LLVMARMAsmPrinter,LLVMAArch64Disassembler,LLVMAArch64CodeGen,LLVMSelectionDAG,LLVMAsmPrinter,LLVMCodeGen,LLVMScalarOpts,LLVMInstCombine,LLVMTransformUtils,LLVMipa,LLVMAnalysis,LLVMTarget,LLVMCore,LLVMAArch64AsmParser,LLVMMCParser,LLVMAArch64Desc,LLVMAArch64Info,LLVMAArch64AsmPrinter,LLVMMC,LLVMAArch64Utils,LLVMSupport
libDirs: C:\Program Files (x86)\LLVM/lib

I think I've also confirmed that the back-slashes are not the issue, by manually just setting the libDir and libDirs variables to the forward-slash-only versions, and it seems to do the same thing.

Are there any other variables we should look at?

bscarlet commented 8 years ago

No, I think you've got a good case to bring to the Cabal folks now.

bscarlet commented 8 years ago

Given your evidence in that bug that the problem is not specific to llvm-general, I'm going to close this bug. Please re-open it as necessary.