3 Commits
Author SHA1 Message Date
Sutou Kouhei 9d92ed4dc4 GH-36329: [C++][CI] Use OpenSSL 3 on macOS (#36336)
### Rationale for this change

GitHub Actions self-hosted runner for macOS has
/usr/local/include/openssl/ provided by OpenSSL 3 (`openssl@ 3`). Our include paths have `... -isystem /usr/local/include -isystem /usr/local/opt/openssl@ 1.1/include ...`. It means that `/usr/local/include/openssl/...` is used for `#include <openssl/...>`.

If we mix OpenSSL 3 headers and OpenSSL 1.1 libraries, we may get some problems such as a link error.

### What changes are included in this PR?

This uses OpenSSL 3 instead of OpenSSL 1.1 because GitHub Actions self-hosted runner for macOS provides OpenSSL 3 by /usr/local/include/openssl/. Note that `$(brew --prefix openssl@ 3)/include` isn't linked as /usr/local/include/openssl` by default. So I think that Homebrew GitHub Actions self-hosted runner for macOS does it explicitly.

Other solution: Unlinking `/usr/local/include/openssl` by `brew unlink openssl@ 3`. But there is no reason to use OpenSSL 1.1 for us. So this PR doesn't use this solution.

### Are these changes tested?

Yes.

### Are there any user-facing changes?

Yes.
* Closes: #36329

Authored-by: Sutou Kouhei <kou@clear-code.com>
Signed-off-by: Sutou Kouhei <kou@clear-code.com>
2023-06-30 09:41:52 +09:00
Sutou Kouhei 93b63e8f3b ARROW-12175: [C++] Fix CMake packages (#13892)
ARROW-9171 and ARROW-17231 are also fixed.

Our CMake packages are broken. For example, `find_package(Parquet)`
doesn't work without specifying `CMAKE_MODULE_PATH`.

`find_package(${PACKAGE})` searches
`${PREFIX}/${PACKAGE}/${PACKAGE}Config.cmake` or
`${PREFIX}/${PACKAGE}/Find${PACKAGE}.cmake`. But our .cmake files are
always installed `${PREFIX}/arrow/`. So `find_package(Parquet)` can't find
`${PREFIX}/arrow/FindParquet.cmake` because "`/arrow/`" isn't
"`/${PACKAGE}`".

This change fixes this by installing `${PACKAGE}Config.cmake` to
`${PREFIX}/${PACKAGE}/` instead of `${PREFIX}/arrow/`.

This also removes all `Find${PACKAGE}.cmake`. We only provides
`${PACKAGE}Config.cmake`. Our `Find${PACKAGE}.cmake` can find `${PACKAGE}`
by CMake, pkg-config or manual .so/.h search. But we don't need to
support pkg-config nor manual .so/.h search. We can use
`${PACKAGE}Config.cmake` to support CMake package search. So this
removes all `Find${PACKAGE}.cmake`.

This also introduces namespace to our CMake targets. For example,
`arrow_shared` is exported as `Arrow::arrow_shared` and
`parquet_static` is exported as `Parquet::parquet_static`. But no
namespace targets such as `arrow_shared` and `parquet_static` are
still also exported for keeping backward compatibility. But this
requires CMake 3.18 or later for users because `add_library(ALIAS)`
for non-global `IMPORTED` library is available since CMake 3.18.

(`Plasma::plasma-store-server` target is also added for
`plasma-store-server` executable.)

FYI: We can resolve this problem by using `COMPONENTS` feature of
`find_package()`. For example, `find_package(Arrow COMPONENTS
Parquet)` is used instead of `find_package(Parquet)`. With
`COMPONENTS`, `${PACKAGE}` is always "Arrow". So we can still install
our .cmake files to `${PREFIX}/arrow/`. But this approach breaks
backward compatibility. So I choose `${PREFIX}/${PACKAGE}/*.cmake`
approach.


Authored-by: Sutou Kouhei <kou@clear-code.com>
Signed-off-by: Sutou Kouhei <kou@clear-code.com>
2022-08-30 13:57:58 +09:00
6e6102356d ARROW-11984: [C++][Gandiva] Implement SHA1 and SHA256 functions
Implement SHA1 and SHA256 functions on Gandiva module.
Used OpenSSL to run the SHA algorithm for numeric and string values.

JIRA issue: https://issues.apache.org/jira/browse/ARROW-11984

Closes #9707 from jpedroantunes/feature/add-sha256-functions and squashes the following commits:

4315a5621 <Anthony Louis> Fix cmake file formatter
f30e8039c <Anthony Louis> Fix OpenSSL version message
343ef7497 <Anthony Louis> Fix static linkining for OpenSSL in linux
245404f87 <Anthony Louis> Set option to use static libraries from OpenSSL
6c4eadf3a <Anthony Louis> Fix message for openssl
b7525f01a <Anthony Louis> Change the docker image for ubuntu
5cb4212b8 <Anthony Louis> Change least version for openssl
fb0b8b45c <Anthony Louis> Add openssl as whitelist library
313daf099 <Anthony Louis> Add openssl include dir
beaf1809c <Anthony Louis> Apply formatter changes
1aa40af7a <Anthony Louis> Fix test assert
e22b9782c <Anthony Louis> Add check for null values inside the test
9e87e1bab <Anthony Louis> Add gandiva export to functions
af64113f5 <Anthony Louis> Fix casting problems
792e9f70e <Anthony Louis> Fix errors in unit tests
8f95d4583 <Anthony Louis> Fix formating problems
826d1cb08 <Anthony Louis> Add tests for hash utils
9f250045c <Anthony Louis> Add gandiva export in decimal functions
80c56923e <Anthony Louis> Change integration tests asserts types
db28d7fd6 <Anthony Louis> Add comments for in line methods
9a6ecd328 <Anthony Louis> Change class to first class functions
220735e0d <Anthony Louis> Fix buffer update way
25f45d90b <Anthony Louis> Commenting out unnecessary parameters
4afdc0fc7 <Anthony Louis> Add check for the hash response size during the processing
258c93d46 <Anthony Louis> Add check for hash size after processing
6238bfc3c <Anthony Louis> Change name from sha128 to sha1
aa94ffdc8 <Anthony Louis> Remove null-char at the string final pos
a7092d931 <Anthony Louis> Add hash values for null
899ccb6ca <Anthony Louis> Fix problems for wrong types in windows
4bf483cec <Anthony Louis> Fix problems for address sanitizer
a3200b993 <Anthony Louis> Fix linter errors
adadbdd84 <Anthony Louis> Add tests for the decimal hash
2339345be <Anthony Louis> Add functions for sha in decimal types
61122220b <Anthony Louis> Fix name for repeated macros
ea58b145d <João Pedro> Fix linter suggestions on c++ files
d044ab492 <Anthony Louis> Refactor names for the function registry hashes
a150c7056 <Anthony Louis> Refactor names for sha functions macros
fbc08d993 <Anthony Louis> Fix problems for tests with var len variables
a3605ec98 <Anthony Louis> Add a variable to limit buffer for response
154a1d419 <Anthony Louis> Add a flag that indicates that method can return an error
f7d1c17d6 <Anthony Louis> Refactor methods names to follow cpp patterns
7a0ca5c5f <Anthony Louis> Add file to find OpenSSL library
d55e42504 <Anthony Louis> Add licenses in created files
9abbd9196 <João Pedro> Fix missing ) in macro on function registry common for gandiva
821260bf6 <João Pedro> Add base sha128 method definition on globall mapper for gandiva function stubs
56ca07d7d <João Pedro> Add base macros for sha128 definition
4dc3b68e9 <João Pedro> Add methdo definition for sha128 on gandiva stub file
e479d4a6f <João Pedro> Remove unused unit test for sha128 on gandiva
3f4d0fa3e <João Pedro> Add base tests for hash 128 gdv function
d05681a09 <João Pedro> Standardize pointer definition on hash utils
8e2cfee21 <Anthony Louis> Add integration tests for the functions over strings
d836d27c0 <Anthony Louis> Add macros for all types for sha256
28fb10582 <Anthony Louis> Add macros for all numeric and date types for sha256 functions
e28e175dc <Anthony Louis> Add the result length inside the hash functions
6c906e7f0 <Anthony Louis> Add support to function length inside the hash functions
be7ebee19 <Anthony Louis> Add integration tests for sha hash functions
5ddcf0569 <frank400> Implement test o sha1 and sha256 with an empty string
f3e1d13e9 <Anthony Louis> Implements a generic method to retrieve SHA hashes
af05c2117 <frank400> Implements the function hash_using_SHA128
3466df0b6 <frank400> Add tests to the function gdv_fn_sha128_from_numeric and gdv_fn_hash_sha128_from_string
9b617c421 <frank400> Add stubs for the method hash_using_SHA128
9355de12e <frank400> Add tests to the sha256 method
832db207b <Anthony Louis> Add tests for hash in strings
e01c9264a <Anthony Louis> Create tests for the gdv_fn_sha256_from_numeric function
513b9a05a <Anthony Louis> Implements and expose hash functions
1218ce6bc <Anthony Louis> Fix the parameter types for hash_utils
0de6580e6 <Anthony Louis> Add hash utils files inside the CmakeLists
87f0fe0e3 <Anthony Louis> Port initial methods from old repository

Lead-authored-by: Anthony Louis <anthony@simbioseventures.com>
Co-authored-by: João Pedro <joaop@simbioseventures.com>
Co-authored-by: frank400 <j.victorhuguenin2018@gmail.com>
Signed-off-by: Praveen <praveen@dremio.com>
2021-04-12 21:10:35 +05:30