Skip to content

Commit

Permalink
Dev fix failing odbc build (#27)
Browse files Browse the repository at this point in the history
* As part of SQL repo split - ODBC was missing the 2.X branch
This cherry-picking if intended to sync the ODBC new repo to the existing 2.X state of the unified SQL repo

see :: Update MacOS Version for ODBC Driver #987

Origin PR:  opensearch-project/sql#987
Done by:   https://github.com/forestmvey

Signed-off-by: YANGDB <yang.db.dev@gmail.com>

* As part of SQL repo split - ODBC was missing the 2.X branch
This cherry-picking if intended to sync the ODBC new repo to the existing 2.X state of the unified SQL repo

see :: Update MacOS Version for ODBC Driver #987

Origin PR:  opensearch-project/sql#987
Done by:   https://github.com/forestmvey

Signed-off-by: YANGDB <yang.db.dev@gmail.com>

* Adding missing VisualLeakDetector dependencies to resolve windows ODBC compilation.

Signed-off-by: forestmvey <forestv@bitquilltech.com>

Signed-off-by: YANGDB <yang.db.dev@gmail.com>
Signed-off-by: forestmvey <forestv@bitquilltech.com>
Co-authored-by: forestmvey <forestv@bitquilltech.com>
  • Loading branch information
YANG-DB and forestmvey committed Dec 22, 2022
1 parent 77dd4ff commit 2f92a14
Show file tree
Hide file tree
Showing 52 changed files with 152 additions and 318 deletions.
18 changes: 7 additions & 11 deletions .github/workflows/sql-odbc-main.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
name: OpenSearch ODBC Driver

on:
workflow_dispatch:
pull_request:
push:
branches-ignore:
Expand All @@ -13,14 +14,15 @@ env:
CI_OUTPUT_PATH: "./ci-output"
ODBC_LIB_PATH: "./build/odbc/lib"
ODBC_BIN_PATH: "./build/odbc/bin"
ODBC_BUILD_PATH: "./build/odbc/build"
AWS_SDK_INSTALL_PATH: "./build/aws-sdk/install"
ODBC_BUILD_PATH: "./build/odbc/cmake"
VCPKG_X64_INSTALL_PATH: ".\\src\\vcpkg_installed\\x64-windows"
VCPKG_X86_INSTALL_PATH: ".\\src\\vcpkg_installed\\x86-windows"

# Tests are disabled (commented out) in all jobs because they are fail and/or outdated
# Keeping them for the brighten future when we can re-activate them
jobs:
build-mac:
runs-on: macos-10.15
runs-on: macos-12
steps:
- uses: actions/checkout@v3
- name: run-cppcheck
Expand Down Expand Up @@ -85,9 +87,6 @@ jobs:
# path: test-output
build-windows32:
runs-on: windows-2019
defaults:
run:
working-directory: .
steps:
- uses: actions/checkout@v3
- name: Get specific version CMake, v3.18.3
Expand All @@ -100,7 +99,7 @@ jobs:
- name: build-installer
if: success()
run: |
.\scripts\build_installer.ps1 Release Win32 .\src $Env:ODBC_BUILD_PATH $Env:AWS_SDK_INSTALL_PATH
.\scripts\build_installer.ps1 Release Win32 .\src $Env:ODBC_BUILD_PATH $Env:VCPKG_X86_INSTALL_PATH
#- name: test
# run: |
# cp .\\libraries\\VisualLeakDetector\\bin32\\*.* .\\bin32\\Release
Expand Down Expand Up @@ -130,9 +129,6 @@ jobs:
# path: $CI_OUTPUT_PATH/test
build-windows64:
runs-on: windows-2019
defaults:
run:
working-directory: .
steps:
- uses: actions/checkout@v3
- name: Get specific version CMake, v3.18.3
Expand All @@ -145,7 +141,7 @@ jobs:
- name: build-installer
if: success()
run: |
.\scripts\build_installer.ps1 Release x64 .\src $Env:ODBC_BUILD_PATH $Env:AWS_SDK_INSTALL_PATH
.\scripts\build_installer.ps1 Release x64 .\src $Env:ODBC_BUILD_PATH $Env:VCPKG_X64_INSTALL_PATH
#- name: test
# run: |
# cp .\\libraries\\VisualLeakDetector\\bin64\\*.* .\\bin64\\Release
Expand Down
3 changes: 0 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
*.ipdb
*.pdb
*.exp
*.lib
*.res
*.idb
*.res
Expand Down Expand Up @@ -36,8 +35,6 @@ src/IntegrationTests/ITODBCHelper/ITODBCHelper.vcxproj.user
src/IntegrationTests/ITODBCExecution/memory_leak_report.txt
src/IntegrationTests/ITODBCResults/ITODBCResults.vcxproj.user
LICENSE.txt
/AWSSDK/
/sdk-build/
/CMakeFiles/
/googletest/
/installer/
Expand Down
4 changes: 2 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ Looking at the existing issues is a great way to find something to contribute on


## Code of Conduct
This project has adopted an [Open Source Code of Conduct](CODE_OF_CONDUCT.md).
This project has adopted an [Open Source Code of Conduct](./CODE_OF_CONDUCT.md).


## Security issue notifications
Expand All @@ -98,6 +98,6 @@ If you discover a potential security issue in this project we ask that you notif

## Licensing

See the [LICENSE](LICENSE.txt) file for our project's licensing. We will ask you to confirm the licensing of your contribution.
See the [LICENSE](./LICENSE.txt) file for our project's licensing. We will ask you to confirm the licensing of your contribution.

We may ask you to sign a [Contributor License Agreement (CLA)](http://en.wikipedia.org/wiki/Contributor_License_Agreement) for larger changes.
5 changes: 0 additions & 5 deletions aws_sdk_cpp_setup.sh

This file was deleted.

2 changes: 1 addition & 1 deletion bi-connectors/PowerBIConnector/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ The release snapshots are also available here: [OpenSearch Project](OpenSearchPr
## Connector Install

1. Put connector `mez` file into: `C:\Users\%USERNAME%\Documents\Power BI Desktop\Custom Connectors`.
2. Install OpenSearch `ODBC` [driver](../../sql-odbc/README.md).
2. Install OpenSearch `ODBC` [driver](README.md).
3. Run `Power BI Desktop`.
4. Check under `File | Options and settings | Options | Security | Data Extensions` option `(Not Recommended) Allow any extension to load without validation or warning in Power BI Desktop`:
<img src="img/pbi_settings.png">
Expand Down
12 changes: 8 additions & 4 deletions build_mac_debug64.sh
Original file line number Diff line number Diff line change
@@ -1,14 +1,18 @@
# Build AWS SDK
# $BITNESS=64
#!/bin/bash

cd src
git clone -b "1.7.329" "https://github.com/aws/aws-sdk-cpp.git"
vcpkg install
cd ..

vcpkg_installed_dir='x64-osx'
if [[ $MACHTYPE == 'arm64-apple-darwin'* ]]; then
vcpkg_installed_dir='arm64-osx'
fi

PREFIX_PATH=$(pwd)
mkdir cmake-build64
cd cmake-build64
cmake ../src -DCMAKE_INSTALL_PREFIX=${PREFIX_PATH}/AWSSDK/ -DCMAKE_BUILD_TYPE=Debug -DBUILD_ONLY="core" -DCUSTOM_MEMORY_MANAGEMENT="OFF" -DENABLE_RTTI="OFF" -DENABLE_TESTING="OFF"
cmake ../src -DCMAKE_INSTALL_PREFIX=${PREFIX_PATH}/src/vcpkg_installed/${vcpkg_installed_dir}/ -DCMAKE_BUILD_TYPE=Debug -DBUILD_ONLY="core" -DCUSTOM_MEMORY_MANAGEMENT="OFF" -DENABLE_RTTI="OFF" -DENABLE_TESTING="OFF"
cd ..

cmake --build cmake-build64 -- -j 4
12 changes: 8 additions & 4 deletions build_mac_release64.sh
Original file line number Diff line number Diff line change
@@ -1,14 +1,18 @@
# Build AWS SDK
# $BITNESS=64
#!/bin/bash

cd src
git clone -b "1.7.329" "https://github.com/aws/aws-sdk-cpp.git"
vcpkg install
cd ..

vcpkg_installed_dir='x64-osx'
if [[ $MACHTYPE == 'arm64-apple-darwin'* ]]; then
vcpkg_installed_dir='arm64-osx'
fi

PREFIX_PATH=$(pwd)
mkdir cmake-build64
cd cmake-build64
cmake ../src -DCMAKE_INSTALL_PREFIX=${PREFIX_PATH}/AWSSDK/ -DCMAKE_BUILD_TYPE=Release -DBUILD_ONLY="core" -DCUSTOM_MEMORY_MANAGEMENT="OFF" -DENABLE_RTTI="OFF" -DENABLE_TESTING="OFF"
cmake ../src -DCMAKE_INSTALL_PREFIX=${PREFIX_PATH}/src/vcpkg_installed/${vcpkg_installed_dir}/ -DCMAKE_BUILD_TYPE=Release -DBUILD_ONLY="core" -DCUSTOM_MEMORY_MANAGEMENT="OFF" -DENABLE_RTTI="OFF" -DENABLE_TESTING="OFF"
cd ..

cmake --build cmake-build64 -- -j 4
4 changes: 4 additions & 0 deletions build_win_debug32.ps1
Original file line number Diff line number Diff line change
@@ -1,2 +1,6 @@
$WORKING_DIR = (Get-Location).Path
$env:VCPKG_DEFAULT_TRIPLET = 'x86-windows'
cd src
vcpkg install
cd ..
.\scripts\build_windows.ps1 $WORKING_DIR Debug 32
4 changes: 4 additions & 0 deletions build_win_debug64.ps1
Original file line number Diff line number Diff line change
@@ -1,2 +1,6 @@
$WORKING_DIR = (Get-Location).Path
$env:VCPKG_DEFAULT_TRIPLET = 'x64-windows'
cd src
vcpkg install
cd ..
.\scripts\build_windows.ps1 $WORKING_DIR Debug 64
4 changes: 4 additions & 0 deletions build_win_release32.ps1
Original file line number Diff line number Diff line change
@@ -1,2 +1,6 @@
$WORKING_DIR = (Get-Location).Path
$env:VCPKG_DEFAULT_TRIPLET = 'x86-windows'
cd src
vcpkg install
cd ..
.\scripts\build_windows.ps1 $WORKING_DIR Release 32
4 changes: 4 additions & 0 deletions build_win_release64.ps1
Original file line number Diff line number Diff line change
@@ -1,2 +1,6 @@
$WORKING_DIR = (Get-Location).Path
$env:VCPKG_DEFAULT_TRIPLET = 'x64-windows'
cd src
vcpkg install
cd ..
.\scripts\build_windows.ps1 $WORKING_DIR Release 64
4 changes: 2 additions & 2 deletions docs/dev/BUILD_INSTRUCTIONS.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ msbuild .\build\odbc\PACKAGE.vcxproj -p:Configuration=Release
`OpenSearch SQL ODBC Driver-<version>-Windows-<Bitness>-bit.msi` will be generated in the build directory.

### Testing
See [run_tests.md](run_tests.md)
See [run_tests.md](./run_tests.md)

## Mac

Expand Down Expand Up @@ -99,7 +99,7 @@ cpack .
`OpenSearch SQL ODBC Driver-<version>-Darwin.pkg` will be generated in the build directory.

### Testing
See [run_tests.md](run_tests.md)
See [run_tests.md](./run_tests.md)

## General Build Info

Expand Down
2 changes: 1 addition & 1 deletion docs/dev/run_tests.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

Loading a dataset requires an [OpenSearch](https://docs-beta.opensearch.org/opensearch/install/index/) service running with [OpenSearch Dashboards](https://docs-beta.opensearch.org/dashboards/index/). If either of these are missing, please refer to the documentation on how to set them up.

Note, if you wish to work with SSL/TLS, you need to configure OpenSearch and OpenSearch Dashboards to support it. See the [build instructions](BUILD_INSTRUCTIONS.md) for more info.
Note, if you wish to work with SSL/TLS, you need to configure OpenSearch and OpenSearch Dashboards to support it. See the [build instructions](./BUILD_INSTRUCTIONS.md) for more info.

First load the sample datasets provided by OpenSearch Dashboards.

Expand Down
2 changes: 1 addition & 1 deletion docs/user/windows_configure_dsn.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

<img src="img/win_system_dsn.png" width="60%">

3. DSN Setup window will open with default values for [configuration options](configuration_options.md).
3. DSN Setup window will open with default values for [configuration options](./configuration_options.md).

<img src="img/win_configure_dsn.png" width="50%">

Expand Down
Binary file added libraries/VisualLeakDetector/lib/vld.lib
Binary file not shown.
Binary file added libraries/VisualLeakDetector/lib64/vld.lib
Binary file not shown.
4 changes: 0 additions & 4 deletions libraries/rabbit/include/rabbit.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -1150,10 +1150,6 @@ class basic_array : public basic_value<Traits, array_tag>
: base_type(alloc)
{}

basic_array(const basic_array& other)
: base_type(other)
{}

template <typename OtherTraits>
basic_array(const basic_value_ref<OtherTraits>& other)
: base_type(other)
Expand Down
45 changes: 0 additions & 45 deletions scripts/build_aws-sdk-cpp.ps1

This file was deleted.

8 changes: 6 additions & 2 deletions scripts/build_driver.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,17 @@ $CONFIGURATION = $args[0]
$WIN_ARCH = $args[1]
$SRC_DIR = $args[2]
$BUILD_DIR = $args[3]
$INSTALL_DIR = $args[4]
$VCPKG_INSTALLED_DIR = $args[4]

# aws-sdk-cpp fails compilation with warning:
# "Various members of std::allocator are deprecated in C++17"
$env:CL='-D_SILENCE_CXX17_OLD_ALLOCATOR_MEMBERS_DEPRECATION_WARNING'

cmake -S $SRC_DIR `
-B $BUILD_DIR `
-A $WIN_ARCH `
-D CMAKE_BUILD_TYPE=$CONFIGURATION `
-D CMAKE_INSTALL_PREFIX=$INSTALL_DIR `
-D CMAKE_INSTALL_PREFIX=$VCPKG_INSTALLED_DIR `
-D BUILD_WITH_TESTS=ON

# # Build Project
Expand Down
4 changes: 4 additions & 0 deletions scripts/build_installer.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ $INSTALL_DIR = $args[4]

Write-Host $args

# aws-sdk-cpp fails compilation with warning:
# "Various members of std::allocator are deprecated in C++17"
$env:CL='-D_SILENCE_CXX17_OLD_ALLOCATOR_MEMBERS_DEPRECATION_WARNING'

cmake -S $SRC_DIR `
-B $BUILD_DIR `
-A $WIN_ARCH `
Expand Down
30 changes: 4 additions & 26 deletions scripts/build_windows.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -9,50 +9,28 @@ if ($BITNESS -eq "64") {
else {
$WIN_ARCH = "Win32"
}
if ($BITNESS -eq "64") {
$LIBCURL_WIN_ARCH = "x64"
}
else {
$LIBCURL_WIN_ARCH = "x86"
}

# Create build directory; remove if exists
$BUILD_DIR = "${WORKING_DIR}\build"
# $BUILD_DIR = "${WORKING_DIR}\build\${CONFIGURATION}${BITNESS}"
New-Item -Path $BUILD_DIR -ItemType Directory -Force | Out-Null

$VCPKG_DIR = $Env:VCPKG_ROOT
vcpkg.exe install curl[tool]:${LIBCURL_WIN_ARCH}-windows

Set-Location $CURRENT_DIR

# Build AWS SDK CPP
$SDK_SOURCE_DIR = "${WORKING_DIR}\src\aws-sdk-cpp"
$SDK_BUILD_DIR = "${BUILD_DIR}\aws-sdk\build"
$SDK_INSTALL_DIR = "${BUILD_DIR}\aws-sdk\install"

.\scripts\build_aws-sdk-cpp.ps1 `
$CONFIGURATION $WIN_ARCH `
$SDK_SOURCE_DIR $SDK_BUILD_DIR $SDK_INSTALL_DIR $VCPKG_DIR `
$LIBCURL_WIN_ARCH

Set-Location $CURRENT_DIR

# Build driver
$DRIVER_SOURCE_DIR = "${WORKING_DIR}\src"
$DRIVER_BUILD_DIR = "${BUILD_DIR}\odbc\cmake"
$VCPKG_INSTALLED_DIR = "${DRIVER_SOURCE_DIR}\vcpkg_installed\$env:VCPKG_DEFAULT_TRIPLET"

.\scripts\build_driver.ps1 `
$CONFIGURATION $WIN_ARCH `
$DRIVER_SOURCE_DIR $DRIVER_BUILD_DIR $SDK_INSTALL_DIR
$DRIVER_SOURCE_DIR $DRIVER_BUILD_DIR $VCPKG_INSTALLED_DIR
Set-Location $CURRENT_DIR

# Move driver dependencies to bin directory for testing
$DRIVER_BIN_DIR = "$DRIVER_BUILD_DIR\..\bin\$CONFIGURATION"
$DRIVER_BIN_DIR = "${BUILD_DIR}\odbc\bin\$CONFIGURATION"
New-Item -Path $DRIVER_BIN_DIR -ItemType Directory -Force | Out-Null

Copy-Item $SDK_BUILD_DIR\bin\$CONFIGURATION\* $DRIVER_BIN_DIR
Copy-Item $DRIVER_BUILD_DIR\bin\$CONFIGURATION\* $DRIVER_BIN_DIR
Copy-Item $VCPKG_INSTALLED_DIR\bin\* $DRIVER_BIN_DIR
if ($BITNESS -eq "32") {
# Strip bitness from 32bit VLD DLL dir name
$BITNESS = $null
Expand Down
Loading

0 comments on commit 2f92a14

Please sign in to comment.