10BC0
Skip to content

Conversation

@JamesEggleton
Copy link
Contributor

Description

Cmake build on macOS 10.14.6 failed with:

Undefined symbols for architecture x86_64:
"_AbsoluteToNanoseconds", referenced from:
occa::sys::currentTime() in sys.cpp.o
ld: symbol(s) not found for architecture x86_64

This has been resolved by using mach_timebase_info_data_t instead.

A number of warnings were also emitted relating to C++11 extensions, e.g.

occa/include/occa/core/device.hpp:249:21: warning: default template arguments for a function template are a C++11 extension
[-Wc++11-extensions]
template

These have been silenced using pragmas.

Two deprecated functions, AbsoluteToNanoseconds and syscall, have been factored out:

occa/src/tools/sys.cpp:68:31: warning: 'AbsoluteToNanoseconds' is deprecated: first deprecated in macOS 10.8
[-Wdeprecated-declarations]
const Nanoseconds ct2 = AbsoluteToNanoseconds(*(AbsoluteTime *) &ct);
^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/System/Library/Frameworks/CoreServices.framework/Frameworks/CarbonCore.framework/Headers/DriverServices.h:93:1: note:
'AbsoluteToNanoseconds' has been explicitly marked deprecated here
AbsoluteToNanoseconds(AbsoluteTime absoluteTime) __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_0, __MAC_10_8, __IPHONE_NA, __IPHONE_NA);
^
occa/src/tools/sys.cpp:369:14: warning: 'syscall' is deprecated: first deprecated in macOS 10.12 - syscall(2) is unsupported;
please switch to a supported interface. For SYS_kdebug_trace use kdebug_signpost(). [-Wdeprecated-declarations]
return syscall(SYS_gettid);
^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/usr/include/unistd.h:742:6: note: 'syscall' has been
explicitly marked deprecated here
int syscall(int, ...);

Copy link
Member
@dmed256 dmed256 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for finding these compilation issues and making a PR to fix them!

We might want to fix the C++11 warning by updating the compilation flags instead. Do you have time to update the fix? If not, I'm ok with merging the PR and fixing later.

const void *src = NULL,
const occa::properties &props = occa::properties());

#pragma clang diagnostic push
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, maybe we're missing the proper C++11 flags when compiling the files

-std=c++11 -stdlib=libc++

int getTID() {
#if (OCCA_OS & (OCCA_LINUX_OS | OCCA_MACOS_OS))
return syscall(SYS_gettid);
#if OCCA_OS == OCCA_MACOS_OS & (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_12)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔥 awesome, thanks for filing + fixing this warning!

James Eggleton added 2 commits April 11, 2020 07:40
Require C++11 or greater.
Use target_compile_options to suppress the following warnings:
    * default template arguments for a function template are a C++11 extension [-Wc++11-extensions]
    * unused parameter 'XXX' [-Wunused-parameter]
@JamesEggleton
Copy link
Contributor Author

I've removed the pragmas, and instead used target_compile_features and target_compile_options to customise warning reporting.

@dmed256
Copy link
Member
dmed256 commented Apr 11, 2020

Looks good, thank you for making the changes so fast!

@dmed256 dmed256 merged commit 7b2e817 into libocca:master Apr 11, 2020
@JamesEggleton JamesEggleton deleted the macos_compile_errors_and_warnings branch April 12, 2020 13:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

0