Opened 12 years ago

Closed 11 years ago

Last modified 11 years ago

#36226 closed defect (fixed)

libstdcxx @4.7.1: cc1 in stage1 can't be built on PPC Tiger (Mac OS X 10.4.11) due to undefined symbols

Reported by: ballapete (Peter "Pete" Dyballa) Owned by: jeremyhu (Jeremy Huddleston Sequoia)
Priority: Normal Milestone:
Component: ports Version: 2.1.2
Keywords: Cc: mww@…, cooljeanius (Eric Gallager)
Port: libstdcxx

Description

This is the failure:

/usr/bin/gcc-4.0 -arch ppc   -g -fkeep-inline-functions -DIN_GCC   -W -Wall -Wwrite-strings -Wcast-qual -Wstrict-prototypes -Wmissing-prototypes -Wmissing-format-attribute -Wold-style-definition -fno-common  -DHAVE_CONFIG_H -L/opt/local/lib -o cc1 c-lang.o c-family/stub-objc.o attribs.o c-errors.o c-decl.o c-typeck.o c-convert.o c-aux-info.o c-objc-common.o c-parser.o tree-mudflap.o c-family/c-common.o c-family/c-cppbuiltin.o c-family/c-dump.o c-family/c-format.o c-family/c-gimplify.o c-family/c-lex.o c-family/c-omp.o c-family/c-opts.o c-family/c-pch.o c-family/c-ppoutput.o c-family/c-pragma.o c-family/c-pretty-print.o c-family/c-semantics.o c-family/c-ada-spec.o darwin-c.o rs6000-c.o \
  cc1-checksum.o main.o tree-browser.o libbackend.a libcommon-target.a libcommon.a ../libcpp/libcpp.a ../libdecnumber/libdecnumber.a libcommon.a ../libcpp/libcpp.a  -liconv ../libiberty/libiberty.a ../libdecnumber/libdecnumber.a  -L/opt/local/lib -lcloog-isl -lisl -L/opt/local/lib -lppl_c -lppl  -lgmpxx -L/opt/local/lib -L/opt/local/lib -L/opt/local/lib -lmpc -lmpfr -lgmp   -lz
/usr/libexec/gcc/powerpc-apple-darwin8/4.0.1/ld: warning suggest use of -bind_at_load, as lazy binding may result in errors or different symbols being used
/usr/libexec/gcc/powerpc-apple-darwin8/4.0.1/ld: Undefined symbols:
typeinfo for std::logic_error
typeinfo for std::runtime_error
typeinfo for std::basic_streambuf<char, std::char_traits<char> >
typeinfo for std::bad_alloc
typeinfo for std::exception
typeinfo for int
VTT for std::basic_ostringstream<char, std::char_traits<char>, std::allocator<char> >
vtable for std::basic_istream<char, std::char_traits<char> >
vtable for std::basic_ostream<char, std::char_traits<char> >
vtable for std::basic_streambuf<char, std::char_traits<char> >
vtable for std::basic_stringbuf<char, std::char_traits<char>, std::allocator<char> >
vtable for std::basic_ostringstream<char, std::char_traits<char>, std::allocator<char> >
vtable for std::basic_ios<char, std::char_traits<char> >
operator delete(void*)
operator new(unsigned long)
operator delete[](void*)
operator new[](unsigned long)
symbol ___gmpz_neg used from dynamic library /opt/local/lib/libgmp.dylib(single module) not from earlier dynamic library /opt/local/lib/libppl_c.4.dylib(single module)
collect2: ld returned 1 exit status
make[3]: *** [cc1] Error 1

Attachments (1)

main.log (479.0 KB) - added by ballapete (Peter "Pete" Dyballa) 12 years ago.
…gcc47/libstdcxx/main.log

Download all attachments as: .zip

Change History (35)

Changed 12 years ago by ballapete (Peter "Pete" Dyballa)

Attachment: main.log added

…gcc47/libstdcxx/main.log

comment:1 Changed 12 years ago by mf2k (Frank Schima)

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

comment:2 Changed 11 years ago by jeremyhu (Jeremy Huddleston Sequoia)

Resolution: fixed
Status: newclosed

I believe this is fixed per #34385

comment:3 in reply to:  2 Changed 11 years ago by ballapete (Peter "Pete" Dyballa)

Replying to jeremyhu@…:

I believe this is fixed per #34385

Working with port 2.2.99 on Tiger I have:

pete 239 /\ l /opt/mports/trunk/dports/lang/libstdcxx/
insgesamt 4
-rw-r--r-- 1 root admin 284 13. Aug 00:14 Portfile
pete 240 /\ l /opt/mports/trunk/dports/lang/gcc48/
insgesamt 16
-rw-r--r-- 1 root admin 9364 13. Aug 00:15 Portfile
drwxr-xr-x 3 root admin  102 13. Aug 00:14 files
lrwxr-xr-x 1 root admin   76 13. Aug 00:21 work -> /opt/local/var/macports/build/_opt_mports_trunk_dports_lang_gcc48/gcc48/work

libstdcxx still does not build:

/opt/local/bin/g++-apple-4.2 -arch ppc   -g -DIN_GCC   -fno-exceptions -fno-rtti -fasynchronous-unwind-tables -W -Wall -Wwrite-strings -Wcast-qual -Wmissing-format-attribute -pedantic -Wno-long-long -Wno-variadic-macros -Wno-overlength-strings -fno-common  -DHAVE_CONFIG_H -L/opt/local/lib -Wl,-headerpad_max_install_names -o cc1 c/c-lang.o c-family/stub-objc.o attribs.o c/c-errors.o c/c-decl.o c/c-typeck.o c/c-convert.o c/c-aux-info.o c/c-objc-common.o c/c-parser.o c-family/c-common.o c-family/c-cppbuiltin.o c-family/c-dump.o c-family/c-format.o c-family/c-gimplify.o c-family/c-lex.o c-family/c-omp.o c-family/c-opts.o c-family/c-pch.o c-family/c-ppoutput.o c-family/c-pragma.o c-family/c-pretty-print.o c-family/c-semantics.o c-family/c-ada-spec.o tree-mudflap.o darwin-c.o rs6000-c.o \
  cc1-checksum.o libbackend.a main.o tree-browser.o libcommon-target.a libcommon.a ../libcpp/libcpp.a ../libdecnumber/libdecnumber.a libcommon.a ../libcpp/libcpp.a  -liconv ../libbacktrace/.libs/libbacktrace.a ../libiberty/libiberty.a ../libdecnumber/libdecnumber.a  -L/opt/local/lib -lcloog-isl  -lisl -L/opt/local/lib -L/opt/local/lib -L/opt/local/lib -lmpc -lmpfr -lgmp   -lz
ld: warning: object file compiled with -mlong-branch which is no longer needed. To remove this warning, recompile without -mlong-branch: /usr/lib/crt1.o
ld: warning: object file compiled with -mlong-branch which is no longer needed. To remove this warning, recompile without -mlong-branch: /opt/local/lib/apple-gcc42/gcc/powerpc-apple-darwin8/4.2.1/crt3.o
Undefined symbols:
  "__Unwind_GetIPInfo", referenced from:
      _unwind in libbacktrace.a(backtrace.o)
