Question

Je vais avoir du mal à MacPorts pour fonctionner correctement. Je viens d'installer Mac OS X Lion 10.7.3 J'ai téléchargé et installé MacPorts d'abord, puis après avoir lu les exigences, je Xcode4.3 téléchargé de l'App Store, puis installé. Je lançais Xcode et il semble être opérationnel et fonctionnel. Cependant, lorsque je tentais au port avec MacPorts, il m'a donné ce message d'erreur (extrait):

Warning: xcodebuild exists but failed to execute
Warning: Xcode does not appear to be installed; most ports will likely fail to build.

J'ai suivi les conseils de:

Comment puis-je installer des paquets supplémentaires pour Xcode sur Mac OS X Lion pour permettre MacPorts au travail

et command_line_tools_for_xcode installé à partir des Préférences dans Xcode. J'ai fermé Xcode, et encore eu les erreurs:

$ sudo port install libsocketsPassword:
Warning: xcodebuild exists but failed to execute
Warning: Xcode does not appear to be installed; most ports will likely fail to build.
--->  Computing dependencies for libsockets
--->  Dependencies to be installed: openssl zlib
--->  Extracting zlib
Error: Couldn't determine your Xcode version (from '/usr/bin/xcodebuild -version').
Error: 
Error: If you have not installed Xcode, install it now; see:
Error: http://guide.macports.org/chunked/installing.xcode.html
Error: 
Error: Target org.macports.extract returned: unable to find Xcode
Error: Failed to install zlib
Log for zlib is at: /opt/local/var/macports/logs/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_archivers_zlib/zlib/main.log
Error: The following dependencies were not installed: openssl zlib
Error: Status 1 encountered during processing.

Je ne suis pas sûr où aller ensuite avec cela. Comment puis-je tirer ma difficulté d'interface Xcode et MacPort?

Était-ce utile?

La solution

En théorie, cela devrait fonctionner si vous avez Xcode4.3 installé (dans / Applications):

$ sudo xcode-select -switch /Applications/Xcode.app/Contents/Developer/

(Et vous avez installé les outils de ligne de commande en option)

Autres conseils

Tout va commencer à travailler bien après l'installation de « Outils de ligne de commande pour Xcode » package. Vous pouvez l'obtenir ici: https://developer.apple.com/downloads/index.action#

S'il vous plaît voir le MacPorts instructions de migration pour Xcode 4.3 .

Les instructions sont très impliqués. Vous devez exécuter xcode-select pour définir un nouveau chemin d'outils, mise à jour developer_dir dans macports.conf (tel que décrit par Henk Poley ), re installer MacPorts (aïe), et enfin désinstaller et réinstaller tous vos ports (à double ouch).

Modifier libpvx ne serait toujours pas installer après ce qui précède. Deux étapes supplémentaires sont nécessaires:

  1. sudo ln -s /Developer /
  2. sudo ln -s /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs /SDKs

YMMV si vous avez des ports différents installés!

De plus en /opt/local/etc/macports/macports.conf changement de la ligne avec developer_dir pour pointer vers / au lieu de /Developer.

Après

sudo xcode-select -switch /Applications/Xcode.app

Je devais aussi courir

sudo xcodebuild -license

et accepter la licence

Voici une solution qui a fonctionné pour moi:

  1. Installer les outils de ligne de commande pour Xcode

    Xcode -> Preferences -> Downloads
    
  2. Aide MacPorts trouver le bon dossier Xcode

    sudo /usr/bin/xcode-select -switch /Applications/Xcode.app
    
  3. Créer des liens symboliques pour les compilateurs clang comme ils ailleurs maintenant en direct

    sudo ln -s `which clang` /Applications/Xcode.app/Contents/Developer/usr/bin/
    sudo ln -s `which clang++` /Applications/Xcode.app/Contents/Developer/usr/bin/
    

Essayez d'utiliser le tronc, il n'y a pas communiqué le soutien Xcode 4.3 encore.

Réglage du chemin de développeur dans /opt/local/etc/macports.conf fonctionne pour moi,

developer_dir /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain

puisque la plupart des compilateurs sont stockés là maintenant au lieu de / usr / bin sous Developer.

