extender icon indicating copy to clipboard operation
extender copied to clipboard

Error building with Yandex Ads 7.0.1 on iOS

Open Lerg opened this issue 1 year ago • 8 comments

Here is the sample project https://github.com/Lerg/extension-yandexads/tree/7.0.1

It produces an error

duplicate interface definition for class 'AMAArrayIterator'
@interface AMAArrayIterator : NSObject <AMAResettableIterable>

If only pod 'YandexMobileAds', '7.0.1' is specified in the Podfile, another error appears

The abstract target Pods is not inherited by a concrete target, so the following dependencies won't make it into any targets in your project:
    - YandexMobileAds (= 7.0.1)

This issue on the Yandex Ads github: https://github.com/yandexmobile/yandex-ads-sdk-ios/issues/216

Lerg avatar Apr 23 '24 21:04 Lerg

Could you pls try to build using server from this post? https://github.com/defold/extender/issues/357#issuecomment-2009331835

AGulev avatar Apr 24 '24 06:04 AGulev

@AGulev I've tried the alternative build server and got the same error Here's the log file (I had to compress it so github would stop complaining about it's size)

log.txt.zip

Lerg avatar Apr 24 '24 12:04 Lerg

I have one fix that is not yet released to any of the build servers which I believe will solve this problem:

https://github.com/defold/extender/commit/19a0cc09dfcf43447fde475954e2b047f41189bf

When I build your project locally I got past the first issue but then run into another one:

CocoaPodsService/Pods/AppMetricaPlatform/AppMetricaPlatform/Sources/AMAPlatformDescription.m:46:12: error: unexpected '@' in program
    return @AMA_BUILD_TYPE;

britzl avatar Apr 24 '24 13:04 britzl

@britzl at least it's some progress! Thank you.

So the next issue about @ could also be Pod related. The only mention of AMA_BUILD_TYPE is in this file where it should become a preprocessor definition as an argument to the compiler

https://github.com/appmetrica/appmetrica-sdk-ios/blob/main/AppMetricaPlatform.podspec

But if it's not defined there's a catch for that in AMAPlatformDescription.m where it should become "undefined". Hm. So it becomes something else instead? Maybe an empty thing?

It is also the only podspec file with GCC_PREPROCESSOR_DEFINITIONS in that repo which also leads to conclusion that these preprocessing directives are probably not treated correctly.

Could it be that the escaped quotation mark 'AMA_BUILD_TYPE=\"source\"' is not treated here and throws off the compiler?

https://github.com/defold/extender/blob/56bd07ffde4a8223814dfddecd16f2386a5071c7/server/src/main/java/com/defold/extender/services/CocoaPodsService.java#L640

Lerg avatar Apr 27 '24 15:04 Lerg

It is also the only podspec file with GCC_PREPROCESSOR_DEFINITIONS in that repo which also leads to conclusion that these preprocessing directives are probably not treated correctly.

Could it be that the escaped quotation mark 'AMA_BUILD_TYPE=\"source\"' is not treated here and throws off the compiler?

Ah, ok, yes, it is likely that it is not handled properly!

britzl avatar Apr 28 '24 14:04 britzl

@Lerg this should now be available to test with build-stage.defold.com and a bob.jar from the latest alpha.

britzl avatar May 08 '24 11:05 britzl

@britzl I've just tried building with the latest alpha 1.8.1 f99e81e53dbb39aa5e475b4dd5539b5e98997584 and https://build-stage.defold.com as the build server but got the same error image

Am I doing something wrong?

Lerg avatar May 14 '24 13:05 Lerg

Am I doing something wrong?

Not sure. I did a test using bob.jar and I don't have any problem with the GCC_PREPROCESSOR_DEFINES. Here's my command line:

java -jar bob_1.8.1-alpha.jar --build-server=https://build-stage.defold.com --defoldsdk=f670354c94896958503e2c5fe9c1a2b8e975ad96 --archive --platform=arm64-ios --verbose clean build bundle

I used bob.jar from the 1.8.1 alpha, but any relatively new bob version should work, since I'm setting the defoldsdk. I use the to the sha1 of the latest 1.8.1 alpha:

https://github.com/defold/defold/releases/tag/1.8.1-alpha

With the above command line I get past the point where you had problems but there's a few other build errors:

CocoaPodsService/Pods/KSCrash/Source/KSCrash/swift/Basic/StandardTypesMangling.def:16:15: error: unknown type name 'Structure'
STANDARD_TYPE(Structure, A, AutoreleasingUnsafeMutablePointer)
              ^
CocoaPodsService/Pods/KSCrash/Source/KSCrash/swift/Basic/StandardTypesMangling.def:16:26: error: unknown type name 'A'
STANDARD_TYPE(Structure, A, AutoreleasingUnsafeMutablePointer)
                         ^
CocoaPodsService/Pods/KSCrash/Source/KSCrash/swift/Basic/StandardTypesMangling.def:16:29: error: unknown type name 'AutoreleasingUnsafeMutablePointer'
STANDARD_TYPE(Structure, A, AutoreleasingUnsafeMutablePointer)
                            ^
CocoaPodsService/Pods/KSCrash/Source/KSCrash/swift/Basic/StandardTypesMangling.def:17:1: error: expected function body after function declarator
STANDARD_TYPE(Structure, a, Array)
^
4 errors generated.

britzl avatar May 15 '24 13:05 britzl

Closing this again since it is working for me.

britzl avatar May 17 '24 07:05 britzl

@britzl I'm sorry but I still having build errors, I've tried bob.jar (download from the alpha release on github) with the provided command. The error is different though, but there are many in the log file

log.txt.zip

Lerg avatar May 24 '24 21:05 Lerg

@britzl I'm sorry but I still having build errors, I've tried bob.jar (download from the alpha release on github) with the provided command. The error is different though, but there are many in the log file

log.txt.zip

At least first error is

CocoaPodsService/Pods/KSCrash/Source/KSCrash/swift/Basic/Demangle.h:136:22: error: reference to enumeration must use 'enum' not 'enum class' [-Welaborated-enum-class] enum class Kind : uint16_t {

Seems like need to enable c++11 at least.

ekharkunov avatar May 25 '24 08:05 ekharkunov

looks like I got similar issues during building iOS: log.zip

build server build-stage.defold.com edito alpha 1.8.1 image

Podfile:

platform :ios, '13.0'
pod 'YandexMobileAds', '7.0.1'
pod 'AppLovinYandexMobileAdsAdapters', '12.3.1.1'
pod 'IronSourceYandexMobileAdsAdapters', '7.9.1.1'
pod 'MintegralYandexMobileAdsAdapters', '7.5.9.1'

TinyDobbins avatar May 27 '24 06:05 TinyDobbins

Seems like need to enable c++11 at least.

And that would be done by adding a flags: ["-std=c++11"] to ext.manifest

britzl avatar May 27 '24 09:05 britzl

@britzl I've been trying different c++ versions in ext.manifest but to no avail, getting I think the same errors, here are some of many:

CocoaPodsService/Pods/KSCrash/Source/KSCrash/Recording/Tools/KSMachineContext.c:47:9: error: unknown type name 'ucontext64_t'; did you mean 'ucontext_t'?
typedef ucontext64_t SignalUserContext;
        ^~~~~~~~~~~~
        ucontext_t
/usr/local/extender-stage/platformsdk/iPhoneOS17.2.sdk/usr/include/sys/_types/_ucontext.h:57:33: note: 'ucontext_t' declared here
typedef _STRUCT_UCONTEXT        ucontext_t;     /* [???] user context */
                                ^
CocoaPodsService/Pods/KSCrash/Source/KSCrash/Recording/Tools/KSMachineContext.c:139:80: error: no member named 'uc_mcontext64' in 'struct __darwin_ucontext'; did you mean 'uc_mcontext'?
    _STRUCT_MCONTEXT* sourceContext = ((SignalUserContext*)signalUserContext)->UC_MCONTEXT;
                                                                               ^~~~~~~~~~~
                                                                               uc_mcontext
CocoaPodsService/Pods/KSCrash/Source/KSCrash/Recording/Tools/KSMachineContext.c:46:21: note: expanded from macro 'UC_MCONTEXT'
#define UC_MCONTEXT uc_mcontext64
                    ^
/usr/local/extender-stage/platformsdk/iPhoneOS17.2.sdk/usr/include/sys/_types/_ucontext.h:50:27: note: 'uc_mcontext' declared here
        _STRUCT_MCONTEXT        *uc_mcontext;   /* pointer to machine specific context */


CocoaPodsService/Pods/KSCrash/Source/KSCrash/swift/Basic/DemangleNodes.def:27:1: error: unknown type name 'NODE'
CONTEXT_NODE(Allocator)
^
CocoaPodsService/Pods/KSCrash/Source/KSCrash/swift/Basic/DemangleNodes.def:24:26: note: expanded from macro 'CONTEXT_NODE'
#define CONTEXT_NODE(ID) NODE(ID)
                         ^
CocoaPodsService/Pods/KSCrash/Source/KSCrash/swift/Basic/DemangleNodes.def:27:24: error: expected ';' after top level declarator
CONTEXT_NODE(Allocator)
                       ^
                       ;
2 errors generated.


CocoaPodsService/Pods/KSCrash/Source/KSCrash/swift/Basic/Demangle.h:136:22: error: reference to enumeration must use 'enum' not 'enum class' [-Welaborated-enum-class]
                enum class Kind : uint16_t {
                     ^~~~~~
CocoaPodsService/Pods/KSCrash/Source/KSCrash/swift/Basic/Demangle.h:136:44: error: expected '(' for function-style cast or type construction
                enum class Kind : uint16_t {
                                  ~~~~~~~~ ^
CocoaPodsService/Pods/KSCrash/Source/KSCrash/swift/Basic/Demangle.h:141:35: warning: alias declarations are a C++11 extension [-Wc++11-extensions]
                using IndexType = uint64_t;
                                  ^
CocoaPodsService/Pods/KSCrash/Source/KSCrash/swift/Basic/Demangle.h:148:22: warning: scoped enumerations are a C++11 extension [-Wc++11-extensions]
                enum class PayloadKind : uint8_t {
                     ^
CocoaPodsService/Pods/KSCrash/Source/KSCrash/swift/Basic/Demangle.h:148:22: error: reference to enumeration must use 'enum' not 'enum class' [-Welaborated-enum-class]
                enum class PayloadKind : uint8_t {
                     ^~~~~~
CocoaPodsService/Pods/KSCrash/Source/KSCrash/swift/Basic/Demangle.h:148:50: error: expected '(' for function-style cast or type construction
                enum class PayloadKind : uint8_t {
                                         ~~~~~~~ ^
CocoaPodsService/Pods/KSCrash/Source/KSCrash/swift/Basic/Demangle.h:154:37: error: union member 'TextPayload' has a non-trivial default constructor
                    llvm::StringRef TextPayload;

And here is my ext.manifest:

name: "YandexSdkAds"

platforms:
    common:
        context:
            flags: ["-std=c++17"]

    android:
        context:
            aaptExtraPackages: ['com.yandex.android', 'com.yandex.android.mobileads', 'com.yandex.mobile', 'com.yandex.mobile.ads', 'com.yandex.mobile.ads.imp', 'androidx.viewpager2', 'androidx.annotation', 'androidx.core', 'androidx.recyclerview', 'androidx.appcompat', 'androidx.transition', 'androidx.collection', 'androidx.appcompat.resources']

I'm using bob.jar downloaded from the 1.8.1-alpha release on github and using Java supplied with the Defold itself, version:

OpenJDK Runtime Environment Temurin-17.0.5+8 (build 17.0.5+8)
OpenJDK 64-Bit Server VM Temurin-17.0.5+8 (build 17.0.5+8, mixed mode)

I can't understand what are we doing different to you so it's compiling for you and not for us...

Lerg avatar May 27 '24 11:05 Lerg

And that would be done by adding a flags: ["-std=c++11"] to ext.manifest

here my result: log_2.zip

same ext.manifest as @Lerg used.

TinyDobbins avatar May 27 '24 12:05 TinyDobbins

I've done some tests again on stable version 1.8.1, and still this issue. MacOS Monterey.

log with flag ["-std=c++11"] log_flag.zip

log without this flag: log.zip

attached the repo case: test_yandex.zip

TinyDobbins avatar Jun 03 '24 11:06 TinyDobbins

yes, I can reproduce it as well

AGulev avatar Jun 03 '24 11:06 AGulev

I'm looking into it

britzl avatar Jun 03 '24 11:06 britzl

Can we run tests already? I saw the task complete. I downloaded the latest alpha: image

server build is build-stage.defold.com

and did 2 tests with flag ["-std=c++11"] Still need to try with it or not? :) here logs: log_without_flag.zip log_with_flag.zip

@AGulev @Lerg can you reproduce it or all fine now on your side?

TinyDobbins avatar Jun 03 '24 18:06 TinyDobbins

@TinyDobbins the investigation is still in progress

AGulev avatar Jun 03 '24 18:06 AGulev

@britzl found how to solve part of the issue related to c++11 but this error still happening:

CocoaPodsService/Pods/KSCrash/Source/KSCrash/Recording/Tools/KSMachineContext.c:47:9: error: unknown type name 'ucontext64_t'; did you mean 'ucontext_t'?
typedef ucontext64_t SignalUserContext;
        ^~~~~~~~~~~~
        ucontext_t
/Users/agulev/projects/extender/my_local/platformsdk/iPhoneOS17.2.sdk/usr/include/sys/_types/_ucontext.h:57:33: note: 'ucontext_t' declared here
typedef _STRUCT_UCONTEXT        ucontext_t;     /* [???] user context */
                                ^
CocoaPodsService/Pods/KSCrash/Source/KSCrash/Recording/Tools/KSMachineContext.c:139:80: error: no member named 'uc_mcontext64' in 'struct __darwin_ucontext'; did you mean 'uc_mcontext'?
    _STRUCT_MCONTEXT* sourceContext = ((SignalUserContext*)signalUserContext)->UC_MCONTEXT;
                                                                               ^~~~~~~~~~~
                                                                               uc_mcontext
CocoaPodsService/Pods/KSCrash/Source/KSCrash/Recording/Tools/KSMachineContext.c:46:21: note: expanded from macro 'UC_MCONTEXT'
#define UC_MCONTEXT uc_mcontext64
                    ^
/Users/agulev/projects/extender/my_local/platformsdk/iPhoneOS17.2.sdk/usr/include/sys/_types/_ucontext.h:50:27: note: 'uc_mcontext' declared here
        _STRUCT_MCONTEXT        *uc_mcontext;   /* pointer to machine specific context */
                                 ^
2 errors generated.

we didn't push update for beta-extender yet

AGulev avatar Jun 03 '24 18:06 AGulev

I've made a new task for this particular issue (because the current one is a mix of everything altogether): https://github.com/defold/extender/issues/389

AGulev avatar Jun 04 '24 13:06 AGulev

Issue #389 might not be relevant anymore, tried again with the newer SDK version and got another error https://github.com/defold/extender/issues/403

Lerg avatar Jul 12 '24 11:07 Lerg