-
-
Notifications
You must be signed in to change notification settings - Fork 12.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
xz broken on OSX 10.11.6 Beta (15G24b) with XCode 8 Beta #2674
Comments
So, running the Xcode 8 beta on 10.11 is possible but you may see issues that impact 10.12 suddenly start hitting you as well. @mistydemeo Do you have feelings on changing the Sierra patches to apply to El Cap as well, or do we want to essentially shun Xcode 8 for 10.11 until stable? Edit - typo, sigh. |
I wonder if this is possibly a 10.12 SDK on 10.11 issue? I wouldn't expect 10.11.6 to actually define @x8x Can you provide the logs from |
Could this be a reincarnation of the issue @UniqMartin (I think) identified before with the single SDK for both macOS/OS X versions, where the So in this case |
I don't have the Xcode 8 beta installed, only the CLT; can someone who has it provide the |
|
@DomT4 Can you provide |
In the CLT, here's the ifdef which controls whether #if !defined(_DARWIN_FEATURE_CLOCK_GETTIME) || _DARWIN_FEATURE_CLOCK_GETTIME != 0
#if __DARWIN_C_LEVEL >= 199309L
#if __has_feature(enumerator_attributes)
#define __CLOCK_AVAILABILITY __OSX_AVAILABLE(10.12) __IOS_AVAILABLE(10.0) __TVOS_AVAILABLE(10.0) __WATCHOS_AVAILABLE(3.0)
#else
#define __CLOCK_AVAILABILITY
#endif |
Looks like xz tests it like this: AC_SEARCH_LIBS([clock_gettime], [rt])
AC_CHECK_FUNCS([clock_gettime pthread_condattr_setclock])
AC_CHECK_DECLS([CLOCK_MONOTONIC], [], [], [[#include <time.h>]]) Which checks if it can link against it but not whether it's declared. Which, I believe, in this case is allowing the check to pass (because the symbol is in the |
time.h /*
* Copyright (c) 2000 Apple Computer, Inc. All rights reserved.
*
* @APPLE_LICENSE_HEADER_START@
*
* This file contains Original Code and/or Modifications of Original Code
* as defined in and that are subject to the Apple Public Source License
* Version 2.0 (the 'License'). You may not use this file except in
* compliance with the License. Please obtain a copy of the License at
* http://www.opensource.apple.com/apsl/ and read it before using this
* file.
*
* The Original Code and all software distributed under the License are
* distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
* EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
* INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
* Please see the License for the specific language governing rights and
* limitations under the License.
*
* @APPLE_LICENSE_HEADER_END@
*/
/*
* Copyright (c) 1989, 1993
* The Regents of the University of California. All rights reserved.
* (c) UNIX System Laboratories, Inc.
* All or some portions of this file are derived from material licensed
* to the University of California by American Telephone and Telegraph
* Co. or Unix System Laboratories, Inc. and are reproduced herein with
* the permission of UNIX System Laboratories, Inc.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the University of
* California, Berkeley and its contributors.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* @(#)time.h 8.3 (Berkeley) 1/21/94
*/
#ifndef _TIME_H_
#define _TIME_H_
#include <_types.h>
#include <Availability.h>
#include <sys/_types/_clock_t.h>
#include <sys/_types/_null.h>
#include <sys/_types/_size_t.h>
#include <sys/_types/_time_t.h>
#include <sys/_types/_timespec.h>
struct tm {
int tm_sec; /* seconds after the minute [0-60] */
int tm_min; /* minutes after the hour [0-59] */
int tm_hour; /* hours since midnight [0-23] */
int tm_mday; /* day of the month [1-31] */
int tm_mon; /* months since January [0-11] */
int tm_year; /* years since 1900 */
int tm_wday; /* days since Sunday [0-6] */
int tm_yday; /* days since January 1 [0-365] */
int tm_isdst; /* Daylight Savings Time flag */
long tm_gmtoff; /* offset from CUT in seconds */
char *tm_zone; /* timezone abbreviation */
};
#if __DARWIN_UNIX03
#define CLOCKS_PER_SEC 1000000 /* [XSI] */
#else /* !__DARWIN_UNIX03 */
#include <machine/_limits.h> /* Include file containing CLK_TCK. */
#define CLOCKS_PER_SEC (__DARWIN_CLK_TCK)
#endif /* __DARWIN_UNIX03 */
#ifndef _ANSI_SOURCE
extern char *tzname[];
#endif
extern int getdate_err;
#if __DARWIN_UNIX03
extern long timezone __DARWIN_ALIAS(timezone);
#endif /* __DARWIN_UNIX03 */
extern int daylight;
__BEGIN_DECLS
char *asctime(const struct tm *);
clock_t clock(void) __DARWIN_ALIAS(clock);
char *ctime(const time_t *);
double difftime(time_t, time_t);
struct tm *getdate(const char *);
struct tm *gmtime(const time_t *);
struct tm *localtime(const time_t *);
time_t mktime(struct tm *) __DARWIN_ALIAS(mktime);
size_t strftime(char * __restrict, size_t, const char * __restrict, const struct tm * __restrict) __DARWIN_ALIAS(strftime);
char *strptime(const char * __restrict, const char * __restrict, struct tm * __restrict) __DARWIN_ALIAS(strptime);
time_t time(time_t *);
#ifndef _ANSI_SOURCE
void tzset(void);
#endif /* not ANSI */
/* [TSF] Thread safe functions */
char *asctime_r(const struct tm * __restrict, char * __restrict);
char *ctime_r(const time_t *, char *);
struct tm *gmtime_r(const time_t * __restrict, struct tm * __restrict);
struct tm *localtime_r(const time_t * __restrict, struct tm * __restrict);
#if !defined(_ANSI_SOURCE) && (!defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE))
time_t posix2time(time_t);
#if !__DARWIN_UNIX03
char *timezone(int, int);
#endif /* !__DARWIN_UNIX03 */
void tzsetwall(void);
time_t time2posix(time_t);
time_t timelocal(struct tm * const);
time_t timegm(struct tm * const);
#endif /* neither ANSI nor POSIX */
#if !defined(_ANSI_SOURCE)
int nanosleep(const struct timespec *, struct timespec *) __DARWIN_ALIAS_C(nanosleep);
#endif
#if !defined(_DARWIN_FEATURE_CLOCK_GETTIME) || _DARWIN_FEATURE_CLOCK_GETTIME != 0
#if __DARWIN_C_LEVEL >= 199309L
#if __has_feature(enumerator_attributes)
#define __CLOCK_AVAILABILITY __OSX_AVAILABLE(10.12) __IOS_AVAILABLE(10.0) __TVOS_AVAILABLE(10.0) __WATCHOS_AVAILABLE(3.0)
#else
#define __CLOCK_AVAILABILITY
#endif
typedef enum {
_CLOCK_REALTIME __CLOCK_AVAILABILITY = 0,
#define CLOCK_REALTIME _CLOCK_REALTIME
_CLOCK_MONOTONIC __CLOCK_AVAILABILITY = 6,
#define CLOCK_MONOTONIC _CLOCK_MONOTONIC
#if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)
_CLOCK_MONOTONIC_RAW __CLOCK_AVAILABILITY = 4,
#define CLOCK_MONOTONIC_RAW _CLOCK_MONOTONIC_RAW
_CLOCK_MONOTONIC_RAW_APPROX __CLOCK_AVAILABILITY = 5,
#define CLOCK_MONOTONIC_RAW_APPROX _CLOCK_MONOTONIC_RAW_APPROX
_CLOCK_UPTIME_RAW __CLOCK_AVAILABILITY = 8,
#define CLOCK_UPTIME_RAW _CLOCK_UPTIME_RAW
_CLOCK_UPTIME_RAW_APPROX __CLOCK_AVAILABILITY = 9,
#define CLOCK_UPTIME_RAW_APPROX _CLOCK_UPTIME_RAW_APPROX
#endif
_CLOCK_PROCESS_CPUTIME_ID __CLOCK_AVAILABILITY = 12,
#define CLOCK_PROCESS_CPUTIME_ID _CLOCK_PROCESS_CPUTIME_ID
_CLOCK_THREAD_CPUTIME_ID __CLOCK_AVAILABILITY = 16
#define CLOCK_THREAD_CPUTIME_ID _CLOCK_THREAD_CPUTIME_ID
} clockid_t;
__CLOCK_AVAILABILITY
int clock_getres(clockid_t clock_id, struct timespec *res);
__CLOCK_AVAILABILITY
int clock_gettime(clockid_t clock_id, struct timespec *tp);
#if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)
__CLOCK_AVAILABILITY
__uint64_t clock_gettime_nsec_np(clockid_t clock_id);
#endif
__OSX_AVAILABLE(10.12) __IOS_PROHIBITED
__TVOS_PROHIBITED __WATCHOS_PROHIBITED
int clock_settime(clockid_t clock_id, const struct timespec *tp);
#undef __CLOCK_AVAILABILITY
#endif /* __DARWIN_C_LEVEL */
#endif /* _DARWIN_FEATURE_CLOCK_GETTIME */
__END_DECLS
#ifdef _USE_EXTENDED_LOCALES_
#include <xlocale/_time.h>
#endif /* _USE_EXTENDED_LOCALES_ */
#endif /* !_TIME_H_ */ |
That's the same |
That's definitely a bug with the
Alternatively, the same effect can be achieved with multiple entries in that function list:
(See e.g. Can someone with an actual Developer Program membership report this to Apple (and I guess tell them other related symbols might be affected, too)? Maybe they're willing to fix this before the release … |
@mistydemeo Re: "Can you provide the logs from |
Submitted as rdar://27163651. @x8x That's fine - have it all figured out now. |
@mistydemeo This isn't a bug with the SDK. The availability macros correctly cause clock_gettime to be weak when you set a deployment target of 10.11. FWIW, this is one of the main reasons why we in MacPorts have our users install the command line tools (which include the relevant headers for the major OS version) and use that instead of the SDK. So many OSS projects don't handle these cases correctly @UniqMartin You misunderstand the purpose and use of those $ld symbols. That is not what they are for. They cause the linker to assume the symbols aren't there ($hide) or are there ($add) when the deployment target matches that value. This mechanism is for helping deal with symbols that have moved between dylibs across OS versions (and are re-exported from their old location for binary compatibility). |
@mistydemeo Thanks, but I'm afraid @jeremyhu is right and my assessment of the situation wasn't correct. I'm sorry for making you file this and making you attach your name to this analysis.
@jeremyhu That's an interesting bit of information that I didn't fully understand up until now. Thanks! So the real problem is that most OSS projects expect the symbol to either exist or not and aren't prepared to handle a weakly linked symbol (that requires a runtime check) instead of it being unavailable? Are you aware of a way to tell the compiler to mark those symbols as unavailable instead of causing weak linkage? While that would mess with software that properly handles this, it won't break anything and would help tremendously with software that doesn't deal with this properly.
So I properly understood the mechanics of those linker-special symbols but not how they are typically used? I think in addition to the case you mentioned (moved symbol) this can also be used for adding new symbols in a backwards-compatible way, but is only done for symbols where weak linking doesn't make sense (because the symbols are not directly exposed to a developer). I think the symbols in |
Does the autoconf macro include time.h before it's test or does it just check for the symbol's existence directly? If the former, you might be able to get the configure test to not pickup the new function by using -Werror=partial-availability. I know that many autoconf macros just do a link test without actually using the header, in which case the testcase wouldn't get the header's availability markup and would still succeed. Most OSS projects target POSIX (or often Linux) and really expect that the headers are an exact match to the system you're targeting. Apple platforms introduce a notion of SDK in which the headers are annotated with availability markup and the compiler sets up macros such that functionality newer than the deployment target are marked as weak. Similar things are done for annotating symbols as deprecated or unavailable as well. The exact way this has been done has evolved over the years from multiple layers of macro expansion in the early days to rather nice compiler attributes. Expecting all OSS projects to update their code to work this way isn't a reasonable expectation. If we want to support a way of doing what you are asking for, it would probably need to come at the linker stage and not the compiler stage (since we can't trust autoconf macros to actually use our headers). The issue is that the availability is encoded solely in the header. It certainly could be possible to introduce new $ld symbols to encode availability in the linker stubs (eg: $ld$available$os10.12$_clock_gettime), but to be effective, we'd want to do that for everything in an automated way. The compiler would likely need to add them at the implementation site when availability is set, and the linker would need to honor that when asked to run in a strict mode (eg: -Wl,-no_partial_availability or somesuch). You might consider starting a bug report at http://llvm.org about this as well as that's a more appropriate place for the public side of this discussion than in a Homebrew ticket that's really about specific fallout to this larger metaproblem. |
Seems to be fixed as of Xcode & CLT 8 beta3 on 10.12. Fixed after installing corresponding CLT. |
Yes, we added support for a new $ld directive in ld and adopted it in Libc for this particular case. It’s a manual process right now, so there may be other symbols in this category. Please file radars if you see any others. It would be nice to eventually have such $ld symbols omitted automatically by the compiler based on availability annotation. |
I have macOS 10.12 but xcode8, and I dont install .How to do?! installed xcode8 can fix it?! |
@xurenzhong have you installed command line tools for xcode8/macOS 10.12? |
@yurikoles I try it now, thank you |
Works fine on Xcode8 Beta 4, remember to install command line tools and run |
Presume resolved from Jeremy's comments, at least for this particular instance and providing you're keeping on top of prerelease updates. Closing here. |
This isn't resolved, it just never existed on 10.12 since that OS version does have the symbol. I've filed #3727 with, I hope, a clear explanation of what's going on. |
Now Homebrew/brew#721 was implemented these problems should be resolved at compile rather than run time. |
ala @justMaku - Make sure to run xcode-select --install |
I ran into this same error while compiling percona-server56 this morning on El Capitan. Digging a little deeper, the compile error message reported: /Applications/Xcode.app/Contents/Developer/usr/bin/make -f extra/CMakeFiles/GenError.dir/build.make extra/CMakeFiles/GenError.dir/build
[100%] Generating ../include/mysqld_error.h, ../sql/share/english/errmsg.sys
cd /tmp/percona-server56-20160929-86869-1527rh7/percona-server-5.6.28-76.1/extra && ./comp_err --charset=/tmp/percona-server56-20160929-86869-1527rh7/percona-server-5.6.28-76.1/sql/share/charsets --out-dir=/tmp/percona-server56-20160929-86869-1527rh7/percona-server-5.6.28-76.1/sql/share/ --header_file=/tmp/percona-server56-20160929-86869-1527rh7/percona-server-5.6.28-76.1/include/mysqld_error.h --name_file=/tmp/percona-server56-20160929-86869-1527rh7/percona-server-5.6.28-76.1/include/mysqld_ername.h --state_file=/tmp/percona-server56-20160929-86869-1527rh7/percona-server-5.6.28-76.1/include/sql_state.h --in_file=/tmp/percona-server56-20160929-86869-1527rh7/percona-server-5.6.28-76.1/sql/share/errmsg-utf8.txt
dyld: lazy symbol binding failed: Symbol not found: _clock_gettime
Referenced from: /private/tmp/percona-server56-20160929-86869-1527rh7/percona-server-5.6.28-76.1/extra/./comp_err
Expected in: /usr/lib/libSystem.B.dylib And exporting the symbols of the mentioned dynamic library shows it is missing: $ nm -gU /usr/lib/libSystem.B.dylib
0000000000001a98 T R8289209$_close
0000000000001a9d T R8289209$_fork
0000000000001aa2 T R8289209$_fsync
0000000000001aa7 T R8289209$_getattrlist
0000000000001aac T R8289209$_getrlimit
0000000000001ab1 T R8289209$_getxattr
0000000000001ab6 T R8289209$_open
0000000000001abb T R8289209$_pthread_attr_destroy
0000000000001ac0 T R8289209$_pthread_attr_init
0000000000001ac5 T R8289209$_pthread_attr_setdetachstate
0000000000001aca T R8289209$_pthread_create
0000000000001acf T R8289209$_pthread_mutex_lock
0000000000001ad4 T R8289209$_pthread_mutex_unlock
0000000000001ad9 T R8289209$_pthread_self
0000000000001ade T R8289209$_ptrace
0000000000001ae3 T R8289209$_read
0000000000001ae8 T R8289209$_setattrlist
0000000000001aed T R8289209$_setrlimit
0000000000001af2 T R8289209$_sigaction
0000000000001af7 T R8289209$_stat
0000000000001afc T R8289209$_sysctl
0000000000001b01 T R8289209$_time
0000000000001b06 T R8289209$_unlink
0000000000001b0b T R8289209$_write
0000000000001f98 S ___System_BVersionNumber
0000000000001f60 S ___System_BVersionString
00000000000022b8 S ___crashreporter_info__
0000000000001b10 T _libSystem_atfork_child
0000000000001a7a T _libSystem_atfork_parent
0000000000001a5c T _libSystem_atfork_prepare
00000000000022b0 D _mach_init_routine Not sure if this helps, but I thought I'd share nonetheless. John |
@johndubchak does it still fail if you add the linker flag I describe in #3727? |
The clock issue impacts the
Alternatively, the formula could be updated to use @achivetta in this case
|
@achivetta Sorry for the delayed response, but I've tried a number of different ways to add the linker flag, including an interactive build, and have been unsuccessful. I still get the same error. It's still possible I'm doing something wrong so if you have a specific way I should add the flag, let me know. |
When trying to install ruby 2.3.1 through rbenv which was itself installed via homebrew, I get the following, do you think it's related? dyld: Symbol not found: _clock_gettime |
@Catchpowle, yes, the exact same issue. |
@johndubchak I provided a solution for percona-server56 above. In any case, since this issue is about xz and we're all now talking about other formulae, please open new formula-specific issues if you're still having any problems. |
xz installs fine, but when called it crashes with:
commenting out this line:
in
xz-5.2.2/config.h.in
fixes it.I see here #1957 that there are known issues about
clock_gettime
related to OSX 10.12 but not sure why they also apply to OSX 10.11.6 Beta.Unrelated (sorry!) , have some issue with
python3
but didn't dig in further:The text was updated successfully, but these errors were encountered: