Cocoanetics / DTFoundation

Standard toolset classes and categories
BSD 2-Clause "Simplified" License
805 stars 237 forks source link

DTFoundation/Core/Source/DTLog.m:103:20: error: implicit declaration of function 'asl_next' is invalid in C99 [-Werror,-Wimplicit-function-declaration] while ((message = asl_next(response))) ^ #72

Closed pxr closed 10 years ago

pxr commented 10 years ago

Getting this error:

DTFoundation/Core/Source/DTLog.m:103:20: error: implicit declaration of function 'asl_next' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
        while ((message = asl_next(response)))
                          ^

With the latest DTFoundation

odrobnik commented 10 years ago

Which Xcode version?

odrobnik commented 10 years ago

@pxr Please tell me why in your case DTLOG_USE_NEW_ASL_METHODS is getting defined. This should only happen building with iOS SDK >= 7.0 and there the new asl_next is defined.

pxr commented 10 years ago

Hmm I didn't change anything except to do a pod update. I see the same error in Travis as well.

inf0rmer commented 10 years ago

Yup, same here. It seems that even reverting to an older version of the Pod (DTCoreText in my case) breaks it now, because DTFoundation is included as a submodule.

odrobnik commented 10 years ago

You must be having an old version. Travis-CI build is fine: https://travis-ci.org/Cocoanetics/DTFoundation/builds/30648581

Please answer my question: how have you integrated it and which Xcode do you use?

inf0rmer commented 10 years ago

I'm using XCode 5.1.1 and xctool 0.1.16 to build on Travis, both failing. I'm integrating through Cocoapods .

odrobnik commented 10 years ago

@inf0rmer please tell me the links where I can see the failure.

inf0rmer commented 10 years ago

I'm sorry, it's a private repository on Travis :/. These are the errors reported by xctool:

Users/brunoabrantes/Code/clubjudge-ios/Pods/DTFoundation/Core/Source/DTLog.m:103:20: error: implicit declaration of function 'asl_next' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
        while ((message = asl_next(response)))
                          ^
/Users/brunoabrantes/Code/clubjudge-ios/Pods/DTFoundation/Core/Source/DTLog.m:103:18: warning: incompatible integer to pointer conversion assigning to 'aslmsg' (aka 'struct __aslmsg *') from 'int' [-Wint-conversion]
        while ((message = asl_next(response)))
                        ^ ~~~~~~~~~~~~~~~~~~
/Users/brunoabrantes/Code/clubjudge-ios/Pods/DTFoundation/Core/Source/DTLog.m:125:2: error: implicit declaration of function 'asl_release' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
        asl_release(response);

I manually changed #define DTLOG_USE_NEW_ASL_METHODS 1 to #define DTLOG_USE_NEW_ASL_METHODS 0 in DTLog.m and the build started working.

odrobnik commented 10 years ago

please check why in your case this gets defined in these lines https://github.com/Cocoanetics/DTFoundation/blob/develop/Core/Source/DTLog.m#L15-L23

That should only occur in cases where asl.h has the new function.

inf0rmer commented 10 years ago

From what I could gather the iOS 7.0 simulator includes a version of <asl.h> that does not include asl_next. I checked /usr/include/asl.h on the iOS 8.0 simulator (using XCode 6-Beta3) and asl_next is there. Is asl_next really supported under the iOS 7 SDK or just iOS 8?

inf0rmer commented 10 years ago

If I change the version target from __IPHONE_6_1 to __IPHONE_7_1 the build is successful.

odrobnik commented 10 years ago

I think I fixed it correctly such: 73604d1a4a5ec7f3516336db4bb7274fa3804a04

I retagged the 1.7.2 release. Please refresh your repo clones and report if this fixes it.

odrobnik commented 10 years ago

Info: this needs to both consider the deployment target as well as the SDK version. The deprecation warning occurs if you have a deployment target >= 8.0.

inf0rmer commented 10 years ago

Yup, this works. Thanks a lot!

odrobnik commented 10 years ago

Thanks for helping me to fix this quickly.