Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[soci] Fix usage #34436

Merged
merged 2 commits into from
Oct 13, 2023
Merged

[soci] Fix usage #34436

merged 2 commits into from
Oct 13, 2023

Conversation

dg0yt
Copy link
Contributor

@dg0yt dg0yt commented Oct 12, 2023

Fixes #34327 (comment).

CC @baziorek

Now (Edit: SOCI!)

soci provides CMake targets:

    find_package(SOCI CONFIG REQUIRED)
    # Using core (loading backends at runtime)
    target_link_libraries(main PRIVATE $<IF:$<TARGET_EXISTS:SOCI::soci_core>,SOCI::soci_core,SOCI::soci_core_static>)

This static build doesn't include any soci backend and may not be useful.

or e.g.

soci provides CMake targets:

    find_package(SOCI CONFIG REQUIRED)
    # Using core (loading backends at runtime)
    target_link_libraries(main PRIVATE $<IF:$<TARGET_EXISTS:SOCI::soci_core>,SOCI::soci_core,SOCI::soci_core_static>)

    # Using the mysql backend directly
    target_link_libraries(main PRIVATE $<IF:$<TARGET_EXISTS:SOCI::soci_mysql>,SOCI::soci_mysql,SOCI::soci_mysql_static>)

    # Using the sqlite3 backend directly
    target_link_libraries(main PRIVATE $<IF:$<TARGET_EXISTS:SOCI::soci_sqlite3>,SOCI::soci_sqlite3,SOCI::soci_sqlite3_static>)

@JonLiu1993 JonLiu1993 self-assigned this Oct 12, 2023
@JonLiu1993 JonLiu1993 added the category:port-bug The issue is with a library, which is something the port should already support label Oct 12, 2023
@baziorek
Copy link

baziorek commented Oct 12, 2023

@dg0yt I think it is not working (not configuring with CMake). I tried commands:

     apt-get update && apt-get upgrade -y --no-install-recommends
     apt-get install g++ git cmake curl zip unzip tar ca-certificates make pkg-config --no-install-recommends  -y
    git clone https://github.com/dg0yt/vcpkg.git -b soci --depth=1
    ./vcpkg/bootstrap-vcpkg.sh
    ./vcpkg/vcpkg install 'soci[sqlite3]'
soci provides CMake targets:

    find_package(soci CONFIG REQUIRED)
    # Using core (loading backends at runtime)
    target_link_libraries(main PRIVATE $<IF:$<TARGET_EXISTS:SOCI::soci_core>,SOCI::soci_core,SOCI::soci_core_static>)

    # Using the sqlite3 backend directly
    target_link_libraries(main PRIVATE $<IF:$<TARGET_EXISTS:SOCI::soci_sqlite3>,SOCI::soci_sqlite3,SOCI::soci_sqlite3_static>)


    ./vcpkg/vcpkg integrate install
CMake projects should use: "-DCMAKE_TOOLCHAIN_FILE=/home/vcpkg/scripts/buildsystems/vcpkg.cmake"
   cmake . -DCMAKE_TOOLCHAIN_FILE=/home/vcpkg/scripts/buildsystems/vcpkg.cmake

And errors are like that:

cmake . -DCMAKE_TOOLCHAIN_FILE=/home/vcpkg/scripts/buildsystems/vcpkg.cmake
-- The CXX compiler identification is GNU 11.4.0
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
CMake Error at vcpkg/scripts/buildsystems/vcpkg.cmake:859 (_find_package):
  Could not find a package configuration file provided by "soci" with any of
  the following names:

    sociConfig.cmake
    soci-config.cmake

  Add the installation prefix of "soci" to CMAKE_PREFIX_PATH or set
  "soci_DIR" to a directory containing one of the above files.  If "soci"
  provides a separate development package or SDK, be sure it has been
  installed.
Call Stack (most recent call first):
  CMakeLists.txt:15 (find_package)


-- Configuring incomplete, errors occurred!
See also "/home/CMakeFiles/CMakeOutput.log".

my CMakeLists.txt:

cmake_minimum_required(VERSION 3.16)
project(Learning_VCPKG LANGUAGES CXX)

find_package(soci CONFIG REQUIRED)

add_executable(${PROJECT_NAME} main.cpp)

# Using core (loading backends at runtime)
target_link_libraries(${PROJECT_NAME} PRIVATE $<IF:$<TARGET_EXISTS:SOCI::soci_core>,SOCI::soci_core,SOCI::soci_core_static>)

# Using the sqlite3 backend directly
target_link_libraries(${PROJECT_NAME} PRIVATE $<IF:$<TARGET_EXISTS:SOCI::soci_sqlite3>,SOCI::soci_sqlite3,SOCI::soci_sqlite3_static>)

C++ file the same as here

@dg0yt
Copy link
Contributor Author

dg0yt commented Oct 12, 2023

Great testing and feedback 👍
I realized that we lost the proper case which is find_package(SOCI ...).

@baziorek
Copy link

baziorek commented Oct 13, 2023

After corrections in the commit: 6d398f3
it works with commands provided in my previous message (#34436 (comment)) and:

make && ./Learning_VCPKG

APPROVE from me:)


EDIT: Just to make sure I checked if sqlite3 is working with boost and it is also working, commands the same as above with difference:

./vcpkg/vcpkg install 'soci[sqlite3,boost]' --recurse

Code with boost from one of my previous posts (#34168 (comment)).
APPROVE v2:)

@JonLiu1993 JonLiu1993 added the info:reviewed Pull Request changes follow basic guidelines label Oct 13, 2023
@BillyONeal
Copy link
Member

@dg0yt Thanks for the fix!
@baziorek Thanks for the review and testing!

@BillyONeal BillyONeal merged commit 7973b37 into microsoft:master Oct 13, 2023
15 checks passed
@dg0yt dg0yt deleted the soci branch October 13, 2023 18:07
clementperon pushed a commit to clementperon/vcpkg that referenced this pull request Oct 16, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
category:port-bug The issue is with a library, which is something the port should already support info:reviewed Pull Request changes follow basic guidelines
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants