Opened 5 years ago

Closed 4 years ago

#58645 closed defect (fixed)

physfs @3.0.1: error: ‘autoreleasepool’ undeclared

Reported by: linuxjunkie999 Owned by: kencu (Ken)
Priority: Normal Milestone:
Component: ports Version: 2.5.4
Keywords: tiger leopard Cc: cooljeanius (Eric Gallager)
Port: physfs

Description

Command failed:  cd "/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_devel_physfs/physfs/work/build" && /usr/bin/make -w all VERBOSE=ON 
Exit code: 2
Error: Failed to build physfs: command execution failed

Attachments (1)

physfs.txt (230.1 KB) - added by linuxjunkie999 5 years ago.

Download all attachments as: .zip

Change History (6)

Changed 5 years ago by linuxjunkie999

Attachment: physfs.txt added

comment:1 Changed 5 years ago by mf2k (Frank Schima)

Keywords: leopard added; Leopard removed

comment:2 Changed 5 years ago by linuxjunkie999

After fixing this source file the port built

/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_devel_physfs/physfs/work/physfs-3.0.1/src/physfs_platform_apple.m

line 32 & 49

@autoreleasepool change to NSAutoreleasePool;

Last edited 5 years ago by linuxjunkie999 (previous) (diff)

comment:3 Changed 5 years ago by ryandesign (Ryan Carsten Schmidt)

Keywords: tiger added
Summary: Physfs fails to build Mac OSX 10.5 Leopardphysfs @3.0.1: error: ‘autoreleasepool’ undeclared

@autoreleasepool change to NSAutoreleasePool;

That's definitely not the correct fix.

@autoreleasepool automatically creates an NSAutoreleasePool for the duration of the block. This notation is required when using Automatic Reference Counting, and modern macOS requires ARC. This notation also works correctly on pre-ARC systems, but only if you're using clang from Xcode 4.2 or later, and your log shows you're not using clang but rather gcc-4.2. It also shows you're on PowerPC, and we haven't gotten clang to work on PowerPC yet.

Lacking the ability to use @autoreleasepool, the way to get this code to work on older systems would be to create and destroy the NSAutoreleasePool manually. That is, instead of:

@autoreleasepool {
    ...
}

it would need to be:

NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
...
[pool release];

And since that older style is not compatible with ARC, we would need to determine at compile time whether @autoreleasepool is available and use the right code for each case.

Your suggested statement NSAutoreleasePool; is a no-op: it does nothing. (NSAutoreleasePool is a type; you've just mentioned a type on a line by itself, without doing anything with that type such as declaring a variable of that type and assigning something to it.) Your suggestion does not set up an autorelease pool, so it just results in leaking all the memory that the autorelease pool should have been releasing.

In any case, we are not the developers of physfs. This is really an issue that should be reported to the developers of physfs so that they can fix it. I am not sure how much they care about older systems, but they did in the 3.0.2 release this year accept some patches from me and Ken to fix building on 10.7, so they may be interested, especially if the fix can be provided to them.

comment:4 Changed 5 years ago by cooljeanius (Eric Gallager)

Cc: cooljeanius added

comment:5 Changed 4 years ago by kencu (Ken)

Owner: set to kencu
Resolution: fixed
Status: newclosed

In b6ca637b6f51d189bffde315bb2732840ec2b115/macports-ports (master):

phyfs: fix build with gcc compilers

work around no @autoreleasepool support in gcc
fix an error in the CMakeLists.txt when using gcc on macOS

closes: #58645

Note: See TracTickets for help on using tickets.