• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Symbol(s) not found error for _vm_region, migrating to Xcode 3.2
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Symbol(s) not found error for _vm_region, migrating to Xcode 3.2


  • Subject: Re: Symbol(s) not found error for _vm_region, migrating to Xcode 3.2
  • From: Jean-Daniel Dupas <email@hidden>
  • Date: Sun, 11 Oct 2009 21:10:08 +0200


Le 11 oct. 2009 à 20:10, Ben Haller a écrit :

On 11-Oct-09, at 12:57 PM, Jean-Daniel Dupas wrote:

Le 11 oct. 2009 à 17:51, Ben Haller a écrit :

Hi! I'm moving an old project forward to Xcode 3.2 and building it for x86_64. I'm getting a mysterious link error:

"_vm_region", referenced from:
_SSCanWriteToAddress in SSCocoaExtra.o
Symbol(s) not found

I'm building against the 10.6 SDK with a min version of 10.6. The .m file imports <mach/mach.h>. This all used to build just fine on 10.5 (sorry, don't know what version of Xcode and what SDK exactly).

This problem is reminiscent of the problem discussed here:

http://www.mailinglistarchive.com/email@hidden/msg16823.html

But I'm just using Obj-C, no C++, and I'm on the 10.6 SDK, not the 10.4 SDK, so it's not exactly the same problem. Maybe it is again a bug in the header in the SDK, in which case a suggested workaround would be welcome; I don't understand Mach stuff very well, so I'm nervous to just go hacking my way in...

Any help? I'm happy to forward on any extra information needed, but I'm not sure what would be useful. Thanks!


vm_region() is part of the old vm API which was superseded by the mach_vm API.
This function (as other vm_xxx function) is not 64 bit safe, so using it in a 64 bits code will probably failed, even if you managed to compile and link it.


You will have to update this code before using it in a 64 bit product.

Aha. This is new to me. As usual with Mach-level stuff, I'm a bit mystified as to where to find documentation; all the stuff I found on vm_region did not mention that it has been superseded. Googling "mach_vm", on the other hand, mostly brings up stuff that I find very cryptic and unhelpful. Searching on such things in the ADC reference website never turns up anything useful. Where do people find out about things like this?



In the wonderful "Mac OS X Internals" book ;-)

Anyhow, I've replaced my vm_region call with a mach_vm_region call, and made a few other changes based upon this:

http://www.opensource.apple.com/source/gdb/gdb-437/src/gdb/macosx/macosx-nat-inferior-debug.c?f=text

  My code now looks like this:

#import <Cocoa/Cocoa.h>
#import <mach/mach_vm.h>

BOOL SSCanWriteToAddress(void *address)
{
	vm_map_t		task = mach_task_self();
	mach_vm_address_t inOutAddress = (vm_address_t)address;
	mach_vm_size_t outSize = 0;
	vm_region_basic_info_data_64_t info;
	kern_return_t	 err;
	mach_port_t	 objectName = MACH_PORT_NULL;
	mach_msg_type_number_t	 count = VM_REGION_BASIC_INFO_COUNT_64;

err = mach_vm_region( task, &inOutAddress, &outSize, VM_REGION_BASIC_INFO_64, (vm_region_info_t)&info, &count, &objectName );

...
}


It compiles and links without warnings against both the 10.4 and 10.6 SDKs, ppc through x86_64. I'm a bit worried that it may still not be correct, however, given my lack of knowledge of the new APIs. In particular, is mach_task_self() OK, or should it be changed to a new API as well?


The API change is just for memory function.
The vm_xxx API was using 32 bit type to store addresses. But, as mach API is design to interact with other processes, it has to be capable of dealing with 64 bits addresses even in a 32 bit process.
That why the mach_vm API was introduce in 10.4, the first Mac OS X version able to run 64 bit processes.


mach_task_self doesn't have any reason to change.

Sorry for the clueless questions; as I say above, if someone can tell me where to find docs on these sorts of things, that would be most welcome.

Mach is officially considered SPI within Apple, that's why it is so poorly documented.


-- Jean-Daniel




_______________________________________________ Do not post admin requests to the list. They will be ignored. Xcode-users mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: This email sent to email@hidden
References: 
 >Symbol(s) not found error for _vm_region, migrating to Xcode 3.2 (From: Ben Haller <email@hidden>)
 >Re: Symbol(s) not found error for _vm_region, migrating to Xcode 3.2 (From: Jean-Daniel Dupas <email@hidden>)
 >Re: Symbol(s) not found error for _vm_region, migrating to Xcode 3.2 (From: Ben Haller <email@hidden>)

  • Prev by Date: Re: Should I try to avoid loading principal class of plug-in?
  • Next by Date: Re: Xcode bug re Objective-C categories
  • Previous by thread: Re: Symbol(s) not found error for _vm_region, migrating to Xcode 3.2
  • Next by thread: NASM with Xcode 3.2 ?
  • Index(es):
    • Date
    • Thread