Opened 8 years ago

Closed 7 years ago

Last modified 7 years ago

#5304 closed Bug (fixed)

daemon fails to build on mac

Reported by: leena Owned by: livings124
Priority: Normal Milestone: 2.83
Component: Mac Client Version: 2.76
Severity: Normal Keywords: patch_needed
Cc:

Description

The daemon fails to build on mac because it appears that libtransmission assumes that if the system is a mac it is built with --mac:

  CCLD     bitfield-test
 Undefined symbols for architecture x86_64:
  "_CFBundleCopyBundleURL", referenced from:
      _tr_getWebClientDir in libtransmission.a(platform.o)
  "_CFBundleGetMainBundle", referenced from:
      _tr_getWebClientDir in libtransmission.a(platform.o)
  "_CFRelease", referenced from:
      _tr_getWebClientDir in libtransmission.a(platform.o)
  "_CFStringGetFileSystemRepresentation", referenced from:
      _tr_getWebClientDir in libtransmission.a(platform.o)
  "_CFStringGetMaximumSizeOfFileSystemRepresentation", referenced from:
      _tr_getWebClientDir in libtransmission.a(platform.o)
  "_CFURLCopyFileSystemPath", referenced from:
      _tr_getWebClientDir in libtransmission.a(platform.o)
ld: symbol(s) not found for architecture x86_64
collect2: ld returned 1 exit status
Undefined symbols for architecture x86_64:
  "_CFBundleCopyBundleURL", referenced from:
      _tr_getWebClientDir in libtransmission.a(platform.o)
  "_CFBundleGetMainBundle", referenced from:
      _tr_getWebClientDir in libtransmission.a(platform.o)
  "_CFRelease", referenced from:
      _tr_getWebClientDir in libtransmission.a(platform.o)
  "_CFStringGetFileSystemRepresentation", referenced from:
      _tr_getWebClientDir in libtransmission.a(platform.o)
  "_CFStringGetMaximumSizeOfFileSystemRepresentation", referenced from:
      _tr_getWebClientDir in libtransmission.a(platform.o)
  "_CFURLCopyFileSystemPath", referenced from:
      _tr_getWebClientDir in libtransmission.a(platform.o)
ld: symbol(s) not found for architecture x86_64
collect2: ld returned 1 exit status
make[1]: *** [clients-test] Error 1
make[1]: *** Waiting for unfinished jobs....
make[1]: *** [blocklist-test] Error 1
Undefined symbols for architecture x86_64:
  "_CFBundleCopyBundleURL", referenced from:
      _tr_getWebClientDir in libtransmission.a(platform.o)
  "_CFBundleGetMainBundle", referenced from:
      _tr_getWebClientDir in libtransmission.a(platform.o)
  "_CFRelease", referenced from:
      _tr_getWebClientDir in libtransmission.a(platform.o)
  "_CFStringGetFileSystemRepresentation", referenced from:
      _tr_getWebClientDir in libtransmission.a(platform.o)
  "_CFStringGetMaximumSizeOfFileSystemRepresentation", referenced from:
      _tr_getWebClientDir in libtransmission.a(platform.o)
  "_CFURLCopyFileSystemPath", referenced from:
      _tr_getWebClientDir in libtransmission.a(platform.o)
ld: symbol(s) not found for architecture x86_64
collect2: ld returned 1 exit status
make[1]: *** [bitfield-test] Error 1
make: *** [all-recursive] Error 1

Attachments (3)

Change History (19)

comment:1 Changed 8 years ago by jordan

  • Keywords patch_needed added

The team's Mac dev isn't using automake/autoconf so this isn't officially supported, and I don't have a Mac. However if you want to patch libtransmission/Makefile.am's LDADD to get this working I'd be happy to use them.

comment:2 follow-up: Changed 8 years ago by leena

So using a Mac as a server will no longer be supported?

comment:3 Changed 8 years ago by x190

Are you using Xcode as that should be supported? Otherwise, maybe something from the trac wiki will help.

Switches ¶

The transmission ./configure (or ./autogen.sh) script allows you to switch on/off certain parts. To use these, you'll either use --enable-* or --disable-*. eg. To disable the GTK client: --disable-gtk.

The switches that are available are:

gtk = enables GTK+ client (default) daemon = enables transmission-daemon and *-remote client (default) cli = enables cli client (default. deprecated, consider using the daemon) libnotify = enables lib notify (default) nls = enables native language support (default) mac = enables Mac client (default, if possible) wx = enables wxWidgets client (unsupported) beos = enables beos client (unsupported)

comment:4 in reply to: ↑ 2 Changed 8 years ago by jordan

Replying to leena:

So using a Mac as a server will no longer be supported?

I'm saying that the automake/autoconf builds on Mac have never been supported: the Mac dev (livings124) doesn't use automake/autoconf, and the automake/autoconf maintainer (me) doesn't have a Mac.

