Skip to content

Compiling on Windows (MSVC) results in invalid pkg-config files #1658

Closed
@btgoodwin

Description

@btgoodwin

Confirm by changing [ ] to [x] below to ensure that it's a bug:

Describe the bug

The cmake/platform/windows.cmake:15 sets CMAKE_RUNTIME_OUTPUT_DIRECTORY to the ${CMAKE_CURRENT_BINARY_DIR}/bin with the comment that it's to collect the runtime outputs including dlls into one directory to avoid copying them when using MSVC. The toolchains/pkg-config.pc.in template configures the Libs to point at libdir, which is set to @CMAKE_INSTALL_PREFIX@/@LIBRARY_DIRECTORY@. When a downstream project attempts to use pkg-config to locate the libraries, they're not found because the package config file says to look in lib but the libraries are actually in bin.

SDK version number

1.9.24 (main branch, hash 9be7f32)

Platform/OS/Hardware/Device

Windows 10

To Reproduce (observed behavior)

git clone --recursive https://github.com/aws/aws-sdk-cpp
cd aws-sdk-cpp
cmake  -B build -DCMAKE_INSTALL_PREFIX:PATH=C:/aws-cpp-sdk-all -DCMAKE_BUILD_TYPE=Debug -DENABLE_TESTING=false
cmake --build build -j --config Debug
cmake --install build --config Debug

Then checking pkg-config (provided by gstreamer in my case):

> set PKG_CONFIG_PATH=c:\aws-cpp-sdk-all\lib\pkgconfig
> pkg-config --msvc-syntax --libs aws-cpp-sdk-sts
/libpath:C:/aws-cpp-sdk-all/lib aws-cpp-sdk-sts.lib aws-cpp-sdk-core.lib

If we check that path, we find neither of those .lib files:

> dir c:\aws-cpp-sdk-all\lib
 Volume in drive C is OSDisk
 Volume Serial Number is ABCD-EFGH

 Directory of c:\aws-cpp-sdk-all\lib

05/25/2021  08:42 AM    <DIR>          .
05/25/2021  08:42 AM    <DIR>          ..
05/25/2021  08:42 AM    <DIR>          aws-c-auth
05/25/2021  08:25 AM            34,288 aws-c-auth.lib
05/25/2021  08:42 AM    <DIR>          aws-c-cal
05/25/2021  08:25 AM            15,808 aws-c-cal.lib
05/25/2021  08:42 AM    <DIR>          aws-c-common
05/25/2021  08:25 AM           133,838 aws-c-common.lib
05/25/2021  08:42 AM    <DIR>          aws-c-compression
05/25/2021  08:25 AM             4,366 aws-c-compression.lib
05/25/2021  08:42 AM    <DIR>          aws-c-event-stream
05/25/2021  08:25 AM            29,080 aws-c-event-stream.lib
05/25/2021  08:42 AM    <DIR>          aws-c-http
05/25/2021  08:25 AM            67,200 aws-c-http.lib
05/25/2021  08:42 AM    <DIR>          aws-c-io
05/25/2021  08:25 AM            62,826 aws-c-io.lib
05/25/2021  08:42 AM    <DIR>          aws-c-mqtt
05/25/2021  08:25 AM            27,654 aws-c-mqtt.lib
05/25/2021  08:42 AM    <DIR>          aws-c-s3
05/25/2021  08:25 AM            26,280 aws-c-s3.lib
05/25/2021  08:42 AM    <DIR>          aws-checksums
05/25/2021  08:25 AM             3,114 aws-checksums.lib
05/25/2021  08:42 AM    <DIR>          aws-crt-cpp
05/25/2021  08:25 AM           373,552 aws-crt-cpp.lib
05/25/2021  08:49 AM    <DIR>          cmake
05/25/2021  08:49 AM    <DIR>          pkgconfig
              11 File(s)        778,006 bytes
              15 Dir(s)  670,642,892,800 bytes free

Instead, each are over in c:\aws-cpp-sdk-all\bin. This results in linker errors related to apparently-missing files as seen here.

Expected behavior

The generated package config files should match the installation environment. In this case, either install the libraries into lib or generate a package config with flags pointed to bin, where the files are actually installed.

Logs/output

See above.

Additional context
Add any other context about the problem here.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions