[ 
https://issues.apache.org/jira/browse/HDFS-16654?focusedWorklogId=789645&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-789645
 ]

ASF GitHub Bot logged work on HDFS-16654:
-----------------------------------------

                Author: ASF GitHub Bot
            Created on: 11/Jul/22 16:21
            Start Date: 11/Jul/22 16:21
    Worklog Time Spent: 10m 
      Work Description: GauthamBanasandra commented on code in PR #4538:
URL: https://github.com/apache/hadoop/pull/4538#discussion_r918125982


##########
hadoop-hdfs-project/hadoop-hdfs-native-client/src/CMakeLists.txt:
##########
@@ -127,7 +127,8 @@ if(OPENSSL_LIBRARY AND OPENSSL_INCLUDE_DIR)
     include(CheckCSourceCompiles)
     set(OLD_CMAKE_REQUIRED_INCLUDES ${CMAKE_REQUIRED_INCLUDES})
     set(CMAKE_REQUIRED_INCLUDES ${OPENSSL_INCLUDE_DIR})
-    check_c_source_compiles("#include 
\"${OPENSSL_INCLUDE_DIR}/openssl/evp.h\"\nint main(int argc, char **argv) { 
return !EVP_aes_256_ctr; }" HAS_NEW_ENOUGH_OPENSSL)

Review Comment:
   @iwasakims the `OPENSSSL_INCLUDE_DIR` is specified by setting 
`CMAKE_REQUIRED_INCLUDES` prior to invoking the `check_c_source_compiles` 
command.
   
https://github.com/apache/hadoop/blob/4e8c0b902ec199af66dad60c454e16cc2114985a/hadoop-hdfs-project/hadoop-hdfs-native-client/src/CMakeLists.txt#L129
   
   As per the [CMake 
documentation](https://cmake.org/cmake/help/v3.19/module/CheckCSourceCompiles.html),
   > A 
[;-list](https://cmake.org/cmake/help/v3.19/manual/cmake-language.7.html#cmake-language-lists)
 of header search paths to pass to the compiler. These will be the only header 
search paths used by try_compile(), i.e. the contents of the 
[INCLUDE_DIRECTORIES](https://cmake.org/cmake/help/v3.19/prop_dir/INCLUDE_DIRECTORIES.html#prop_dir:INCLUDE_DIRECTORIES)
 directory property will be ignored.
   
   The `OPENSSL_INCLUDE_DIR` is derived from `CUSTOM_OPENSSL_INCLUDE` - 
https://github.com/apache/hadoop/blob/4e8c0b902ec199af66dad60c454e16cc2114985a/hadoop-hdfs-project/hadoop-hdfs-native-client/src/CMakeLists.txt#L119-L122
   
   Thus, this PR shouldn't affect the ability to use custom OpenSSL library.





Issue Time Tracking
-------------------

    Worklog Id:     (was: 789645)
    Time Spent: 1h 10m  (was: 1h)

> Link OpenSSL lib for CMake deps check
> -------------------------------------
>
>                 Key: HDFS-16654
>                 URL: https://issues.apache.org/jira/browse/HDFS-16654
>             Project: Hadoop HDFS
>          Issue Type: Bug
>          Components: libhdfs++
>    Affects Versions: 3.4.0
>         Environment: Windows 10
>            Reporter: Gautham Banasandra
>            Assignee: Gautham Banasandra
>            Priority: Major
>              Labels: libhdfscpp, pull-request-available
>          Time Spent: 1h 10m
>  Remaining Estimate: 0h
>
> CMake checks whether the required components of OpenSSL are available prior 
> to building HDFS native client - 
> https://github.com/apache/hadoop/blob/fac895828f714b5587b57900d588acac69880c1e/hadoop-hdfs-project/hadoop-hdfs-native-client/src/CMakeLists.txt#L130
> {code}
> check_c_source_compiles("#include 
> \"${OPENSSL_INCLUDE_DIR}/openssl/evp.h\"\nint main(int argc, char **argv) { 
> return !EVP_aes_256_ctr; }" HAS_NEW_ENOUGH_OPENSSL)
> {code}
> This check compiles but fails while linking on Windows -
> {code}
> src.obj : error LNK2019: unresolved external symbol EVP_aes_256_ctr 
> referenced in function main 
> [H:\hadoop-hdfs-project\hadoop-hdfs-native-client\src\out\build\x64-Debug\CMakeFiles\CMakeTmp\cmTC_e391b.vcxproj]
> H:\hadoop-hdfs-project\hadoop-hdfs-native-client\src\out\build\x64-Debug\CMakeFiles\CMakeTmp\Debug\cmTC_e391b.exe
>  : fatal error LNK1120: 1 unresolved externals 
> [H:\hadoop-hdfs-project\hadoop-hdfs-native-client\src\out\build\x64-Debug\CMakeFiles\CMakeTmp\cmTC_e391b.vcxproj]
> Source file was:
> #include <openssl/evp.h>
> int main(int argc, char **argv) { return !EVP_aes_256_ctr; }
> {code}
> Thus, we need to link to the OpenSSL library prior to running this check. 
> Please note that this check doesn't fail on Linux since CMake is able to pick 
> it up from the standard location where libs are installed.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to