Opened 12 years ago

Closed 12 years ago

#35533 closed defect (fixed)

p5.12-xml-parser: Couldn't find your C compiler

Reported by: Onemer117@… Owned by: mjg@…
Priority: Normal Milestone:
Component: ports Version: 2.1.2
Keywords: haspatch Cc: pietvo (Pieter van Oostrum), ryandesign (Ryan Carsten Schmidt), dbevans (David B. Evans)
Port: p5.12-xml-parser

Description (last modified by ryandesign (Ryan Carsten Schmidt))

I'm very new to using MacPorts, and I don't really understand what anything does, but I really want to install wine. I keep getting the same error -

--->  Configuring p5.12-xml-parser
Error: org.macports.configure for port p5.12-xml-parser returned: configure failure: command execution failed
Error: Failed to install p5.12-xml-parser
Please see the log file for port p5.12-xml-parser for details:
    /opt/local/var/macports/logs/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_perl_p5-xml-parser/p5.12-xml-parser/main.log
Error: The following dependencies were not installed: gst-plugins-base gnome-vfs gconf gtk2 shared-mime-info intltool p5.12-xml-parser xorg-libXcomposite xorg-compositeproto xorg-libXext autoconf help2man p5.12-locale-gettext m4 automake libtool xorg-util-macros xorg-libXfixes xorg-fixesproto xorg-libXcursor xorg-libXdamage xorg-damageproto xorg-libXi xorg-libXinerama xorg-xineramaproto xorg-libXrandr xorg-randrproto orbit2 libidl policykit eggdbus p5-xml-parser gnome-mime-data gstreamer bison flex gzip libtheora libvorbis libogg orc lcms mesa makedepend xorg-dri2proto xorg-glproto xorg-libXmu xorg-libXt xorg-libsm xorg-libice xorg-libXxf86vm xorg-xf86vidmodeproto

I've tried doing the upgrade thing but it didn't work either. Please help, thank you!

Attachments (2)

main.log (3.9 KB) - added by Onemer117@… 12 years ago.
Main log
respect-CC.patch (991 bytes) - added by jmroot (Joshua Root) 12 years ago.

Download all attachments as: .zip

Change History (16)

Changed 12 years ago by Onemer117@…

Attachment: main.log added

Main log

comment:1 Changed 12 years ago by ryandesign (Ryan Carsten Schmidt)

Description: modified (diff)
Keywords: p5.12-xml-parser removed
Priority: HighNormal
Summary: Keep getting Failed to install p5.12-xml-parser error when installing Winep5.12-xml-parser: Couldn't find your C compiler

The log says "Couldn't find your C compiler" so this suggests you haven't installed Xcode and its command line tools properly. See:

comment:2 in reply to:  1 Changed 12 years ago by pietvo (Pieter van Oostrum)

Replying to ryandesign@…:

The log says "Couldn't find your C compiler" so this suggests you haven't installed Xcode and its command line tools properly.

I had the same problem, and really I had the C compiler (XCode) installed. I tried everything I could find to solve the problem but to no avail.
Today I decided to dig deeper in the problem and with a lot of patch work I could get the thing installed.

If you look into the log file, you will see the following lines:

:info:configure Couldn't find your C compiler
:info:configure Compilation failed in require at Makefile.PL line 5.
:info:configure BEGIN failed--compilation aborted at Makefile.PL line 5.

So the real error seems to be in line 5 of Makefile.PL, This line contains:

use Devel::CheckLib;

However in my Macports perl5.12 installation there is no Devel::CheckLib module. And I couldn't find a port to install it.
So I decided to take that out, and to disable the check_lib call at line 32.
This line checks for the presence of the expat library, which isn't really necessary in Macports because of the dependency on expat.
It would be wiser IMHO to add a port for Devel::CheckLib and take this as a dependency.

The following problem was with the compilation of the Expat Perl module. The Makefiles have /usr/bin/gcc-42 as the required C compiler, which I don't have.
I have /usr/bin/gcc, which is a link to llvm-gcc-4.2. So I made /usr/bin/gcc-4.2 a link to /usr/bin/gcc and that finally solved the problem.

Apparently the install procedure needs some additional patches.

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

Cc: piet@… ryandesign@… added

Piet, I would be surprised if those changes are necessary in general, since the port installs fine for tons of other people.

comment:4 Changed 12 years ago by jmroot (Joshua Root)

Owner: changed from macports-tickets@… to mjg@…

Where are you seeing gcc-4.2 required? We should be specifying an appropriate compiler explicitly; for example in the attached main.log you can see that the configure command is:

/opt/local/bin/perl5.12 Makefile.PL INSTALLDIRS=vendor CC="/usr/bin/clang" LD="/usr/bin/clang"

comment:5 Changed 12 years ago by jmroot (Joshua Root)

Devel::CheckLib is included in the XML::Parser source BTW.

Changed 12 years ago by jmroot (Joshua Root)

Attachment: respect-CC.patch added

comment:6 Changed 12 years ago by jmroot (Joshua Root)

Keywords: haspatch added

So actually the problem is that Devel::CheckLib ignores the compiler we asked for and just uses $Config{cc}. This doesn't affect the compiler used in the generated Makefile at all, but only the one used to check for expat.

comment:7 in reply to:  4 Changed 12 years ago by pietvo (Pieter van Oostrum)

Replying to jmr@…:

Where are you seeing gcc-4.2 required? We should be specifying an appropriate compiler explicitly; for example in the attached main.log you can see that the configure command is:

/opt/local/bin/perl5.12 Makefile.PL INSTALLDIRS=vendor CC="/usr/bin/clang" LD="/usr/bin/clang"

I saw them in the generated Makefiles:

./Expat/Makefile:32:CC = /usr/bin/gcc-4.2
./Expat/Makefile:39:LD = env MACOSX_DEPLOYMENT_TARGET=10.6 /usr/bin/gcc-4.2
./Expat/Makefile:305:	/usr/bin/gcc-4.2 -E -c $(PASTHRU_INC) $(INC) \
./Makefile:412:	/usr/bin/gcc-4.2 -E -c $(PASTHRU_INC) $(INC) \

comment:8 in reply to:  6 Changed 12 years ago by pietvo (Pieter van Oostrum)

Replying to jmr@…:

So actually the problem is that Devel::CheckLib ignores the compiler we asked for and just uses $Config{cc}. This doesn't affect the compiler used in the generated Makefile at all, but only the one used to check for expat.

OK, The Devel::CheckLib doc says:

You must have a C compiler installed. We check for $Config{cc}, both literally as it is in Config.pm and also in the $PATH.

And indeed, the error message "Couldn't find your C compiler" comes from Devel::CheckLib, and it bails out. That's the reason it fails on the "use Devel::Config" line.

comment:9 Changed 12 years ago by dbevans (David B. Evans)

I ran into this same problem today while doing a clean install of MacPorts on a Snow Leopard test machine.

My configuration:

Mac OSX 10.6.8, x86_64, XCode 3.2.6, MacPorts 2.1.2

As reported above, I agree that this port (and possibly other Perl ports) are using Config.pm alone to determine the correct compiler path to use. The trouble occurs when this does not match the current Xcode compiler path (which MacPorts correctly identifies).

If my case, Config.pm says

'/usr/bin/gcc-4.2' (doesn't exist here)

but MacPorts says

 '/Developer/usr/bin/gcc-4.2' (which is correct)

perl5 (perl5.12 @5.12.4_1+universal) was installed from binary archive. Rebuilding perl5 from source on this machine

sudo port -f uninstall perl5.12 @5.12.4_1+universal
sudo port -s install perl5.12 @5.12.4_1+universal

solved the problem without any further patches.

So I conclude that the build environment for the binary archive and mine are different, possibly an Xcode installation problem.

I'm thinking there is a missing symbolic link from /usr/bin/gcc-4.2 -> /Developer/usr/bin/gcc-4.2 here?

comment:10 Changed 12 years ago by jmroot (Joshua Root)

Cc: devans@… added

@devans: You don't have the same problem. If you don't have /usr/bin/gcc-4.2 with Xcode 3.2.6, you haven't installed the UNIX Development component correctly.

Nobody using Xcode 4.2 has yet reported whether the patch works for them.

comment:11 in reply to:  9 ; Changed 12 years ago by pietvo (Pieter van Oostrum)

Replying to devans@…:

As reported above, I agree that this port (and possibly other Perl ports) are using Config.pm alone to determine the correct compiler path to use. The trouble occurs when this does not match the current Xcode compiler path (which MacPorts correctly identifies).

If my case, Config.pm says

'/usr/bin/gcc-4.2' (doesn't exist here)

but MacPorts says

 '/Developer/usr/bin/gcc-4.2' (which is correct)

I have XCode 4.2 but there is no /Developer/usr/bin/gcc-4.2.

perl5 (perl5.12 @5.12.4_1+universal) was installed from binary archive. Rebuilding perl5 from source on this machine

sudo port -f uninstall perl5.12 @5.12.4_1+universal
sudo port -s install perl5.12 @5.12.4_1+universal

solved the problem without any further patches.

I also did this and now the Config.pm has /usr/bin/clang as C compiler. With this setting now uninstalling p5-xml-parser and reinstalling it from source succeeds without problems. Why my previous upgrade of perl5 did not solve it I don't know. Maybe just an upgrade isn't thorough enough.

comment:12 in reply to:  10 Changed 12 years ago by dbevans (David B. Evans)

Replying to jmr@…:

@devans: You don't have the same problem. If you don't have /usr/bin/gcc-4.2 with Xcode 3.2.6, you haven't installed the UNIX Development component correctly.

Nobody using Xcode 4.2 has yet reported whether the patch works for them.

@jmr: Yes, I agree. After doing a clean re-install of Xcode from the SL install disk and then upgrading to 3.2.6 via Software Update, the miss match between the Config.pm installed with the archived binary and my build environment was resolved.

comment:13 in reply to:  11 Changed 12 years ago by jmroot (Joshua Root)

Replying to piet@…:

I have XCode 4.2 but there is no /Developer/usr/bin/gcc-4.2.

Yes, there is no gcc-4.2 in Xcode 4.2 or later.

comment:14 Changed 12 years ago by jmroot (Joshua Root)

Resolution: fixed
Status: newclosed

Well, since piet rebuilt perl locally and is thus no longer able to test this, and the original reporter doesn't seem inclined to reply, I went ahead and committed the patch in r97424. Feel free to reopen if the problem isn't fixed.

Note: See TracTickets for help on using tickets.