Skip to content
This repository was archived by the owner on Aug 16, 2023. It is now read-only.

Find libraries after building with multi-configuration CMake generator #185

@dancsi

Description

@dancsi

I am trying to build CxxWrap using Visual Studio 2019. I am following the instructions from their README and everything goes more or less smoothly:

mkdir libcxxwrap-julia-build
cd libcxxwrap-julia-build
cmake -DJulia_PREFIX=C:\Dev\Julia -DJulia_EXECUTABLE=julia ..\libcxxwrap-julia
cmake --build . --config Release

I can verify that the resulting DLLs have been placed under libcxxwrap-julia-build/bin/Release. The CMAKE_RUNTIME_OUTPUT_DIRECTORY was just libcxxwrap-julia-build/bin/, but the CMake docs state that multi-config generators such as Visual Studio and Xcode create a separate subdirectory for each config (ie Debug or Release).

The problem occurs when I try to rebuild CxxWrap to use the binaries I just built:

julia> ENV["JLCXX_DIR"] = "C:\\Dev\\projects\\CxxWrap.jl\\libcxxwrap-julia-build"
"C:\\Dev\\projects\\CxxWrap.jl\\libcxxwrap-julia-build"

(v1.1) pkg> build CxxWrap
  Building CxxWrap → `C:\Users\danie\.julia\packages\CxxWrap\sarOk\deps\build.log`
┌ Error: Error building `CxxWrap`:
│ ┌ Warning: On Windows, creating file symlinks requires Administrator privileges
│ └ @ Base.Filesystem file.jl:794
│ ERROR: LoadError: The libcxxwrap-julia library was not found in the provided JLCXX_DIR directory C:\Dev\projects\CxxWrap.jl\libcxxwrap-julia-build
│ Stacktrace:
│  [1] error(::String) at .\error.jl:33
│  [2] top-level scope at C:\Users\danie\.julia\packages\CxxWrap\sarOk\deps\build.jl:50
│  [3] include at .\boot.jl:326 [inlined]
│  [4] include_relative(::Module, ::String) at .\loading.jl:1038
│  [5] include(::Module, ::String) at .\sysimg.jl:29
│  [6] include(::String) at .\client.jl:403
│  [7] top-level scope at none:0
│ in expression starting at C:\Users\danie\.julia\packages\CxxWrap\sarOk\deps\build.jl:31
└ @ Pkg.Operations C:\cygwin\home\Administrator\buildbot\worker\package_win64\build\usr\share\julia\stdlib\v1.1\Pkg\src\Operations.jl:1075

From what I understood, the problem happens because the LibraryProduct doesn't specify its dir_path, so the dir_path filled by BinaryProvider is just libcxxwrap-julia-build/bin/, and thus the library search fails.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions