• 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: Linker can't find symbol _environ in Framework
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Linker can't find symbol _environ in Framework


  • Subject: Re: Linker can't find symbol _environ in Framework
  • From: Eric Albert <email@hidden>
  • Date: Tue, 2 May 2006 12:18:36 -0700

The right solution to this problem is actually to
	#include <crt_externs.h>
in the file in your library or framework code which references environ.

Hope this helps,
Eric

On May 2, 2006, at 11:05 AM, David Litwin wrote:

Sorry, that wasn't correct. The app calls an API in the shared lib to
set a pointer after it is loaded, then the lib can use that pointer when
it wishes.
The awkward part was the lib couldn't just call back to the app when it
needed it (it is not linked against the app, the app is linked against
it) and instead it had to be provided ahead of time.


David Litwin
BigFix, Inc.

-----Original Message-----
From: David Litwin
Subject: RE: Linker can't find symbol _environ in Framework

I just had the same problem two days ago with a shared library that
wanted to inspect the environment.

The _environ symbol is found in crt0.o, which isn't linked for anything
but my final executable. I had to rig a system by which the app would
provide it to the shared lib (awkward for me, as the shared lib is
loaded with dlopen and so had to dlsym back to the app for the routine
to provide it).


David Litwin
BigFix, Inc.

-----Original Message-----
From: Jerry Krinock
Subject: Linker can't find symbol _environ in Framework

Hi,

I have created a Cocoa framework project using files factored out of a
working Cocoa application.  The files I have factored out includes
Apple's
famous "MoreAuthSample" code, which includes Apple's famous MoreCFQ.c,
MoreUNIX.c and MoreSecurity.c.

MoreSecurity.c declares:

extern char **environ ;

which would seem to be the cause of this linker error:

Undefined symbols:
_environ

From searching developer.apple.com I see that "environ" is apparently
some
variable at the Mach-O level.

I have added the frameworks "Carbon.framework" and "Security.framework"
to
this framework project.


How/can this be made to link? I've fixed all the compiler errors. This
one
linker error is my one remaining show-stopper.


Thank you,

Jerry Krinock
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
40outofcheese.org


This email sent to email@hidden

_______________________________________________ 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
  • Follow-Ups:
    • Re: Linker can't find symbol _environ in Framework
      • From: Jerry Krinock <email@hidden>
References: 
 >RE: Linker can't find symbol _environ in Framework (From: "David Litwin" <email@hidden>)

  • Prev by Date: Re: Is this a known GCC bug?
  • Next by Date: Re: Is this a known GCC bug?
  • Previous by thread: RE: Linker can't find symbol _environ in Framework
  • Next by thread: Re: Linker can't find symbol _environ in Framework
  • Index(es):
    • Date
    • Thread