Rien de tout cela fonctionne pour moi. Attendez macports pour libérer une nouvelle version qui prend en charge officiellement XCode 4.3 +

sudo mv /usr/bin/xcodebuild /usr/bin/xcodebuild.old
sudo ln -s /Applications/Xcode.app/Contents/Developer/usr/bin/xcodebuild /usr/bin/xcodebuild 

Starting with Xcode 4.3, the command-line build tools are not installed by default. Launch Xcode, open the Preferences, and go to the Downloads tab. From there you should have an option to install the command-line tools.

You can also download them from the web here: https://developer.apple.com/downloads/index.action

Disclaimer: I haven't installed Xcode 4.3 yet. I have only read about it on the web.

As of 27/2/2012, the official suggestion from MacPorts seems to be to not use XCode 4.3 and instead use 4.1 through 4.2.1, which can be downloaded from Apple.

There is a bug ticket which might be useful to follow the evolution of this.

Incidentally, and as reported in my comment #11 in that bug report, I am able to build ports without warnings by using the 2 most sane-looking suggestions found in this question: sudo /usr/bin/xcode-select -switch /Applications/Xcode.app/Contents/Developer and changing developer_dir in /opt/local/etc/macports/macports.conf to /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain

I have macports installed without admin/root privileges, so I was unable to test the xcode-select answers. However, I observed that Pall Melsted's answer worked, but not initially. What I found out was that I had not accepted the Xcode 4.5 license agreement!

If you have just installed Xcode for the purposes of macports, and you haven't accepted the Xcode license yet, you might get the error presented by the original post. When I checked my Xcode version using /usr/bin/xcodebuild -version, I was given the prompt to read and accept the license. After doing so, and after having made the changes suggested by Pall to the macports.conf developer_dir, it all works now.

As alternative: you can make downgrade of Xcode to 4.2.1 version. DMG of Xcode 4.2.1 placed here: https://developer.apple.com/downloads/index.action

After this MacPorts became works fine for me.

This is fixed in MacPorts 2.0.4.

To upgrade:

  1. Download MacPorts 2.0.4 from the install site or run sudo port selfupdate.
  2. Run the MacPorts migration described here to reinstall all ports. This is painful but required to get back to a working state.

You should definitely run sudo xcode-select -switch /Applications/Xcode.app like everyone here says, that'll fix many problems, but certainly not all.

Afaik, all the remaining problems exist within the configuration information for various packages. You might simply reinstall MacPorts as described in the migration instructions, but I found another solution.


You should begin finding all effected port files using commands like grep /Developer/ ..., after executing sudo bash and cd /opt/local naturally.

You should identify all effected ports by using port provides ..., which I piped through sed and sort | uniq. You could simply reinstall all these ports using either port -n upgrade --force ... or separate port uninstall ... and port install ... commands.

I recommend using one large port -n upgrade --force ... command to avoid duplicate rebuilds of dependencies, using the separate uninstall and install commands afterwards.

There are of course various ports for which /Developer exists only inside text config files, meaning you can fix them manually with sed -i -e 's/\/Developer//g' ..., but you cannot do so with binaries obviously.

I'm afraid you must at minimum rebuild all your Python and Perl installations, making this upgrade an ideal time to clean out packages that depend upon older versions, ala python26 and perl5.8.

There are several technically effected ports I decided against rebuilding like fuse4x-kext, who contained /Developer inside Library/Extensions/fuse4x.kext/Contents/MacOS/fuse4x but hasn't prevented sshfs from working correctly.

I had initially installed xcode 3.2.2, after which I installed 4.3. When I ran the xcode-select, I still got the same error about no xcode project in /Applications. I then dug into the /usr/bin/xcodebuild script and found out that this was working correctly, and another instance of xcodebuild (the one installed with xcode 4.3, not the one in /usr/bin) was being run and returning the error:

xcodebuild: error: The directory /Applications does not contain an Xcode project.

It seems the /usr/bin/xcode-select does not work for xcode 4.3, (it's compiled so you can't really see why it's not working). Strings doesn't give any clues. Good thing osx has strace.. oh wait.

Anyways, the best I could do was modify /opt/local/etc/macports.conf and uncomment the line containing the path to the xcode installation. That seems to fix my problem for the most part.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top