Opened 13 years ago

Closed 13 years ago

Last modified 12 years ago

#30628 closed defect (invalid)

C compiler cannot create executables under Lion

Reported by: whittaker007@… Owned by: macports-tickets@…
Priority: Normal Milestone:
Component: ports Version: 2.0.1
Keywords: Cc:
Port:

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

I am a long time user of Macports, and when I upgraded my existing installation everything seemed to be working until I tried to install a new port and got the "C compiler cannot create executables" error. I was able to run selfupdate, but upgrade outdated failed with the same error.

I decided to start from scratch, uninstalled and cleaned all my ports, downloaded the latest Xcode package from the Apple App Store and installed it, then downloaded the latest MacPorts installer for Lion from the website, and installed that.

All seemed to go OK until I tried to install my first port under the new installation, and it fails with the above error again. Here's what I get:

$ sudo port install -v coreutils
Password:
--->  Computing dependencies for coreutils
--->  Dependencies to be installed: autoconf help2man gettext expat libiconv gperf ncurses ncursesw p5-locale-gettext perl5 perl5.12 perl5 m4 automake gmp libtool
--->  Configuring expat
Error: Target org.macports.configure returned: configure failure: shell command failed (see log for details)
Error: Failed to install expat
Log for expat is at: /opt/local/var/macports/logs/_opt_local_var_macports_sources_rsync.macports.org_release_ports_textproc_expat/expat/main.log
Error: The following dependencies were not installed: autoconf help2man gettext expat libiconv gperf ncurses ncursesw p5-locale-gettext perl5 perl5.12 perl5 m4 automake gmp libtool
Error: Status 1 encountered during processing.
To report a bug, see <http://guide.macports.org/#project.tickets>
$ cat /opt/local/var/macports/logs/_opt_local_var_macports_sources_rsync.macports.org_release_ports_textproc_expat/expat/main.log
version:1
:debug:main changing euid/egid - current euid: 0 - current egid: 0
:debug:main egid changed to: 501
:debug:main euid changed to: 502
:debug:main Executing org.macports.main (expat)
:debug:main Privilege de-escalation not attempted as not running as root.
:debug:main Skipping completed org.macports.archivefetch (expat)
:debug:main Privilege de-escalation not attempted as not running as root.
:debug:main Skipping completed org.macports.fetch (expat)
:debug:main Privilege de-escalation not attempted as not running as root.
:debug:main Skipping completed org.macports.checksum (expat)
:debug:main Privilege de-escalation not attempted as not running as root.
:debug:main Skipping completed org.macports.extract (expat)
:debug:main Privilege de-escalation not attempted as not running as root.
:debug:main Skipping completed org.macports.patch (expat)
:debug:main Privilege de-escalation not attempted as not running as root.
:debug:configure configure phase started at Sun Aug  7 13:37:11 NZST 2011
:notice:configure --->  Configuring expat
:debug:configure Using compiler 'Mac OS X llvm-gcc 4.2'
:debug:configure Executing org.macports.configure (expat)
:debug:configure Environment: CPATH='/opt/local/include' CFLAGS='-pipe -O2 -arch x86_64' CPPFLAGS='-I/opt/local/include' CXXFLAGS='-pipe -O2 -arch x86_64' LIBRARY_PATH='/opt/local/lib' MACOSX_DEPLOYMENT_TARGET='10.7' CXX='/Developer/usr/bin/llvm-g++-4.2' CC_PRINT_OPTIONS_FILE='/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_ports_textproc_expat/expat/work/.CC_PRINT_OPTIONS' F90FLAGS='-pipe -O2 -m64' LDFLAGS='-L/opt/local/lib -arch x86_64' OBJC='/Developer/usr/bin/llvm-gcc-4.2' FCFLAGS='-pipe -O2 -m64' INSTALL='/usr/bin/install -c' OBJCFLAGS='-pipe -O2 -arch x86_64' FFLAGS='-pipe -O2 -m64' CC_PRINT_OPTIONS='YES' CC='/Developer/usr/bin/llvm-gcc-4.2'
:debug:configure Assembled command: 'cd "/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_ports_textproc_expat/expat/work/expat-2.0.1" && ./configure --prefix=/opt/local --mandir=/opt/local/share/man'
:debug:configure Executing command line:  cd "/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_ports_textproc_expat/expat/work/expat-2.0.1" && ./configure --prefix=/opt/local --mandir=/opt/local/share/man 
:info:configure checking build system type... i386-apple-darwin11.0.0
:info:configure checking host system type... i386-apple-darwin11.0.0
:info:configure checking for gcc... /Developer/usr/bin/llvm-gcc-4.2
:info:configure checking for C compiler default output file name... configure: error: C compiler cannot create executables
:info:configure See `config.log' for more details.
:info:configure shell command " cd "/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_ports_textproc_expat/expat/work/expat-2.0.1" && ./configure --prefix=/opt/local --mandir=/opt/local/share/man " returned error 77
:error:configure Target org.macports.configure returned: configure failure: shell command failed (see log for details)
:debug:configure Backtrace: configure failure: shell command failed (see log for details)
    while executing
"$procedure $targetname"
:info:configure Warning: the following items did not execute (for expat): org.macports.activate org.macports.configure org.macports.build org.macports.destroot org.macports.install
:error:configure Failed to install expat
:notice:configure Log for expat is at: /opt/local/var/macports/logs/_opt_local_var_macports_sources_rsync.macports.org_release_ports_textproc_expat/expat/main.log

Is there something I'm missing?

Change History (26)

comment:1 Changed 13 years ago by whittaker007@…

Cc: whittaker007@… added

Cc Me!

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

Cc: whittaker007@… removed
Description: modified (diff)

comment:4 Changed 13 years ago by ryandesign (Ryan Carsten Schmidt)

"C compiler cannot create executables" means Xcode is not installed correctly. Note that downloading Xcode from the App Store only places the Xcode installer into the Applications folder; you still need to run that installer in order to actually install Xcode. So please (re-)install Xcode, then clean the port ("sudo port clean expat") and try again. If that does not help and you get the same message, attach the config.log so we can see what happened.

comment:5 Changed 13 years ago by ryandesign (Ryan Carsten Schmidt)

If, as a long-time user of MacPorts, you are upgrading to Lion from a previous version of Mac OS X, you should take a look at the Migration page as well.

comment:6 Changed 13 years ago by whittaker007@…

Hi, yes I ran the Xcode installer after downloading it, and the procedure under the Migration page is the one I followed. I'd send you the output of the config.log but I'm currently restoring an outdated but working copy of /opt from a time machine backup.

The new Xcode installer seems to come with no configurable options at all about what to include or not - perhaps the C libraries are no longer installed by default and require some undocumented procedure to extract them from the installer? Or something?

comment:7 in reply to:  4 Changed 13 years ago by whittaker007@…

Replying to ryandesign@…:

"C compiler cannot create executables" means Xcode is not installed correctly. Note that downloading Xcode from the App Store only places the Xcode installer into the Applications folder; you still need to run that installer in order to actually install Xcode. So please (re-)install Xcode, then clean the port ("sudo port clean expat") and try again. If that does not help and you get the same message, attach the config.log so we can see what happened.

OK here's the output of gperf's config.log:

$ cat /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_ports_devel_gperf/gperf/work/gperf-3.0.4/config.log

This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.

It was created by configure, which was
generated by GNU Autoconf 2.61.  Invocation command line was

  $ ./configure --prefix=/opt/local --infodir=/opt/local/share/info

## --------- ##
## Platform. ##
## --------- ##

hostname = Scotts-Mac-Air.local
uname -m = x86_64
uname -r = 11.0.0
uname -s = Darwin
uname -v = Darwin Kernel Version 11.0.0: Sat Jun 18 12:56:35 PDT 2011; root:xnu-1699.22.73~1/RELEASE_X86_64

/usr/bin/uname -p = i386
/bin/uname -X     = unknown

/bin/arch              = unknown
/usr/bin/arch -k       = unknown
/usr/convex/getsysinfo = unknown
/usr/bin/hostinfo      = Mach kernel version:
	 Darwin Kernel Version 11.0.0: Sat Jun 18 12:56:35 PDT 2011; root:xnu-1699.22.73~1/RELEASE_X86_64
Kernel configured for up to 2 processors.
2 processors are physically available.
2 processors are logically available.
Processor type: i486 (Intel 80486)
Processors active: 0 1
Primary memory available: 2.00 gigabytes
Default processor set: 105 tasks, 537 threads, 2 processors
Load average: 3.91, Mach factor: 0.30
/bin/machine           = unknown
/usr/bin/oslevel       = unknown
/bin/universe          = unknown

PATH: /opt/local/bin
PATH: /opt/local/sbin
PATH: /bin
PATH: /sbin
PATH: /usr/bin
PATH: /usr/sbin


## ----------- ##
## Core tests. ##
## ----------- ##

configure:1609: checking whether make sets $(MAKE)
configure:1634: result: no
configure:1797: creating ./config.status
configure:2341: error: could not make ./config.status

## ---------------- ##
## Cache variables. ##
## ---------------- ##

ac_cv_env_build_alias_set=
ac_cv_env_build_alias_value=
ac_cv_env_host_alias_set=
ac_cv_env_host_alias_value=
ac_cv_env_target_alias_set=
ac_cv_env_target_alias_value=
ac_cv_prog_make_make_set=no

## ----------------- ##
## Output variables. ##
## ----------------- ##

DEFS='-DPACKAGE_NAME=\"\" -DPACKAGE_TARNAME=\"\" -DPACKAGE_VERSION=\"\" -DPACKAGE_STRING=\"\" -DPACKAGE_BUGREPORT=\"\" -DPACKAGE_NAME=\"\" -DPACKAGE_TARNAME=\"\" -DPACKAGE_VERSION=\"\" -DPACKAGE_STRING=\"\" -DPACKAGE_BUGREPORT=\"\"'
ECHO_C='ECHO_N=''
ECHO_T=''
LIBOBJS=''
LIBS=''
LTLIBOBJS=''
PACKAGE_BUGREPORT=''
PACKAGE_NAME=''
PACKAGE_STRING=''
PACKAGE_TARNAME=''
PACKAGE_VERSION=''
PATH_SEPARATOR=':'
SET_MAKE='MAKE=make'
SHELL='/bin/sh'
bindir='${exec_prefix}/bin'
build_alias=''
datadir='${datarootdir}'
datarootdir='${prefix}/share'
docdir='${datarootdir}/doc/${PACKAGE}'
dvidir='${docdir}'
exec_prefix='${prefix}'
host_alias=''
htmldir='${docdir}'
includedir='${prefix}/include'
infodir='/opt/local/share/info'
libdir='${exec_prefix}/lib'
libexecdir='${exec_prefix}/libexec'
localedir='${datarootdir}/locale'
localstatedir='${prefix}/var'
mandir='${datarootdir}/man'
oldincludedir='/usr/include'
pdfdir='${docdir}'
prefix='/opt/local'
program_transform_name='s,x,x,'
psdir='${docdir}'
sbindir='${exec_prefix}/sbin'
sharedstatedir='${prefix}/com'
subdirs=' lib src tests doc'
sysconfdir='${prefix}/etc'
target_alias=''

## ----------- ##
## confdefs.h. ##
## ----------- ##

#define PACKAGE_NAME ""
#define PACKAGE_TARNAME ""
#define PACKAGE_VERSION ""
#define PACKAGE_STRING ""
#define PACKAGE_BUGREPORT ""
#define PACKAGE_NAME ""
#define PACKAGE_TARNAME ""
#define PACKAGE_VERSION ""
#define PACKAGE_STRING ""
#define PACKAGE_BUGREPORT ""

configure: exit 1

It sounds like it has a problem with make, but make definitely exists:

which make
/usr/bin/make

comment:8 Changed 13 years ago by ryandesign (Ryan Carsten Schmidt)

I can't explain why that's happening, except perhaps if you had a previous failed gperf configure attempt and haven't cleaned. Try cleaning. ("sudo port clean gperf")

comment:9 in reply to:  8 Changed 13 years ago by whittaker007@…

Replying to ryandesign@…:

I can't explain why that's happening, except perhaps if you had a previous failed gperf configure attempt and haven't cleaned. Try cleaning. ("sudo port clean gperf")

No, it's no good. I tried that and it didn't work, so I decided to start completely from scratch and trashed /opt, restarted the computer, installed Macports again and I still can't install anything.

comment:10 Changed 13 years ago by Veence (Vincent)

It seems the compiler does not have permission to write it's output to disk. Have you checked that? To whom belongs the Macports tree?

comment:11 Changed 13 years ago by Veence (Vincent)

Read “its”, not “it's”. Darn iPhone assisted keyboard input…

comment:12 Changed 13 years ago by whittaker007@…

/opt and all it's subfolders are owned by my (admin) user and the staff group. It was all writable by the owner but not the group. Granting write permissions to the group did not help.

/Developer on the other hand is owned by root and has admin group. Owner and group both have read write permissions.

One thought I did have though is that if Xcode is providing make and gcc, then I would expect perhaps those binaries would exist under /Developer. They don't for me. Here is the chain of symlinks I have for make and gcc:

$ which make
/usr/bin/make

$ ll /usr/bin/make
4.0K lrwxr-xr-x 1 root wheel 7 Aug  7 14:01 /usr/bin/make -> gnumake

$ll /usr/bin/gcc
4.0K lrwxr-xr-x 1 root wheel 12 Aug  7 14:01 /usr/bin/gcc -> llvm-gcc-4.2
 
$ ll /usr/bin/llvm-gcc-4.2
4.0K lrwxr-xr-x 1 root admin 32 Aug  7 14:01 /usr/bin/llvm-gcc-4.2 -> ../llvm-gcc-4.2/bin/llvm-gcc-4.2

Does that look right?

comment:13 in reply to:  12 ; Changed 13 years ago by ryandesign (Ryan Carsten Schmidt)

Replying to whittaker007@…:

/opt and all it's subfolders are owned by my (admin) user and the staff group. It was all writable by the owner but not the group. Granting write permissions to the group did not help.

The usual setup is for /opt/local and subfolders to be owned by root. Are you deliberately changing this?

One thought I did have though is that if Xcode is providing make and gcc, then I would expect perhaps those binaries would exist under /Developer.

That is not where MacPorts looks for them.

Does that look right?

Yes.

comment:14 in reply to:  13 Changed 13 years ago by whittaker007@…

Replying to ryandesign@…:

The usual setup is for /opt/local and subfolders to be owned by root. Are you deliberately changing this?

No, that's just how the macports installer created it. I changed the ownerships to root:wheel and tried again. It didn't help.

Does that look right?

Yes.

Hmmm, I'm about all out of ideas. Thanks anyway for your help.

comment:15 Changed 13 years ago by whittaker007@…

I just did a small "hello world" c script and makefile and I was able to use the makefile to compile it into an executable. Sounds almost like the port command is losing root access event though it is executed with sudo authentication.

comment:16 Changed 13 years ago by Veence (Vincent)

Well, normally, if I’m not mistaken, Macports DO resign root privilege when not needed. Have you checked the permission of the temporary directory gcc outputs its file to?

comment:17 Changed 13 years ago by whittaker007@…

I had the same issue on a different computer, but that mac was originally cloned from the same machine some months earlier. I eventually reinstalled Lion from scratch and Macports now works without issue.

comment:18 Changed 13 years ago by whittaker007@…

I can't believe it - it was working with a fresh install of Lion, but I just tried a port upgrade outdated, and I'm getting that same issue again. Deleting /opt and reinstalling Macports doesn't help. So I'm back where I started, Macports is clearly conflicting with something I have installed on my system but I have no idea what.

What exactly does Macports interact with outside of /opt ?

comment:19 Changed 13 years ago by nate@…

I am having the same exact problem. Have done a complete uninstall of MacPorts (according to the wiki uninstall page) and still no luck installing any ports. When I manually run the configure command from the log it works fine, but doing it via "port install" gives me the problem described above

comment:20 Changed 13 years ago by nate@…

I fixed it:

(I had already done a complete uninstall of macports debugging so not sure if that is part of the solution)

  • did a full uninstall of Xcode: sudo /Developer/Library/uninstall-devtools --mode=all
  • deleted my /Developer folder
  • installed Xcode from /Applications/Install Xcode.localized/Install Xcode.app/Contents/Resources/Xcode.mpkg (may be able to just run /Applications/Install Xcode.localized/Install Xcode.app)
  • installed MacPorts
  • did a selfupdate

All good now!

comment:21 Changed 13 years ago by mf2k (Frank Schima)

Resolution: invalid
Status: newclosed

This is a setup issue. There is nothing to be fixed.

comment:22 Changed 13 years ago by whittaker007@…

Uninstalled and purged Xcode and Macports, restarted, reinstalled, restarted. Tried this 3 more times, same result. I'm out of ideas. I guess it's time to try homebrew.

comment:23 Changed 13 years ago by nate@…

Resolution: invalid
Status: closedreopened

Now it isn't working again. 1 week later and the next time I tried to use macports, fail at same place as before. not going to completely uninstall and reinstall Xcode every time I want to use macports. not sure what has changed since last time except maybe a reboot.

comment:24 Changed 13 years ago by mf2k (Frank Schima)

Resolution: invalid
Status: reopenedclosed

It's still a setup problem. There's nothing to fix because it works fine for most people. Xcode only needs to be installed properly once. Use the macports-users mailing list for further help.

comment:25 Changed 12 years ago by ilsinszkibal@…

Hi,

Had the same problem and found the solution on an other bug. You need Xcode's Command Line Tool.

Go into XCode/Preferences/Downloads tab and there you can install the Command Line Tool.

Balazs

comment:26 in reply to:  25 ; Changed 12 years ago by ajh158@…

Replying to ilsinszkibal@…:

Hi,

Had the same problem and found the solution on an other bug. You need Xcode's Command Line Tool.

Go into XCode/Preferences/Downloads tab and there you can install the Command Line Tool.

Balazs

Thank you for this information - this helped me!

comment:27 in reply to:  26 Changed 12 years ago by ajh158@…

After installing Command Line Tool, I also had to do 'sudo xcode-select -switch /Applications/Xcode.app/' as described in this SO article.

Replying to ajh158@…:

Replying to ilsinszkibal@…:

Hi,

Had the same problem and found the solution on an other bug. You need Xcode's Command Line Tool.

Go into XCode/Preferences/Downloads tab and there you can install the Command Line Tool.

Balazs

Thank you for this information - this helped me!

Note: See TracTickets for help on using tickets.