From 99a8ee449f541638aca50ab3c67b7ddd8a72a0a1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20P=C3=B6chtrager?= Date: Wed, 1 Jan 2014 17:58:19 +0100 Subject: [PATCH] add a no-op dsymutil shell script to bypass dsymutil invocation errors in a more simple way (fixes https://github.com/tpoechtrager/osxcross/issues/1) remove the gcc dsymutil patch (no longer needed) --- README.md | 2 +- build.sh | 2 ++ build_gcc.sh | 2 -- oclang/dsymutil | 20 +++++++++++++++++ oclang/oclang | 11 ++++------ patches/gcc-dsymutil.patch | 45 -------------------------------------- 6 files changed, 27 insertions(+), 55 deletions(-) create mode 100755 oclang/dsymutil delete mode 100644 patches/gcc-dsymutil.patch diff --git a/README.md b/README.md index 2222e65..9fc987a 100644 --- a/README.md +++ b/README.md @@ -15,7 +15,7 @@ If you want, then you can build an up-to-date vanilla GCC as well. ### WHAT IS NOT WORKING (YET)? ### -* Debug info is weak because of the [missing](https://github.com/tpoechtrager/osxcross/blob/master/patches/gcc-dsymutil.patch) +* Debug info is weak because of the [missing](https://github.com/tpoechtrager/osxcross/blob/master/oclang/dsymutil) [`dsymutil`](http://www.manpagez.com/man/1/dsymutil) (debugger shows only function names). The source code of dsymutil is not publicly available, so it can't be ported to other platforms. But you probably don't want debug symbols anyway if you build on a non OS X system. diff --git a/build.sh b/build.sh index dd16e55..95e1867 100755 --- a/build.sh +++ b/build.sh @@ -208,6 +208,8 @@ popd &>/dev/null popd &>/dev/null +cp -f oclang/dsymutil $TARGET_DIR/bin + WRAPPER=$TARGET_DIR/bin/x86_64-apple-$TARGET-oclang cp -f oclang/oclang $WRAPPER diff --git a/build_gcc.sh b/build_gcc.sh index f5bae52..740bd1e 100755 --- a/build_gcc.sh +++ b/build_gcc.sh @@ -46,8 +46,6 @@ pushd gcc*$GCC_VERSION* &>/dev/null rm -f $OSXCROSS_TARGET_DIR/bin/*-gcc* rm -f $OSXCROSS_TARGET_DIR/bin/*-g++* -patch -p0 < $OSXCROSS_PATCH_DIR/gcc-dsymutil.patch - mkdir -p build pushd build &>/dev/null diff --git a/oclang/dsymutil b/oclang/dsymutil new file mode 100755 index 0000000..050893e --- /dev/null +++ b/oclang/dsymutil @@ -0,0 +1,20 @@ +#!/usr/bin/env bash +# +# No-op script to bypass dsymutil invocation errors +# +# Please see: +# https://github.com/tpoechtrager/osxcross/issues/1 +# https://github.com/tpoechtrager/osxcross/pull/2 +# + +if [ $# -eq 0 ] || [ -n "$OSXCROSS_SHOW_DSYMUTIL_INVOCATION" ]; then + NAME_OF_PARENT_PROCESS=`basename \`ps -ocommand= -p $PPID 2>/dev/null | awk '{print $1}'\`` + + echo -en "\e[1mosxcross \e[35mwarning:\e[0m\e[1m dsymutil invocation is a no-op (dsymutil $@) " + + if [ -n "$NAME_OF_PARENT_PROCESS" ]; then + echo -e "(invoked by $NAME_OF_PARENT_PROCESS)\e[0m" 1>&2 + else + echo -e "\e[0m" 1>&2 + fi +fi diff --git a/oclang/oclang b/oclang/oclang index 527bdbe..bdd5304 100755 --- a/oclang/oclang +++ b/oclang/oclang @@ -50,9 +50,6 @@ if [ $# -gt 0 ]; then if [ "$p" == "-stdlib=libc++" ]; then USE_LIBCXX=2 fi -# if [[ "$p" == -g* ]] && [ "$p" != "-g0" ] && [ "$p" != "-ggdb0" ]; then -# echo -e "\e[1mosxcross \e[35mwarning:\e[0m\e[1m replacing '$p' with '-g0'\e[0m" 1>&2 -# fi done fi @@ -101,9 +98,9 @@ if [ $? -eq 0 ] && [ ! -f "$XMMINTRIN" ]; then fi fi -$COMPILER $OSXCROSS_TARGET_OPTION $TARGET -isysroot $OSXCROSS_SDK \ -$CPLUSINC \ -$OSX_VERSION_MIN_OPT -mlinker-version=$OSXCROSS_LINKER_VERSION $OSXCROSS_OPT_ARGS \ -${1+"$@"} -g0 +$COMPILER \ + $OSXCROSS_TARGET_OPTION $TARGET -isysroot $OSXCROSS_SDK \ + $CPLUSINC $OSX_VERSION_MIN_OPT -mlinker-version=$OSXCROSS_LINKER_VERSION \ + $OSXCROSS_OPT_ARGS ${1+"$@"} exit $? diff --git a/patches/gcc-dsymutil.patch b/patches/gcc-dsymutil.patch deleted file mode 100644 index a5dfc8f..0000000 --- a/patches/gcc-dsymutil.patch +++ /dev/null @@ -1,45 +0,0 @@ -diff -urN build/gcc-4.8.2/gcc/collect2.c /home/thomas/tmp/gcc-4.8.2/gcc/collect2.c ---- gcc/collect2.c 2013-06-20 19:12:17.000000000 +0200 -+++ gcc/collect2.c 2013-11-11 20:08:35.355672907 +0100 -@@ -3046,6 +3046,7 @@ - } - #endif /* COLLECT_EXPORT_LIST */ - -+#undef COLLECT_RUN_DSYMUTIL - #ifdef COLLECT_RUN_DSYMUTIL - static int flag_dsym = false; - static int flag_idsym = false; -diff -urN build/gcc-4.8.2/gcc/config/darwin.h /home/thomas/tmp/gcc-4.8.2/gcc/config/darwin.h ---- gcc/config/darwin.h 2013-02-12 00:30:10.000000000 +0100 -+++ gcc/config/darwin.h 2013-11-11 20:17:15.387653343 +0100 -@@ -195,10 +195,13 @@ - %{.c|.cc|.C|.cpp|.cp|.c++|.cxx|.CPP|.m|.mm: \ - %{gdwarf-2:%{!gstabs*:%{!g0: -dsym}}}}}}}}}}}" - -+#undef DSYMUTIL_SPEC -+#define DSYMUTIL_SPEC "" -+ - #define LINK_COMMAND_SPEC LINK_COMMAND_SPEC_A DSYMUTIL_SPEC - - /* Tell collect2 to run dsymutil for us as necessary. */ --#define COLLECT_RUN_DSYMUTIL 1 -+#define COLLECT_RUN_DSYMUTIL 0 - - /* We only want one instance of %G, since libSystem (Darwin's -lc) does not depend - on libgcc. */ -diff -urN build/gcc-4.8.2/gcc/config/darwin9.h /home/thomas/tmp/gcc-4.8.2/gcc/config/darwin9.h ---- gcc/config/darwin9.h 2013-01-10 21:38:27.000000000 +0100 -+++ gcc/config/darwin9.h 2013-11-11 20:23:12.619639903 +0100 -@@ -32,8 +32,11 @@ - %{.c|.cc|.C|.cpp|.cp|.c++|.cxx|.CPP|.m|.mm|.s|.f|.f90|.f95|.f03|.f77|.for|.F|.F90|.F95|.F03: \ - %{g*:%{!gstabs*:%{!g0: -dsym}}}}}}}}}}}" - -+#undef DSYMUTIL_SPEC -+#define DSYMUTIL_SPEC "" -+ - /* Tell collect2 to run dsymutil for us as necessary. */ --#define COLLECT_RUN_DSYMUTIL 1 -+#define COLLECT_RUN_DSYMUTIL 0 - - #undef PIE_SPEC - #define PIE_SPEC \