krzyzanowskim / OpenSSL

OpenSSL package for SwiftPM, CocoaPod, and Carthage, multiplatform
https://swift.best
Other
910 stars 336 forks source link

Error: import of C++ module appears within extern "C" language linkage specification #99

Closed schmidt9 closed 3 years ago

schmidt9 commented 3 years ago

I try to include OpenSSL-Universal as a podspec dependency and get a bunch of errors like below on podspec validation (trying to execute pod repo push MySpecsRepo --verbose --skip-import-validation --allow-warnings). So I'm unable go update my podspec. As far as I remember that error started after upgrade to XCode 12, it was OK before. Maybe it because of XCFramework, do not know

    - ERROR | [iOS] xcodebuild:  /Users/user/Library/Developer/Xcode/DerivedData/App-hexmzvydemmnibhkkjcssrhpywes/Build/Products/Release-iphonesimulator/XCFrameworkIntermediates/OpenSSL/openssl.framework/Headers/dh.h:17:1: error: import of C++ module 'OpenSSL.bio' appears within extern "C" language linkage specification [-Wmodule-import-in-extern-c]
    - ERROR | [iOS] xcodebuild:  /Users/user/Library/Developer/Xcode/DerivedData/App-hexmzvydemmnibhkkjcssrhpywes/Build/Products/Release-iphonesimulator/XCFrameworkIntermediates/OpenSSL/openssl.framework/Headers/dh.h:18:1: error: import of C++ module 'OpenSSL.asn1' appears within extern "C" language linkage specification [-Wmodule-import-in-extern-c]
    - ERROR | [iOS] xcodebuild:  /Users/user/Library/Developer/Xcode/DerivedData/App-hexmzvydemmnibhkkjcssrhpywes/Build/Products/Release-iphonesimulator/XCFrameworkIntermediates/OpenSSL/openssl.framework/Headers/dh.h:19:1: error: import of C++ module 'OpenSSL.ossl_typ' appears within extern "C" language linkage specification [-Wmodule-import-in-extern-c]
    - ERROR | [iOS] xcodebuild:  /Users/user/Library/Developer/Xcode/DerivedData/App-hexmzvydemmnibhkkjcssrhpywes/Build/Products/Release-iphonesimulator/XCFrameworkIntermediates/OpenSSL/openssl.framework/Headers/dh.h:21:1: error: import of C++ module 'OpenSSL.bn' appears within extern "C" language linkage specification [-Wmodule-import-in-extern-c]
krzyzanowskim commented 3 years ago

What version is that? openssl.framework (lowercase openssl) is not part of the OpenSSL.xcframework these days

schmidt9 commented 3 years ago

I'm using latest version of OpenSSL 1.1.180, it's hard to say what happens, because there is no openssl.framework in that location, only OpenSSL executable

schmidt9 commented 3 years ago

Hmm I'm also using Boost and it seems to play bad tricks, because it also seems to include openssl implementation as per logs. Anyway I still do not get why it started to happen, it was OK before

In file included from /usr/local/Cellar/boost/1.69.0/include/boost/asio/ssl.hpp:18:
    In file included from /usr/local/Cellar/boost/1.69.0/include/boost/asio/ssl/context.hpp:23:
    In file included from /usr/local/Cellar/boost/1.69.0/include/boost/asio/ssl/context_base.hpp:19:
    /usr/local/Cellar/boost/1.69.0/include/boost/asio/ssl/detail/openssl_types.hpp:20:10: fatal error: could not build module 'OpenSSL'
    #include <openssl/conf.h>
krzyzanowskim commented 3 years ago

it depends when it was before.

schmidt9 commented 3 years ago

Thanks as a workaround I switched to 1.0.2.20 and it helped