Subject: 'C compiler cannot create executables' on Darwin
To: None <tech-pkg@netbsd.org>
From: David Hopper <DHOP@gesi.net>
List: tech-pkg
Date: 12/22/2003 12:47:39
Hi all.  Something is broken on this OS X pkgsrc installation, such that for
certain packages (most of them, unless they are terribly simple) configure
fails when run from pkgsrc (via bmake in, say, devel/gettext-lib), but
completes when run explicitly within the working directory.

I get the following broken config.log:

---
configure:1817: checking for C compiler default output
configure:1820: gcc -O2 -I/Volumes/NetBSD/pkg/include
-D_INTL_REDIRECT_MACROS=1 -DSTATIC=static -no-cpp-precomp
-I/Volumes/NetBSD/pkg/include  -Wl,-L/usr/lib -liconv
-L/Volumes/NetBSD/pkg/lib conftest.c  >&5
ld: can't open:  (No such file or directory, errno = 2)
configure:1823: $? = 1
configure: failed program was:
#line 1801 "configure"
#include "confdefs.h"

int
main ()
{

  ;
  return 0;
}
configure:1846: error: C compiler cannot create executables

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

ac_cv_env_CC_set=set
ac_cv_env_CC_value=gcc
ac_cv_env_CFLAGS_set=set
ac_cv_env_CFLAGS_value='-O2 -I/Volumes/NetBSD/pkg/include'
ac_cv_env_CPPFLAGS_set=set
ac_cv_env_CPPFLAGS_value=' -D_INTL_REDIRECT_MACROS=1 -DSTATIC=static
-no-cpp-precomp -I/Volumes/NetBSD/pkg/include'
ac_cv_env_CPP_set=
ac_cv_env_CPP_value=
ac_cv_env_CXXFLAGS_set=set
ac_cv_env_CXXFLAGS_value='-O2 -I/Volumes/NetBSD/pkg/include'
ac_cv_env_CXX_set=set
ac_cv_env_CXX_value=g++
ac_cv_env_GCJFLAGS_set=
ac_cv_env_GCJFLAGS_value=
ac_cv_env_GCJ_set=
ac_cv_env_GCJ_value=
ac_cv_env_LDFLAGS_set=set
ac_cv_env_LDFLAGS_value=' -Wl,-L/usr/lib -liconv -L/Volumes/NetBSD/pkg/lib'
ac_cv_env_build_alias_set=
ac_cv_env_build_alias_value=
ac_cv_env_host_alias_set=set
ac_cv_env_host_alias_value=powerpc-apple-darwin
ac_cv_env_target_alias_set=
ac_cv_env_target_alias_value=
ac_cv_prog_AWK=/usr/bin/awk
ac_cv_prog_CC=gcc
ac_cv_prog_make_bmake_set=yes
lt_cv_sys_path_separator=:

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

#define PACKAGE "gettext"
#define VERSION "0.11.5"
---

I've removed all pkgsrc binaries and started from bootstrap again and again
(and have updated daily over the course of several weeks), but I get the
same error.  Diffs between a non-error config.log (configure run within work
directory) and broken config.log (via 'sudo bmake' in top level):

working config.log:
---
< configure:1820: gcc    conftest.c  >&5
< configure:1823: $? = 0
< configure:1852: result: a.out
< configure:1857: checking whether the C compiler works
< configure:1863: ./a.out
< configure:1866: $? = 0
< configure:1881: result: yes
---

broken config.log:
---
> configure:1820: gcc -O2 -I/Volumes/NetBSD/pkg/include
-D_INTL_REDIRECT_MACROS=1 -DSTATIC=static -no-cpp-precomp
-I/Volumes/NetBSD/pkg/include  -Wl,-L/usr/lib -liconv -L/Volumes/NetBSD/pkg/lib
conftest.c  >&5
> ld: can't open:  (No such file or directory, errno = 2)
> configure:1823: $? = 1
---

I can't see the error condition, as libiconv is right where the compiler
expects to see it.

This is Darwin 7.2.0, aka 10.3.2.  Any help with this would be greatly
appreciated!

Stumped,
--Dave