libtorrent icon indicating copy to clipboard operation
libtorrent copied to clipboard

Config does not check for macOS version for libdispatch: it is not there on 10.5 and 10.6 PPC

Open barracuda156 opened this issue 2 years ago • 11 comments

void CFDispatchRetain(dispatch_queue_t q) { dispatch_retain(q); }
void CFDispatchRelease(dispatch_queue_t q) { dispatch_release(q); }
using CFDispatchRef = CFRef<dispatch_queue_t, CFDispatchRetain, CFDispatchRelease>;

This breaks the build on 10.5 and 10.6 PPC.

Config should account for presence of libdispatch, as it does other OS components:

#if defined __APPLE__

#include <AvailabilityMacros.h>
#include <TargetConditionals.h>

#if defined __MACH__ && MAC_OS_X_VERSION_MIN_REQUIRED >= 1050
#define TORRENT_HAS_COPYFILE 1
#endif

#define TORRENT_NATIVE_UTF8 1

#if MAC_OS_X_VERSION_MIN_REQUIRED >= 1070
// on OSX, use the built-in common crypto for built-in
# if !defined TORRENT_USE_LIBCRYPTO && !defined TORRENT_USE_LIBGCRYPT
#  define TORRENT_USE_COMMONCRYPTO 1
# endif
#endif // MAC_OS_X_VERSION_MIN_REQUIRED

// execinfo.h is available in the MacOS X 10.5 SDK.
#if MAC_OS_X_VERSION_MIN_REQUIRED >= 1050
#define TORRENT_USE_EXECINFO 1
#endif

#define TORRENT_USE_SYSTEMCONFIGURATION 1

#if TARGET_OS_IPHONE
#define TORRENT_USE_SC_NETWORK_REACHABILITY 1
#endif

#define TORRENT_USE_DEV_RANDOM 1

#else

// non-Apple BSD
#define TORRENT_USE_GETRANDOM 1
#define TORRENT_HAS_PTHREAD_SET_NAME 1

#endif // __APPLE__

barracuda156 avatar Jan 24 '23 20:01 barracuda156

this came up a long time ago. I thought it had been addressed. which version of libtorrent are you using?

arvidn avatar Jan 24 '23 23:01 arvidn

this came up a long time ago. I thought it had been addressed. which version of libtorrent are you using?

@arvidn I tried building 2.0.7.

barracuda156 avatar Jan 25 '23 00:01 barracuda156

I think the most reasonable fix for this is to disable the whole IPNotification mechanism if libdispatch is not available

arvidn avatar Feb 01 '23 12:02 arvidn

does this work? https://github.com/arvidn/libtorrent/pull/7294

arvidn avatar Feb 01 '23 12:02 arvidn

does this work? https://github.com/arvidn/libtorrent/pull/7294

@arvidn Thank you very much for an update! I am away from native PPC hardware for about a week, so please allow me until then to check (I wanna verify it works on 10.6 PPC and 10.5.8 too, so that it is fixed in one go). I will test on 10.6.8 in Rosetta in the meanwhile.

barracuda156 avatar Feb 02 '23 00:02 barracuda156

great. The patch needs some updates as it ended up breaking iOS build. I will have to fix that, but I think it works to validate the approach for macOS.

arvidn avatar Feb 02 '23 10:02 arvidn

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] avatar May 21 '23 19:05 stale[bot]

great. The patch needs some updates as it ended up breaking iOS build. I will have to fix that, but I think it works to validate the approach for macOS.

@arvidn Could you please update, has this been dealt with?

barracuda156 avatar May 21 '23 20:05 barracuda156

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] avatar Sep 17 '23 01:09 stale[bot]