ld: symbol(s) not found
collect2: ld returned 1 exit status
make[3]: *** [cc1] Error 1
make[3]: Leaving directory `/opt/local/var/macports/build/_opt_mports_trunk_dports_lang_gcc48/libgcc/work/build/gcc'

comment:4 Changed 11 years ago by jeremyhu (Jeremy Huddleston Sequoia)

Resolution: fixed
Status: closedreopened

__Unwind_GetIPInfo should be provided by /usr/lib/libgcc_s.1.dylib when building with /opt/local/bin/g++-apple-4.2 on Tiger/ppc

Please verify that the symbol exists in /usr/lib/libgcc_s.1.dylib and also check the link line (-Wl,-v) to figure out why it's not picking it up.

Does it work if you force -mmacosx-version-min=10.4 ?

Last edited 11 years ago by jeremyhu (Jeremy Huddleston Sequoia) (previous) (diff)

comment:5 Changed 11 years ago by jeremyhu (Jeremy Huddleston Sequoia)

Also, what is the output of /opt/local/bin/g++-apple-4.2 --version

comment:6 in reply to:  4 ; Changed 11 years ago by ballapete (Peter "Pete" Dyballa)

Replying to jeremyhu@…:

__Unwind_GetIPInfo should be provided by /usr/lib/libgcc_s.1.dylib when building with /opt/local/bin/g++-apple-4.2 on Tiger/ppc

This symbol is not contained in /usr/lib/libgcc_s.1.dylib! It contains for example

9143ab58 T __Unwind_GetIP
00000000 a __Unwind_GetIP.eh
         U __Unwind_GetIP
         U __Unwind_GetIP

Similarly in /Developer/SDKs/MacOSX10.4u.sdk/usr/lib/libgcc_s.1.dylib:

90bf7640 T __Unwind_GetIP
         U __Unwind_GetIP
         U __Unwind_GetIP

Please verify that the symbol exists in /usr/lib/libgcc_s.1.dylib and also check the link line (-Wl,-v) to figure out why it's not picking it up.

Does it work if you force -mmacosx-version-min=10.4 ?

How and where can I add these additions? I don't understand the Portfile language well…

When I understand the Portfile correctly, then it tries to build linstdcxx from GCC 4.9.

comment:7 in reply to:  5 Changed 11 years ago by ballapete (Peter "Pete" Dyballa)

Replying to jeremyhu@…:

Also, what is the output of /opt/local/bin/g++-apple-4.2 --version

powerpc-apple-darwin8-g++-apple-4.2.1 (GCC) 4.2.1 (Apple Inc. build 5666) (dot 3) (MacPorts apple-gcc42 5666.3_11)

comment:8 Changed 11 years ago by jeremyhu (Jeremy Huddleston Sequoia)

Ah... right... __Unwind_GetIPInfo was added in Leopard:

$ nm /usr/lib/libgcc_s.10.4.dylib | grep GetIP
0000000000000ef8 S $ld$add$os10.4$__Unwind_GetIP
0000000000000ef9 S $ld$add$os10.5$__Unwind_GetIP
0000000000000f8a S $ld$add$os10.5$__Unwind_GetIPInfo
Last edited 11 years ago by jeremyhu (Jeremy Huddleston Sequoia) (previous) (diff)

comment:9 in reply to:  6 Changed 11 years ago by jeremyhu (Jeremy Huddleston Sequoia)

The implementation for the missing symbol is:

uintptr_t _Unwind_GetIPInfo(struct _Unwind_Context* context, int* ipBefore)
{
    *ipBefore = 0;
    return _Unwind_GetIP(context);
}

Replying to Peter_Dyballa@…:

Replying to jeremyhu@…:

Does it work if you force -mmacosx-version-min=10.4 ?

How and where can I add these additions? I don't understand the Portfile language well…

This doesn't have to do with the Portfile. You need to manually figure out what file has the reference to the missing symbol and recompile that file (look in the log to see the compilation line) manually. Then compare with and without -mmacosx-version-min=10.4 ... I'll look at apple-gcc42 to see if I can spot the problem.

Last edited 11 years ago by jeremyhu (Jeremy Huddleston Sequoia) (previous) (diff)

comment:10 Changed 11 years ago by jeremyhu (Jeremy Huddleston Sequoia)

Actually, from the link failure above, I suspect that the problem isn't so much with the deployment target as with gcc48 probably not checking that deployment target.

Looking at the apple-gcc42 sources, there is a macro set in config.h that indicates whether or not __Unwind_GetIPInfo is available. I suspect that backtrace.c ignores it, so the fix would be to change something like this:

_Unwind_GetIPInfo(context, ipBefore);

into this:

#if HAVE_GETIPINFO
_Unwind_GetIPInfo(context, ipBefore);
#else
*ipBefore = 0;
_Unwind_GetIP(context);
#endif

Can you please try that and provide a patch?

Last edited 11 years ago by jeremyhu (Jeremy Huddleston Sequoia) (previous) (diff)

comment:11 in reply to:  8 Changed 11 years ago by ballapete (Peter "Pete" Dyballa)

Replying to jeremyhu@…:

Ah... right... __Unwind_GetIPInfo was added in Leopard:

I tested the libraries from the apple-gcc42 and llvm-2.9 ports and found:

nm /opt/local/lib/apple-gcc42/gcc/powerpc-apple-darwin8/4.2.1/libgcc_eh.a | grep Unwind_GetIPInfo
nm: no name list
00000fe0 T __Unwind_GetIPInfo
00000000 A __Unwind_GetIPInfo.eh
         U __Unwind_GetIPInfo

comment:12 in reply to:  10 ; Changed 11 years ago by ballapete (Peter "Pete" Dyballa)

Replying to jeremyhu@…:

Actually, from the link failure above, I suspect that the problem isn't so much with the deployment target as with gcc48 probably not checking that deployment target.

At the moment I am trying to find out why and where it gets set that the function is available. It seems that the configure script in libbacktrace is introducing the error:

checking unwind.h usability... yes
checking unwind.h presence... yes
checking for unwind.h... yes
checking for _Unwind_Backtrace... yes
checking for -funwind-tables option... yes
checking for -frandom-seed=string option... yes
checking whether /opt/local/bin/gcc-apple-4.2 -arch ppc supports -W... yes
checking whether /opt/local/bin/gcc-apple-4.2 -arch ppc supports -Wall... yes
checking whether /opt/local/bin/gcc-apple-4.2 -arch ppc supports -Wwrite-strings... yes
checking whether /opt/local/bin/gcc-apple-4.2 -arch ppc supports -Wstrict-prototypes... yes
checking whether /opt/local/bin/gcc-apple-4.2 -arch ppc supports -Wmissing-prototypes... yes
checking whether /opt/local/bin/gcc-apple-4.2 -arch ppc supports -Wold-style-definition... yes
checking whether /opt/local/bin/gcc-apple-4.2 -arch ppc supports -Wmissing-format-attribute... yes
checking whether /opt/local/bin/gcc-apple-4.2 -arch ppc supports -Wcast-qual... yes
checking for _Unwind_GetIPInfo... yes

Although I have enough time to patch that script manually to make it partially more verbose for debugging, I seem to fail doing so and I think I'll create a patch file for this purpose… After sleep.

comment:13 in reply to:  12 ; Changed 11 years ago by jeremyhu (Jeremy Huddleston Sequoia)

Replying to Peter_Dyballa@…:

Replying to jeremyhu@…:

Actually, from the link failure above, I suspect that the problem isn't so much with the deployment target as with gcc48 probably not checking that deployment target.

At the moment I am trying to find out why and where it gets set that the function is available. It seems that the configure script in libbacktrace is introducing the error:

checking for _Unwind_GetIPInfo... yes

Although I have enough time to patch that script manually to make it partially more verbose for debugging, I seem to fail doing so and I think I'll create a patch file for this purpose… After sleep.

Ok, so my hunch was off. Hopefully backtrace.c is honoring HAVE_GETIPINFO and we just need to figure out why it's not getting set right... weird.

comment:14 in reply to:  13 ; Changed 11 years ago by ballapete (Peter "Pete" Dyballa)

Replying to jeremyhu@…:

Hopefully backtrace.c is honoring HAVE_GETIPINFO and we just need to figure out why it's not getting set right... weird.

I think the cause is in this report:

config.log
==========
configure:11652: checking for _Unwind_GetIPInfo
configure:11667: /opt/local/bin/gcc-apple-4.2 -arch ppc -c -g -H -Wl,-t -Werror-implicit-function-declaration  conftest.c >&5
. /opt/local/lib/apple-gcc42/gcc/powerpc-apple-darwin8/4.2.1/include/unwind.h
powerpc-apple-darwin8-gcc-apple-4.2.1: -t: linker input file unused because linking not done
configure:11667: $? = 0
configure:11674: result: yes

I patched CFLAGS a bit to see more of the compilation test. I think removing the "-c" option would be the proper test.

I also made this test:

/opt/local/bin/gcc-apple-4.2 -arch ppc -H -Wl,-t -Werror-implicit-function-declaration -lgcc_eh conftest.c
. /opt/local/lib/apple-gcc42/gcc/powerpc-apple-darwin8/4.2.1/include/unwind.h
/usr/lib/crt1.o
/opt/local/lib/apple-gcc42/gcc/powerpc-apple-darwin8/4.2.1/libgcc_eh.a
/var/tmp//ccgnzOFc.o
/usr/lib/libgcc_s.10.4.dylib
/opt/local/lib/apple-gcc42/gcc/powerpc-apple-darwin8/4.2.1/libgcc.a
/usr/lib/libSystemStubs.a
/usr/lib/libSystem.dylib
/usr/lib/system/libmathCommon.A.dylib
/opt/local/lib/apple-gcc42/gcc/powerpc-apple-darwin8/4.2.1/libgcc_eh.a(unwind-dw2.o)
ld: warning: object file compiled with -mlong-branch which is no longer needed. To remove this warning, recompile without -mlong-branch: /usr/lib/crt1.o

I actually don't know what's libgcc_eh.a good for – but it somehow works…

Here is a bit more documentation from some files as indicated:

========================================================================================
*compilation*
=============
+ CFLAGS=-g -H -Wl,-t -Werror-implicit-function-declaration
+ printf '%s\n' 'configure:11652: checking for _Unwind_GetIPInfo'
+ printf %s 'checking for _Unwind_GetIPInfo... '
checking for _Unwind_GetIPInfo... + cat confdefs.h -
+ ac_fn_c_try_compile 11667
+ as_lineno=11667
+ as_lineno_stack=as_lineno_stack=
+ rm -f conftest.o
+ ac_try=$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5
+ ac_try_echo=$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5
+ eval 'ac_try_echo="$as_me:11667: $CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5"'
++ ac_try_echo=configure:11667: /opt/local/bin/gcc-apple-4.2 -arch ppc -c -g -H -Wl,-t -Werror-implicit-function-declaration  conftest.c >&5
+ printf '%s\n' 'configure:11667: /opt/local/bin/gcc-apple-4.2 -arch ppc -c -g -H -Wl,-t -Werror-implicit-function-declaration  conftest.c >&5'
+ ac_status=0
+ test -s conftest.err
+ grep -v '^ *+' conftest.err
+ cat conftest.er1
+ mv -f conftest.er1 conftest.err
+ printf '%s\n' 'configure:11667: $? = 0'
+ test 0 = 0
+ test -z ''
+ test -s conftest.o
+ :
+ ac_retval=0
+ eval as_lineno_stack=
++ as_lineno_stack=
+ test x = x
+ as_lineno=
+ unset as_lineno
+ return 0
+ :
+ have_unwind_getipinfo=yes
+ rm -f core conftest.err conftest.o conftest.c
+ CFLAGS=-g
+ printf '%s\n' 'configure:11674: result: yes'
+ printf '%s\n' yes
yes
+ test yes = yes
+ printf '%s\n' '#define HAVE_GETIPINFO 1'
========================================================================================
configure
=========
  CFLAGS="$CFLAGS -H -Wl,-t -Werror-implicit-function-declaration"
  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for _Unwind_GetIPInfo" >&5
$as_echo_n "checking for _Unwind_GetIPInfo... " >&6; }
  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h.  */
#include "unwind.h"
	struct _Unwind_Context *context;
	int ip_before_insn = 0;
int
main ()
{
return _Unwind_GetIPInfo (context, &ip_before_insn);
  ;
  return 0;
}
_ACEOF
if ac_fn_c_try_compile "$LINENO"; then :
  have_unwind_getipinfo=yes
else
  have_unwind_getipinfo=no
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
  CFLAGS="$ac_save_CFLAGS"
  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $have_unwind_getipinfo" >&5
$as_echo "$have_unwind_getipinfo" >&6; }
  if test "$have_unwind_getipinfo" = "yes"; then

$as_echo "#define HAVE_GETIPINFO 1" >>confdefs.h

  fi
fi
========================================================================================
confdefs.h
==========
| /* confdefs.h */
| #define PACKAGE_NAME "package-unused"
| #define PACKAGE_TARNAME "libbacktrace"
| #define PACKAGE_VERSION "version-unused"
| #define PACKAGE_STRING "package-unused version-unused"
| #define PACKAGE_BUGREPORT ""
| #define PACKAGE_URL ""
| #define STDC_HEADERS 1
| #define HAVE_SYS_TYPES_H 1
| #define HAVE_SYS_STAT_H 1
| #define HAVE_STDLIB_H 1
| #define HAVE_STRING_H 1
| #define HAVE_MEMORY_H 1
| #define HAVE_STRINGS_H 1
| #define HAVE_INTTYPES_H 1
| #define HAVE_STDINT_H 1
| #define HAVE_UNISTD_H 1
| #define __EXTENSIONS__ 1
| #define _ALL_SOURCE 1
| #define _GNU_SOURCE 1
| #define _POSIX_PTHREAD_SEMANTICS 1
| #define _TANDEM_SOURCE 1
| #define HAVE_DLFCN_H 1
| #define LT_OBJDIR ".libs/"
| #define HAVE_GETIPINFO 1
| #define HAVE_SYNC_FUNCTIONS 1
| #define BACKTRACE_ELF_SIZE 
| /* end confdefs.h.  */
========================================================================================

This contents of confdefs.h is revealed a bit later. Presumingly the test for Unwind_GetIPInfo contained only the lines up to

| #define HAVE_GETIPINFO 1

I think I've done with the examination of the *compilation* buffer in GNU Emacs now, so I'm going to change my patch and I'll try to remove the "-c" and see what I'll get – in one or two days…

comment:15 in reply to:  14 ; Changed 11 years ago by jeremyhu (Jeremy Huddleston Sequoia)

Replying to Peter_Dyballa@…:

I think the cause is in this report:

config.log
==========
configure:11652: checking for _Unwind_GetIPInfo
configure:11667: /opt/local/bin/gcc-apple-4.2 -arch ppc -c -g -H -Wl,-t -Werror-implicit-function-declaration  conftest.c >&5
. /opt/local/lib/apple-gcc42/gcc/powerpc-apple-darwin8/4.2.1/include/unwind.h
powerpc-apple-darwin8-gcc-apple-4.2.1: -t: linker input file unused because linking not done
configure:11667: $? = 0
configure:11674: result: yes

Yep.

I patched CFLAGS a bit to see more of the compilation test. I think removing the "-c" option would be the proper test.

Yes, I agree.

They are looking for the symbol, and it's possible that the definition exists because of libunwind-headers (which would let it compile but not link). Do you have libunwind-headers installed? Does it work if you remove them?

I wonder if this is a regression introduced to configure in gcc48. If backtrace.c exists in gcc47, I'd focus my efforts on comparing the two configure scripts.

I actually don't know what's libgcc_eh.a good for – but it somehow works…

It's for static linking. It is not the right solution.

comment:16 Changed 11 years ago by jeremyhu (Jeremy Huddleston Sequoia)

Yep, _Unwind_GetIPInfo doesn't have availability markup, so the compiler thinks it is available on Tiger even though it isn't

comment:17 Changed 11 years ago by jeremyhu (Jeremy Huddleston Sequoia)

I fixed libunwind-headers in r110301, but it looks like the same change needs to be made to apple-gcc42

comment:18 Changed 11 years ago by jeremyhu (Jeremy Huddleston Sequoia)

Peter, can you give this a shot?

Index: Portfile
===================================================================
--- Portfile	(revision 110223)
+++ Portfile	(working copy)
@@ -6,7 +6,7 @@
 name			apple-gcc42
 version			5666.3
 set gcc_version		4.2.1
-revision		11
+revision		12
 categories		lang
 platforms		darwin
 license			{GPL-2+ Permissive}
@@ -97,6 +97,7 @@
 # incpath.patch                  : Don't prepend the -isysroot option argument to the compiler's own search paths
 # driverdriver-num_infiles.patch : Fix linking with no input files (ie all static archives passed with -l...)
 # driverdriver-armcheck.patch    : Build fix for the driverdriver when arm support is not available (eg: Tiger)
+# tiger-Unwind_GetIPInfo.patch   : https://trac.macports.org/ticket/36226
 
 patchfiles-append \
 	werror-c-incpath.patch \
@@ -103,7 +104,8 @@
 	werror-local-alloc.patch \
 	incpath.patch \
 	driverdriver-num_infiles.patch \
-	driverdriver-armcheck.patch
+	driverdriver-armcheck.patch \
+	tiger-Unwind_GetIPInfo.patch
 
 # gcj fails to build:
 # gcc/java/lang.c: In function 'java_init':
Index: files/tiger-Unwind_GetIPInfo.patch
===================================================================
--- files/tiger-Unwind_GetIPInfo.patch	(revision 0)
+++ files/tiger-Unwind_GetIPInfo.patch	(working copy)
@@ -0,0 +1,12 @@
+--- gcc/unwind-generic.h.orig	2013-08-29 12:33:52.000000000 -0700
++++ gcc/unwind-generic.h	2013-08-29 12:35:51.000000000 -0700
+@@ -155,7 +155,9 @@ extern _Unwind_Word _Unwind_GetGR (struc
+ extern void _Unwind_SetGR (struct _Unwind_Context *, int, _Unwind_Word);
+ 
+ extern _Unwind_Ptr _Unwind_GetIP (struct _Unwind_Context *);
++#if !defined(__MAC_OS_X_VERSION_MIN_REQUIRED) || __MAC_OS_X_VERSION_MIN_REQUIRED >= 1050
+ extern _Unwind_Ptr _Unwind_GetIPInfo (struct _Unwind_Context *, int *);
++#endif
+ extern void _Unwind_SetIP (struct _Unwind_Context *, _Unwind_Ptr);
+ 
+ /* @@@ Retrieve the CFA of the given context.  */

comment:19 Changed 11 years ago by jeremyhu (Jeremy Huddleston Sequoia)

That was a patch for dports/lang/apple-gcc42, if that wasn't obvious...

comment:20 in reply to:  15 ; Changed 11 years ago by ballapete (Peter "Pete" Dyballa)

Replying to jeremyhu@…:

Replying to Peter_Dyballa@…:

They are looking for the symbol, and it's possible that the definition exists because of libunwind-headers (which would let it compile but not link). Do you have libunwind-headers installed? Does it work if you remove them?

I had them, but right now they are not installed. When they were they did not change the situation.

I wonder if this is a regression introduced to configure in gcc48. If backtrace.c exists in gcc47, I'd focus my efforts on comparing the two configure scripts.

It's not. GCC 47 does not use libbacktrace. Here are the top-level directories of gcc-4.7.3:

drwxr-xr-x  14 root admin     476 11. Apr 09:59 INSTALL
drwxr-xr-x  87 root admin    2958 11. Apr 09:57 boehm-gc
drwxr-xr-x  77 root admin    2618 11. Apr 09:57 config
drwxr-xr-x  41 root admin    1394 11. Apr 09:57 contrib
drwxr-xr-x  29 root admin     986 11. Apr 09:59 fixincludes
drwxr-xr-x 649 root admin   22066 28. Aug 22:20 gcc
drwxr-xr-x   6 root admin     204 11. Apr 09:58 gnattools
drwxr-xr-x  33 root admin    1122 11. Apr 09:57 include
drwxr-xr-x  44 root admin    1496 11. Apr 09:57 intl
drwxr-xr-x   6 root admin     204 11. Apr 09:59 libada
drwxr-xr-x  30 root admin    1020 11. Apr 09:59 libcpp
drwxr-xr-x  41 root admin    1394 11. Apr 09:58 libdecnumber
drwxr-xr-x  23 root admin     782 11. Apr 09:59 libffi
drwxr-xr-x  67 root admin    2278 11. Apr 09:58 libgcc
drwxr-xr-x  38 root admin    1292 11. Apr 09:59 libgfortran
drwxr-xr-x  20 root admin     680 11. Apr 09:58 libgo
drwxr-xr-x  41 root admin    1394 11. Apr 10:13 libgomp
drwxr-xr-x 144 root admin    4896 11. Apr 09:57 libiberty
drwxr-xr-x  43 root admin    1462 11. Apr 11:12 libitm
drwxr-xr-x  78 root admin    2652 28. Aug 22:20 libjava
drwxr-xr-x  19 root admin     646 11. Apr 09:57 libmudflap
drwxr-xr-x  38 root admin    1292 11. Apr 09:58 libobjc
drwxr-xr-x  21 root admin     714 28. Aug 22:20 libquadmath
drwxr-xr-x  28 root admin     952 11. Apr 09:59 libssp
drwxr-xr-x  38 root admin    1292 11. Apr 09:57 libstdc++-v3
drwxr-xr-x  11 root admin     374 11. Apr 09:57 lto-plugin
drwxr-xr-x  10 root admin     340 11. Apr 09:58 maintainer-scripts
drwxr-xr-x  50 root admin    1700 11. Apr 09:57 zlib

I actually don't know what's libgcc_eh.a good for – but it somehow works…

It's for static linking. It is not the right solution.

Static linking was clear, but what does that "_eh" in the name signify? And why does it have the library function?

libbacktrace/configure also has this error on line #11653:

  ac_save_CFFLAGS="$CFLAGS"

GNU Emacs cannot find another occurrence of "CFFLAGS". I think the macro "ac_fn_c_try_compile" on line #11670 is the key:

if ac_fn_c_try_compile "$LINENO"; then :

Presumingly I'm ought to substitute the macro with ac_fn_c_try_link… Right?

comment:21 in reply to:  20 Changed 11 years ago by jeremyhu (Jeremy Huddleston Sequoia)

Replying to Peter_Dyballa@…:

I actually don't know what's libgcc_eh.a good for – but it somehow works…

It's for static linking. It is not the right solution.

Static linking was clear, but what does that "_eh" in the name signify? And why does it have the library function?

Search google for "dwarf exception handling unwind info __eh_frame" or similar and you should find more info than you probably want to know ;)

libbacktrace/configure also has this error on line #11653:

  ac_save_CFFLAGS="$CFLAGS"

GNU Emacs cannot find another occurrence of "CFFLAGS". I think the macro "ac_fn_c_try_compile" on line #11670 is the key:

if ac_fn_c_try_compile "$LINENO"; then :

Presumingly I'm ought to substitute the macro with ac_fn_c_try_link… Right?

Please give the change above a try (upgrade apple-gcc42 with it, then try rebuilding libgcc)

Last edited 11 years ago by jeremyhu (Jeremy Huddleston Sequoia) (previous) (diff)

comment:22 in reply to:  19 Changed 11 years ago by ballapete (Peter "Pete" Dyballa)

Replying to jeremyhu@…:

That was a patch for dports/lang/apple-gcc42, if that wasn't obvious...

Well, it wasn't! So I would have to upgrade apple-gcc42 first…

comment:23 in reply to:  18 ; Changed 11 years ago by ballapete (Peter "Pete" Dyballa)

Replying to jeremyhu@…:

Peter, can you give this a shot?

apple-gcc42 built this morning. I then started to upgrade libgcc, libstdcxx, and gcc48 – and configure in libbacktrace still finds:

checking unwind.h usability... yes
checking unwind.h presence... yes
checking for unwind.h... yes
checking for _Unwind_Backtrace... yes
checking for -funwind-tables option... yes
checking for -frandom-seed=string option... yes
checking whether /opt/local/bin/gcc-apple-4.2 -arch ppc supports -W... yes
checking whether /opt/local/bin/gcc-apple-4.2 -arch ppc supports -Wall... yes
checking whether /opt/local/bin/gcc-apple-4.2 -arch ppc supports -Wwrite-strings... yes
checking whether /opt/local/bin/gcc-apple-4.2 -arch ppc supports -Wstrict-prototypes... yes
checking whether /opt/local/bin/gcc-apple-4.2 -arch ppc supports -Wmissing-prototypes... yes
checking whether /opt/local/bin/gcc-apple-4.2 -arch ppc supports -Wold-style-definition... yes
checking whether /opt/local/bin/gcc-apple-4.2 -arch ppc supports -Wmissing-format-attribute... yes
checking whether /opt/local/bin/gcc-apple-4.2 -arch ppc supports -Wcast-qual... yes
checking for _Unwind_GetIPInfo... yes
checking __sync extensions... yes
checking output filetype... 
configure: WARNING: could not determine output file type

In a few days, hopefully, we'll know more…

I also started to build GCC 4.8.1 with Fink. Here I get with Apple's standard GCC 4.0.1 a correct "no":

checking unwind.h usability... yes
checking unwind.h presence... yes
checking for unwind.h... yes
checking for _Unwind_Backtrace... yes
checking for -funwind-tables option... no
checking for -frandom-seed=string option... yes
checking whether gcc supports -W... yes
checking whether gcc supports -Wall... yes
checking whether gcc supports -Wwrite-strings... yes
checking whether gcc supports -Wstrict-prototypes... yes
checking whether gcc supports -Wmissing-prototypes... yes
checking whether gcc supports -Wold-style-definition... yes
checking whether gcc supports -Wmissing-format-attribute... yes
checking whether gcc supports -Wcast-qual... yes
checking for _Unwind_GetIPInfo... no
checking __sync extensions... no
checking output filetype... 
configure: WARNING: could not determine output file type
looking for a compliant stdint.h in stdint.h, checking for uintmax_t... yes

comment:24 Changed 11 years ago by cooljeanius (Eric Gallager)

Cc: egall@… added

Cc Me!

comment:25 in reply to:  23 Changed 11 years ago by ballapete (Peter "Pete" Dyballa)

Replying to Peter_Dyballa@…:

In a few days, hopefully, we'll know more…

Already before noon this well-known happened:

/opt/local/bin/g++-apple-4.2 -arch ppc   -g -DIN_GCC   -fno-exceptions -fno-rtti -fasynchronous-unwind-tables -W -Wall -Wwrite-strings -Wcast-qual -Wmissing-format-attribute -pedantic -Wno-long-long -Wno-variadic-macros -Wno-overlength-strings -fno-common  -DHAVE_CONFIG_H -L/opt/local/lib -Wl,-headerpad_max_install_names -o cc1 c/c-lang.o c-family/stub-objc.o attribs.o c/c-errors.o c/c-decl.o c/c-typeck.o c/c-convert.o c/c-aux-info.o c/c-objc-common.o c/c-parser.o c-family/c-common.o c-family/c-cppbuiltin.o c-family/c-dump.o c-family/c-format.o c-family/c-gimplify.o c-family/c-lex.o c-family/c-omp.o c-family/c-opts.o c-family/c-pch.o c-family/c-ppoutput.o c-family/c-pragma.o c-family/c-pretty-print.o c-family/c-semantics.o c-family/c-ada-spec.o tree-mudflap.o darwin-c.o rs6000-c.o \
  cc1-checksum.o libbackend.a main.o tree-browser.o libcommon-target.a libcommon.a ../libcpp/libcpp.a ../libdecnumber/libdecnumber.a libcommon.a ../libcpp/libcpp.a  -liconv ../libbacktrace/.libs/libbacktrace.a ../libiberty/libiberty.a ../libdecnumber/libdecnumber.a  -L/opt/local/lib -lcloog-isl  -lisl -L/opt/local/lib -L/opt/local/lib -L/opt/local/lib -lmpc -lmpfr -lgmp   -lz
ld: warning: object file compiled with -mlong-branch which is no longer needed. To remove this warning, recompile without -mlong-branch: /usr/lib/crt1.o
ld: warning: object file compiled with -mlong-branch which is no longer needed. To remove this warning, recompile without -mlong-branch: /opt/local/lib/apple-gcc42/gcc/powerpc-apple-darwin8/4.2.1/crt3.o
Undefined symbols:
  "__Unwind_GetIPInfo", referenced from:
      _unwind in libbacktrace.a(backtrace.o)
ld: symbol(s) not found
collect2: ld returned 1 exit status
make[3]: *** [cc1] Error 1
make[3]: Leaving directory `/opt/local/var/macports/build/_opt_mports_trunk_dports_lang_gcc48/libgcc/work/build/gcc'
make[2]: *** [all-stage1-gcc] Error 2
make[2]: Leaving directory `/opt/local/var/macports/build/_opt_mports_trunk_dports_lang_gcc48/libgcc/work/build'
make[1]: *** [stage1-bubble] Error 2
make[1]: Leaving directory `/opt/local/var/macports/build/_opt_mports_trunk_dports_lang_gcc48/libgcc/work/build'
make: *** [bootstrap] Error 2
make: Leaving directory `/opt/local/var/macports/build/_opt_mports_trunk_dports_lang_gcc48/libgcc/work/build'
Command failed:  cd "/opt/local/var/macports/build/_opt_mports_trunk_dports_lang_gcc48/libgcc/work/build" && /usr/bin/make -w bootstrap 
Exit code: 2
Error: org.macports.build for port libgcc returned: command execution failed
DEBUG: Error code: CHILDSTATUS 29399 2
DEBUG: Backtrace: command execution failed

So I am back at substituting the macro "ac_fn_c_try_compile" with "ac_fn_c_try_link"?

comment:26 Changed 11 years ago by jeremyhu (Jeremy Huddleston Sequoia)

Yeah, you can do that, but I'd rather know the underlying problem of where it's getting the prototype from.

Can you please manually create the conftest.c as described in config.log, then compile it manually using the compile line mentioned in config.log?

Use that as the reduced state to debug the problem from.

I'd suggest using -E to preprocess conftest.c and then grep through the output to find out which file is providing the prototype.

Also, please provide the output of echo | gcc-apple-4.2 -E -dM - | grep VERSION_MIN' on your system. I want to confirm that the deployment target is set right.

comment:27 in reply to:  26 Changed 11 years ago by ballapete (Peter "Pete" Dyballa)

Replying to jeremyhu@…:

Yeah, you can do that, but I'd rather know the underlying problem of where it's getting the prototype from.

Can you please manually create the conftest.c as described in config.log, then compile it manually using the compile line mentioned in config.log?

This file has:

configure:11652: checking for _Unwind_GetIPInfo
configure:11667: /opt/local/bin/gcc-apple-4.2 -arch ppc -c -g -Werror-implicit-function-declaration  conftest.c >&5
configure:11667: $? = 0
configure:11674: result: yes

so there is no report of the actual contents of conftest.c. A bit later it has:

configure:11811: checking for uintmax_t
configure:11811: /opt/local/bin/gcc-apple-4.2 -arch ppc -c -g  conftest.c >&5
configure:11811: $? = 0
configure:11811: /opt/local/bin/gcc-apple-4.2 -arch ppc -c -g  conftest.c >&5
conftest.c: In function 'main':
conftest.c:35: error: expected expression before ')' token
configure:11811: $? = 1
configure: failed program was:
| /* confdefs.h */
| #define PACKAGE_NAME "package-unused"
| #define PACKAGE_TARNAME "libbacktrace"
| #define PACKAGE_VERSION "version-unused"
| #define PACKAGE_STRING "package-unused version-unused"
| #define PACKAGE_BUGREPORT ""
| #define PACKAGE_URL ""
| #define STDC_HEADERS 1
| #define HAVE_SYS_TYPES_H 1
| #define HAVE_SYS_STAT_H 1
| #define HAVE_STDLIB_H 1
| #define HAVE_STRING_H 1
| #define HAVE_MEMORY_H 1
| #define HAVE_STRINGS_H 1
| #define HAVE_INTTYPES_H 1
| #define HAVE_STDINT_H 1
| #define HAVE_UNISTD_H 1
| #define __EXTENSIONS__ 1
| #define _ALL_SOURCE 1
| #define _GNU_SOURCE 1
| #define _POSIX_PTHREAD_SEMANTICS 1
| #define _TANDEM_SOURCE 1
| #define HAVE_DLFCN_H 1
| #define LT_OBJDIR ".libs/"
| #define HAVE_GETIPINFO 1
| #define HAVE_SYNC_FUNCTIONS 1
| #define BACKTRACE_ELF_SIZE 
| /* end confdefs.h.  */
| #include <sys/types.h>
| #include <stdint.h>
| 
| int
| main ()
| {
| if (sizeof ((uintmax_t)))
| 	    return 0;
|   ;
|   return 0;
| }
configure:11811: result: yes

(which looks to me a bit strange [double compile test on the same line?] and absurd [failure == yes]). The configure script has:

if test -n "${with_target_subdir}"; then


# Check whether --with-system-libunwind was given.
if test "${with_system_libunwind+set}" = set; then :
  withval=$with_system_libunwind;
fi

  # If system-libunwind was not specifically set, pick a default setting.
  if test x$with_system_libunwind = x; then
    case ${target} in
      ia64-*-hpux*) with_system_libunwind=yes ;;
      *) with_system_libunwind=no ;;
    esac
  fi
  # Based on system-libunwind and target, do we have ipinfo?
  if  test x$with_system_libunwind = xyes; then
    case ${target} in
      ia64-*-*) have_unwind_getipinfo=no ;;
      *) have_unwind_getipinfo=yes ;;
    esac
  else
    # Darwin before version 9 does not have _Unwind_GetIPInfo.

    case ${target} in
      *-*-darwin[3-8]|*-*-darwin[3-8].*) have_unwind_getipinfo=no ;;
      *) have_unwind_getipinfo=yes ;;
    esac

  fi

  if test x$have_unwind_getipinfo = xyes; then

$as_echo "#define HAVE_GETIPINFO 1" >>confdefs.h

  fi

else
  ac_save_CFFLAGS="$CFLAGS"
  CFLAGS="$CFLAGS -Werror-implicit-function-declaration"
  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for _Unwind_GetIPInfo" >&5
$as_echo_n "checking for _Unwind_GetIPInfo... " >&6; }
  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h.  */
#include "unwind.h"
	struct _Unwind_Context *context;
	int ip_before_insn = 0;
int
main ()
{
return _Unwind_GetIPInfo (context, &ip_before_insn);
  ;
  return 0;
}
_ACEOF
if ac_fn_c_try_compile "$LINENO"; then :
  have_unwind_getipinfo=yes
else
  have_unwind_getipinfo=no
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
  CFLAGS="$ac_save_CFLAGS"
  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $have_unwind_getipinfo" >&5
$as_echo "$have_unwind_getipinfo" >&6; }
  if test "$have_unwind_getipinfo" = "yes"; then

$as_echo "#define HAVE_GETIPINFO 1" >>confdefs.h

  fi
fi

(which hopefully is complete). So presumingly conftest.c for the _Unwind_GetIPInfo test was:

/* confdefs.h */
#define PACKAGE_NAME "package-unused"
#define PACKAGE_TARNAME "libbacktrace"
#define PACKAGE_VERSION "version-unused"
#define PACKAGE_STRING "package-unused version-unused"
#define PACKAGE_BUGREPORT ""
#define PACKAGE_URL ""
#define STDC_HEADERS 1
#define HAVE_SYS_TYPES_H 1
#define HAVE_SYS_STAT_H 1
#define HAVE_STDLIB_H 1
#define HAVE_STRING_H 1
#define HAVE_MEMORY_H 1
#define HAVE_STRINGS_H 1
#define HAVE_INTTYPES_H 1
#define HAVE_STDINT_H 1
#define HAVE_UNISTD_H 1
#define __EXTENSIONS__ 1
#define _ALL_SOURCE 1
#define _GNU_SOURCE 1
#define _POSIX_PTHREAD_SEMANTICS 1
#define _TANDEM_SOURCE 1
#define HAVE_DLFCN_H 1
#define LT_OBJDIR ".libs/"
#define HAVE_GETIPINFO 1
/* end confdefs.h.  */
#include "unwind.h"
	struct _Unwind_Context *context;
	int ip_before_insn = 0;
int
main ()
{
return _Unwind_GetIPInfo (context, &ip_before_insn);
  ;
  return 0;
}

Use that as the reduced state to debug the problem from.

I'd suggest using -E to preprocess conftest.c and then grep through the output to find out which file is providing the prototype.

I did

/opt/local/bin/gcc-apple-4.2 -arch ppc -E -g -Werror-implicit-function-declaration  conftest.c

and got:

# 1 "conftest.c"
# 1 "/opt/local/var/macports/build/_opt_mports_trunk_dports_lang_gcc48/work//"
# 1 "<built-in>"
# 1 "<command-line>"
# 1 "conftest.c"
# 27 "conftest.c"
# 1 "/opt/local/lib/apple-gcc42/gcc/powerpc-apple-darwin8/4.2.1/include/unwind.h" 1 3 4
# 35 "/opt/local/lib/apple-gcc42/gcc/powerpc-apple-darwin8/4.2.1/include/unwind.h" 3 4
#pragma GCC visibility push(default)
# 46 "/opt/local/lib/apple-gcc42/gcc/powerpc-apple-darwin8/4.2.1/include/unwind.h" 3 4
typedef unsigned _Unwind_Word __attribute__((__mode__(__word__)));
typedef signed _Unwind_Sword __attribute__((__mode__(__word__)));



typedef unsigned _Unwind_Ptr __attribute__((__mode__(__pointer__)));

typedef unsigned _Unwind_Internal_Ptr __attribute__((__mode__(__pointer__)));





typedef unsigned _Unwind_Exception_Class __attribute__((__mode__(__DI__)));



typedef enum
{
  _URC_NO_REASON = 0,
  _URC_FOREIGN_EXCEPTION_CAUGHT = 1,
  _URC_FATAL_PHASE2_ERROR = 2,
  _URC_FATAL_PHASE1_ERROR = 3,
  _URC_NORMAL_STOP = 4,
  _URC_END_OF_STACK = 5,
  _URC_HANDLER_FOUND = 6,
  _URC_INSTALL_CONTEXT = 7,
  _URC_CONTINUE_UNWIND = 8
} _Unwind_Reason_Code;
# 83 "/opt/local/lib/apple-gcc42/gcc/powerpc-apple-darwin8/4.2.1/include/unwind.h" 3 4
struct _Unwind_Exception;

typedef void (*_Unwind_Exception_Cleanup_Fn) (_Unwind_Reason_Code,
           struct _Unwind_Exception *);

struct _Unwind_Exception
{
  _Unwind_Exception_Class exception_class;
  _Unwind_Exception_Cleanup_Fn exception_cleanup;
  _Unwind_Word private_1;
  _Unwind_Word private_2;




} __attribute__((__aligned__));




typedef int _Unwind_Action;
# 115 "/opt/local/lib/apple-gcc42/gcc/powerpc-apple-darwin8/4.2.1/include/unwind.h" 3 4
struct _Unwind_Context;


extern _Unwind_Reason_Code _Unwind_RaiseException (struct _Unwind_Exception *);



typedef _Unwind_Reason_Code (*_Unwind_Stop_Fn)
     (int, _Unwind_Action, _Unwind_Exception_Class,
      struct _Unwind_Exception *, struct _Unwind_Context *, void *);

extern _Unwind_Reason_Code _Unwind_ForcedUnwind (struct _Unwind_Exception *,
       _Unwind_Stop_Fn,
       void *);


extern void _Unwind_DeleteException (struct _Unwind_Exception *);



extern void _Unwind_Resume (struct _Unwind_Exception *);



extern _Unwind_Reason_Code _Unwind_Resume_or_Rethrow (struct _Unwind_Exception *);




typedef _Unwind_Reason_Code (*_Unwind_Trace_Fn)
     (struct _Unwind_Context *, void *);

extern _Unwind_Reason_Code _Unwind_Backtrace (_Unwind_Trace_Fn, void *);






extern _Unwind_Word _Unwind_GetGR (struct _Unwind_Context *, int);
extern void _Unwind_SetGR (struct _Unwind_Context *, int, _Unwind_Word);

extern _Unwind_Ptr _Unwind_GetIP (struct _Unwind_Context *);

extern _Unwind_Ptr _Unwind_GetIPInfo (struct _Unwind_Context *, int *);

extern void _Unwind_SetIP (struct _Unwind_Context *, _Unwind_Ptr);


extern _Unwind_Word _Unwind_GetCFA (struct _Unwind_Context *);

extern void *_Unwind_GetLanguageSpecificData (struct _Unwind_Context *);

extern _Unwind_Ptr _Unwind_GetRegionStart (struct _Unwind_Context *);
# 185 "/opt/local/lib/apple-gcc42/gcc/powerpc-apple-darwin8/4.2.1/include/unwind.h" 3 4
typedef _Unwind_Reason_Code (*_Unwind_Personality_Fn)
     (int, _Unwind_Action, _Unwind_Exception_Class,
      struct _Unwind_Exception *, struct _Unwind_Context *);




struct SjLj_Function_Context;
extern void _Unwind_SjLj_Register (struct SjLj_Function_Context *);
extern void _Unwind_SjLj_Unregister (struct SjLj_Function_Context *);

extern _Unwind_Reason_Code _Unwind_SjLj_RaiseException
     (struct _Unwind_Exception *);
extern _Unwind_Reason_Code _Unwind_SjLj_ForcedUnwind
     (struct _Unwind_Exception *, _Unwind_Stop_Fn, void *);
extern void _Unwind_SjLj_Resume (struct _Unwind_Exception *);
extern _Unwind_Reason_Code _Unwind_SjLj_Resume_or_Rethrow (struct _Unwind_Exception *);
# 227 "/opt/local/lib/apple-gcc42/gcc/powerpc-apple-darwin8/4.2.1/include/unwind.h" 3 4
extern _Unwind_Ptr _Unwind_GetDataRelBase (struct _Unwind_Context *);
extern _Unwind_Ptr _Unwind_GetTextRelBase (struct _Unwind_Context *);




extern void * _Unwind_FindEnclosingFunction (void *pc);






#pragma GCC visibility pop
# 28 "conftest.c" 2
 struct _Unwind_Context *context;
 int ip_before_insn = 0;
int
main ()
{
return _Unwind_GetIPInfo (context, &ip_before_insn);
  ;
  return 0;
}

Also, please provide the output of echo | gcc-apple-4.2 -E -dM - | grep VERSION_MIN' on your system. I want to confirm that the deployment target is set right.

The output is:

#define __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ 1040

comment:28 Changed 11 years ago by jeremyhu (Jeremy Huddleston Sequoia)

Ok, so it's coming from /opt/local/lib/apple-gcc42/gcc/powerpc-apple-darwin8/4.2.1/include/unwind.h sill.

Change the line in the patch to use __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ instead of __MAC_OS_X_VERSION_MIN_REQUIRED

~/src/macports/dports/lang/apple-gcc42 $ cat files/tiger-Unwind_GetIPInfo.patch 
--- gcc/unwind-generic.h.orig	2013-08-29 12:33:52.000000000 -0700
+++ gcc/unwind-generic.h	2013-08-29 12:35:51.000000000 -0700
@@ -155,7 +155,9 @@ extern _Unwind_Word _Unwind_GetGR (struc
 extern void _Unwind_SetGR (struct _Unwind_Context *, int, _Unwind_Word);
 
 extern _Unwind_Ptr _Unwind_GetIP (struct _Unwind_Context *);
+#if !defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__) || __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ >= 1050
 extern _Unwind_Ptr _Unwind_GetIPInfo (struct _Unwind_Context *, int *);
+#endif
 extern void _Unwind_SetIP (struct _Unwind_Context *, _Unwind_Ptr);
 
 /* @@@ Retrieve the CFA of the given context.  */

comment:29 in reply to:  28 Changed 11 years ago by ballapete (Peter "Pete" Dyballa)

Replying to jeremyhu@…:

Ok, so it's coming from /opt/local/lib/apple-gcc42/gcc/powerpc-apple-darwin8/4.2.1/include/unwind.h sill.

Change the line in the patch to use __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ instead of __MAC_OS_X_VERSION_MIN_REQUIRED

I can try that as well – presumingly next week! Right now the build is progressing very fine, cc1 has been built twice already. By substituting the macros in that test for _Unwind_GetIPInfo configure has found that the symbol is not provided or useful and obviously has means to live with that.

The apple-gcc42 package has no dependents, so it should be easy to uninstall the recent version, correct the patch file, and then build and install it once more. I think it won't work that easily to rebuild with that compiler libgcc, which is being built right now, but I still have the outdated libstdcxx and gcc48 packages as test cases for the newest apple-gcc42.

comment:30 in reply to:  28 Changed 11 years ago by ballapete (Peter "Pete" Dyballa)

Replying to jeremyhu@…:

Change the line in the patch to use __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ instead of __MAC_OS_X_VERSION_MIN_REQUIRED

+#if !defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__)
           || __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ >= 1050

I've broken the line in two to emphasise that the same name is used twice. Is that really the correct guard? And necessary?

comment:31 in reply to:  20 ; Changed 11 years ago by ballapete (Peter "Pete" Dyballa)

Replying to Peter_Dyballa@…:

I think the macro "ac_fn_c_try_compile" on line #11670 is the key:

if ac_fn_c_try_compile "$LINENO"; then :

Presumingly I'm ought to substitute the macro with ac_fn_c_try_link… Right?

With that correction the libgcc package could be built 15 or 20 minutes ago! I am going to build the next variation of apple-gcc42.

comment:32 in reply to:  31 Changed 11 years ago by ballapete (Peter "Pete" Dyballa)

Replying to Peter_Dyballa@…:

I think the macro "ac_fn_c_try_compile" on line #11670 is the key:

The patch I used is very simple:

--- libbacktrace/configure.orig 2012-12-11 19:45:45.000000000 +0100
+++ libbacktrace/configure      2013-08-29 12:13:55.000000000 +0200
@@ -11667,7 +11667,7 @@
   return 0;
 } 
 _ACEOF
-if ac_fn_c_try_compile "$LINENO"; then :
+if ac_fn_c_try_link "$LINENO"; then :
   have_unwind_getipinfo=yes
 else
   have_unwind_getipinfo=no

comment:33 Changed 11 years ago by jeremyhu (Jeremy Huddleston Sequoia)

Resolution: fixed
Status: reopenedclosed

There are two issues here:

  • Yes, they maybe should be doing a link test instead of a compile test
  • We should not be letting them pass the compile test

Your last patch addresses 1 (feel free to send that upstream to the gcc bugzilla).

I'm more concerned about fixing 2.

I pushed the change as r110482. Please reopen if you still have problems.

comment:34 in reply to:  33 Changed 11 years ago by ballapete (Peter "Pete" Dyballa)

Replying to jeremyhu@…:

I pushed the change as r110482. Please reopen if you still have problems.

I think your latest patch of apple-gcc42 fixed the issue. Using the preliminary binaries from the build process on the saved conftest.c file I get:

/opt/local/var/macports/build/_opt_mports_trunk_dports_lang_apple-gcc42/apple-gcc42/work/objroot/obj-powerpc-powerpc/./prev-gcc/xgcc -B/opt/local/var/macports/build/_opt_mports_trunk_dports_lang_apple-gcc42/apple-gcc42/work/objroot/obj-powerpc-powerpc/./prev-gcc/ -B/opt/local/powerpc-apple-darwin8/bin/ -c -g -Werror-implicit-function-declaration  conftest.c
conftest.c: In function 'main':
conftest.c:33: error: implicit declaration of function '_Unwind_GetIPInfo'
Note: See TracTickets for help on using tickets.