• 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
Compiling on 8.1.0, running on 7.8.0
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Compiling on 8.1.0, running on 7.8.0


  • Subject: Compiling on 8.1.0, running on 7.8.0
  • From: Steve Checkoway <email@hidden>
  • Date: Sun, 26 Jun 2005 05:40:14 -0700

I'm sure there is a very simple thing I'm missing here so feel free to refer me to documentation.

Basically, I'm trying to compile a simple hello world application in c++ on Darwin 8.1.0 and have it run on Darwin 7.8.0 (earlier would be nice).

$ uname -vmp
Darwin Kernel Version 8.1.0: Tue May 10 18:16:08 PDT 2005; root:xnu-792.1.5.obj~4/RELEASE_PPC Power Macintosh powerpc
$ cat temp.cc
#include <cstdio>


int main()
{
puts("Hello World.");
return 0;
}
$ MACOSX_DEPLOYMENT_TARGET=10.3 g++ temp.cc
$ otool -L a.out
a.out:
/usr/lib/libstdc++.6.dylib (compatibility version 7.0.0, current version 7.3.0)
/usr/lib/libgcc_s.1.dylib (compatibility version 1.0.0, current version 1.0.0)
/usr/lib/libmx.A.dylib (compatibility version 1.0.0, current version 92.0.0)
/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 88.0.0)


When I try to run this on a computer running Darwin 7.8.0, it fails:

$ uname -vmp
Darwin Kernel Version 7.8.0: Wed Dec 22 14:26:17 PST 2004; root:xnu/ xnu-517.11.1.obj~1/RELEASE_PPC Power Macintosh powerpc
$ ./a.out
dyld: ./a.out can't open library: /usr/lib/libstdc++.6.dylib (No such file or directory, errno = 2)
Trace/BPT trap


And indeed, /usr/lib/libstdc++.6.dylib does not exist.

I was under the (clearly mistaken) impression that if I compiled using the MACOSX_DEPLOYMENT_TARGET environment variable, that the code would run on the specified system and later using weak linking.

However, if I compile temp.cc on the second computer and run it on the first, it works as expected. In that case, I get
$ otool -L a.out
a.out:
/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 71.1.1)


On the other hand, both libstdc++ and libgcc are static libraries only on the second computer and only dynamic libraries only dynamic libraries on the first.

Thank you for any assistance with this matter.

- Steve

Attachment: smime.p7s
Description: S/MIME cryptographic signature

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Darwin-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Follow-Ups:
    • Re: Compiling on 8.1.0, running on 7.8.0
      • From: Shantonu Sen <email@hidden>
    • Re: Compiling on 8.1.0, running on 7.8.0
      • From: Martin Costabel <email@hidden>
  • Prev by Date: Re: geteuid() while debugging
  • Next by Date: Re: Compiling on 8.1.0, running on 7.8.0
  • Previous by thread: Re: Link Errors -- Relocation Overflow
  • Next by thread: Re: Compiling on 8.1.0, running on 7.8.0
  • Index(es):
    • Date
    • Thread