IMO the way to move this ticket forward is for a Mac automake user to submit a patch.

comment:5 Changed 8 years ago by philippe

The CoreFoundation? library is used in tr_getWebClientDir() in platform.c, but "-framework CoreFoundation?" isn't in the linker flags. The quick fix is to add it to LD_FLAGS. But since we're doing an autoconf build, we probably want to execute the XDG-compliant version of that function and not the osx-specific one. (i.e. look under usr/local/share and not Library/Application?\ Support)

So here's the quick fix, but I don't recommend applying it until someone figures out if it makes sense to run the osx version of tr_getWebClientDir().

Index: configure.ac
===================================================================
--- configure.ac	(revision 14053)
+++ configure.ac	(working copy)
@@ -423,6 +423,7 @@
   *darwin*)
     have_darwin="yes"
     CFLAGS="-DMACOSX $CFLAGS"
+    LDFLAGS="-framework CoreFoundation $LDFLAGS"
     ;;

 esac

After this, you'll run into a second linker issue: iconv is missing from the linker flags. However, it seems Transmission can work without iconv, but someone added "#ifdef(SYS_DARWIN) #define HAVE_ICONV_OPEN" in libtransmission/utils.c.

The solution is probably to change that to "#ifdef(XCODE)" and define that in the Xcode project.

Since osx does have libiconv, a better solution would be to have the configure script check for it.

comment:6 Changed 8 years ago by cfipps

i had been successfully compiling the daemon for my servers for at least 3 years now. why all of a sudden has the mac dev broken it?

comment:7 follow-up: Changed 8 years ago by philippe

This patch should fix the Mac OS X autoconf build (but not the mac client). It adds a check for libiconv in order to support platforms where libiconv isn't included in libc, and refrains from using CoreFoundation? to find the web client directory unless BUILD_MAC_CLIENT is defined. This is a new preprocessor def and I have added it to the Xcode project.

comment:8 in reply to: ↑ 7 Changed 8 years ago by leena

Replying to philippe:

This patch should fix the Mac OS X autoconf build (but not the mac client). It adds a check for libiconv in order to support platforms where libiconv isn't included in libc, and refrains from using CoreFoundation? to find the web client directory unless BUILD_MAC_CLIENT is defined. This is a new preprocessor def and I have added it to the Xcode project.

This works perfectly. Now if only one of the devs would integrate it...

comment:9 Changed 8 years ago by jordan

Hmm, I'm not sure I like the idea of pulling in gettext's files for AM_ICONV_LINK.

How were these Mac builds succeeding before wrt iconv before the breakage reported in this ticket?

comment:10 Changed 8 years ago by philippe

There's an ifdef(HAVE_ICONV) that surrounds calls to iconv functions, and an alternative implementation is provided if !HAVE_ICONV. At some point, HAVE_ICONV was hardcoded in utils.c for Xcode builds, but this also affected autotools builds on mac.

Mac does have iconv, but unlike linux, it is not part of libc. Rather, it is a separate library, libiconv. So in the past, the basic function check would find that it was missing an iconv function, and iconv wouldn't get used. (even if it was available.)

The alternative is to fix the hardcoded HAVE_ICONV so that autotools builds on mac avoid using iconv.

The problem here is that a basic function check is too simplistic considering the variations across platforms. But it's not much of a problem since transmission can do without it.

For reference, the files I'm getting from gettext are rpath.m4 and iconv.m4. These files are the ones recommended by GNU libiconv for checking for it, and if libiconv is not found, then the basic check for iconv_open will still define HAVE_ICONV if it's in libc. These files are under an extremely permissive license.

comment:11 Changed 8 years ago by leena

Another nit is that the daemon now uses the config directory ~/Application Support/transmission-daemon instead of ~/.config/transmission-daemon.

Any word on getting this integrated?

Changed 8 years ago by philippe

comment:12 Changed 8 years ago by philippe

This new patch fixes the problems above without using gettext's autotools files for iconv. All it does is change three ifdefs so that they don't assume that a build with SYS_DARWIN is an Xcode build. The new macro variables are added to the Xcode project.

The difference between this patch and the previous one is that the autotools build on osx will use the fallback iconv instead of the system's iconv.

comment:13 Changed 8 years ago by jordan

  • Component changed from libtransmission to Mac Client
  • Owner changed from jordan to livings124

livings124, this patch looks fine to me but I don't have an OS X box to test on. Please merge it if it looks OK to you too.

comment:14 Changed 7 years ago by leena

So, 6 weeks later and no word...

comment:15 Changed 7 years ago by livings124

  • Milestone changed from None Set to 2.90
  • Resolution set to fixed
  • Status changed from new to closed

Sorry for the delay on this. r14214

comment:16 Changed 7 years ago by livings124

  • Milestone changed from 2.90 to 2.83
Note: See TracTickets for help on using tickets.