Opened 9 years ago

Last modified 2 years ago

#47929 new defect

llvm-gcc42 @2336.11_2 fails building on 10.6.8

Reported by: udbraumann Owned by: macports-tickets@…
Priority: Normal Milestone:
Component: ports Version: 2.3.3
Keywords: Cc: jeremyhu (Jeremy Huddleston Sequoia), larryv (Lawrence Velázquez), ryandesign (Ryan Carsten Schmidt), cooljeanius (Eric Gallager)
Port: llvm-gcc42

Description

While updating llvm-gcc42 from 2336.11_1 to 2336.11_2 on 10.6.8 I was surprised to run into trouble like dyld: lazy symbol binding failed: Symbol not found: _strncmp. BTW, I am wondering that llvm-gcc42 itself is being automatically selected for building.

Below is the most relevant excerpt. I am hesitating to directly report to http://developer.apple.com/bugreporter

...
:info:build /usr/bin/llvm-gcc-4.2 -pipe -std=gnu89 -c -g -std=gnu89 -DIN_GCC -W -Wall -Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes -mdynamic-no-pic -DHAVE_CONFIG_H -DGENERATOR_FILE -I. -Ibuild -I/opt/local/var/macports/build
/_opt_local_var_macports_sources_rsync.macports.org_release_ports_lang_llvm-gcc42/llvm-gcc42/work/objroot/src/gcc -I/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_ports_lang_llvm-gcc42/llvm-gcc42/work/objroot/src/gcc/build -I/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_ports_lang_llvm-gcc42/llvm-gcc42/work/objroot/src/gcc/../include -I/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_ports_lang_llvm-gcc42/llvm-gcc42/work/objroot/src/gcc/../libcpp/include  -I/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_ports_lang_llvm-gcc42/llvm-gcc42/work/objroot/src/gcc/../libdecnumber -I../libdecnumber -I/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_ports_lang_llvm-gcc42/llvm-gcc42/work/objroot/dst-llvmCore/Developer/usr/local/include -DENABLE_LLVM -I/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_ports_lang_llvm-gcc42/llvm-gcc42/work/objroot/dst-llvmCore/Developer/usr/local/include  -DNDEBUG -D_GNU_SOURCE -D__STDC_LIMIT_MACROS
-D__STDC_CONSTANT_MACROS -DLLVM_VERSION_INFO='"2336.11"' -DBUILD_LLVM_APPLE_STYLE   -o build/gencondmd.o build/gencondmd.c
:info:build dyld: lazy symbol binding failed: Symbol not found: _strncmp
:info:build   Referenced from: /usr/llvm-gcc-4.2/bin/../libexec/gcc/i686-apple-darwin10/4.2.1/cc1
:info:build   Expected in: /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_ports_lang_llvm-gcc42/llvm-gcc42/work/objroot/obj-x86_64-x86_64/./gcc/libllvmgcc.dylib
:info:build
:info:build dyld: Symbol not found: _strncmp
:info:build   Referenced from: /usr/llvm-gcc-4.2/bin/../libexec/gcc/i686-apple-darwin10/4.2.1/cc1
:info:build   Expected in: /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_ports_lang_llvm-gcc42/llvm-gcc42/work/objroot/obj-x86_64-x86_64/./gcc/libllvmgcc.dylib
:info:build
:info:build Stack dump:
:info:build 0.  Program arguments: /usr/llvm-gcc-4.2/bin/../libexec/gcc/i686-apple-darwin10/4.2.1/cc1 -quiet -I. -Ibuild -I/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_ports_lang_llvm-gcc42/llvm-gcc42/work/objroot/src/gcc -I/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_ports_lang_llvm-gcc42/llvm-gcc42/work/objroot/src/gcc/build -I/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_ports_lang_llvm-gcc42/llvm-gcc42/work/objroot/src/gcc/../include -I/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_ports_lang_llvm-gcc42/llvm-gcc42/work/objroot/src/gcc/../libcpp/include -I/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_ports_lang_llvm-gcc42/llvm-gcc42/work/objroot/src/gcc/../libdecnumber -I../libdecnumber -I/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_ports_lang_llvm-gcc42/llvm-gcc42/work/objroot/dst-llvmCore/Developer/usr/local/include -I/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_ports_lang_llvm-gcc42/llvm-gcc42/work/objroot/dst-llvmCore/Developer/usr/local/include -imultilib x86_64 -iprefix /usr/llvm-gcc-4.2/bin/../lib/gcc/i686-apple-darwin10/4.2.1/ -D__DYNAMIC__ -DIN_GCC -DHAVE_CONFIG_H -DGENERATOR_FILE -DENABLE_LLVM -DNDEBUG -D_GNU_SOURCE -D__STDC_LIMIT_MACROS -D__STDC_CONSTANT_MACROS -DLLVM_VERSION_INFO="2336.11" -DBUILD_LLVM_APPLE_STYLE build/gencondmd.c -feliminate-unused-debug-symbols -quiet -dumpbase gencondmd.c -mmacosx-version-min=10.6 -mdynamic-no-pic -m64 -mtune=core2 -auxbase-strip build/gencondmd.o -g -W -Wall -Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes -std=gnu89 -std=gnu89 -o -
:info:build i686-apple-darwin10-llvm-gcc-4.2: Internal error: Segmentation fault (program cc1)
:info:build Please submit a full bug report.
:info:build See <URL:http://developer.apple.com/bugreporter> for instructions.
:info:build make[5]: *** [build/gencondmd.o] Error 1
:info:build rm fsf-funding.pod gcov.pod gfdl.pod cpp.pod gpl.pod gcc.pod
:info:build make[4]: *** [all-stage1-gcc] Error 2
:info:build make[3]: *** [stage1-bubble] Error 2
:info:build make[2]: *** [all] Error 2
:info:build + exit 1
:info:build make[1]: *** [llvmgcc42] Error 1
...

Attachments (3)

main.log.gz (80.6 KB) - added by udbraumann 9 years ago.
main_DYLD.log.gz (3.2 MB) - added by udbraumann 9 years ago.
main_10.6.8_Rosetta.log (2.5 MB) - added by barracuda156 2 years ago.

Change History (25)

Changed 9 years ago by udbraumann

Attachment: main.log.gz added

comment:1 in reply to:  description Changed 9 years ago by ryandesign (Ryan Carsten Schmidt)

Cc: ryandesign@… added
Keywords: Symbol not found: _strncmp removed

Replying to braumann@…:

While updating llvm-gcc42 from 2336.11_1 to 2336.11_2 on 10.6.8 I was surprised to run into trouble like dyld: lazy symbol binding failed: Symbol not found: _strncmp.

Hmm. Yesterday's update of llvm-gcc42 was done for the benefit of Yosemite, on which llvm-gcc42 couldn't be built until now. It's certainly possible this has introduced problems for earlier platforms, though this was not intended.

BTW, I am wondering that llvm-gcc42 itself is being automatically selected for building.

Well, the llvm-gcc42 port will not build using a compiler installed by an already-installed llvm-gcc42 port. What you're seeing in the log is that the llvm-gcc42 port is being compiled using the version of the llvm-gcc42 compiler that came with Xcode.

Theoretically, that should work. However, on my Snow Leopard system, Xcode gcc42 is used, not llvm-gcc42, and I don't see anything in the llvm-gcc42 portfile that would explain why Xcode llvm-gcc42 was selected instead on your system.

Do you really need MacPorts llvm-gcc42? Is the version provided by Xcode not sufficient for your needs? It is true that the MacPorts version is ever so slightly newer than the version provided by Xcode, but there are only a few small differences.

Below is the most relevant excerpt. I am hesitating to directly report to http://developer.apple.com/bugreporter

You're probably right not to report this to Apple; they've moved on from llvm-gcc. We keep it around mainly for the benefit of very old software that has not yet been fixed to compile properly with clang on newer systems.

comment:2 Changed 9 years ago by ryandesign (Ryan Carsten Schmidt)

Looking more closely at the error, it is wrong (and surely the cause of the error message) that Xcode llvm-gcc42 is trying to load a library that was just built for MacPorts llvm-gcc42, but that can probably be explained by the build system setting DYLD_LIBRARY_PATH to its own build directory. I see in the log that the configure script determined that DYLD_LIBRARY_PATH could be used, and setting it to a build directory will have the effect of any program using the libraries in that directory instead of wherever the program was configured to look for them normally. We could simply blacklist Xcode llvm-gcc42 as well, and MacPorts will move on to the next-best compiler.

As to why MacPorts didn't use Xcode gcc42 on your system as it did on mine: the only explanation I can come up with is that you might be using Xcode 4.2, which does not include gcc42. Is that the case?

comment:3 in reply to:  2 Changed 9 years ago by udbraumann

Indeed, I have installed Xcode 4.2 some time ago. Originally, I had Xcode 3.2.6. Xcode 4.2 is the highest Xcode version running on 10.6.8. I was not aware that installing Xcode 4.2 influences preferences for compiler selection inside MP.

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

Yes, it does. With Xcode 3.1.x and 3.2.x on Snow Leopard, the default compiler is Apple gcc42. In Xcode 4.x, the default compiler is llvm-gcc42. In Xcode 4.2, Apple removed gcc42. Because Xcode 4 on Snow Leopard was paid software, much fewer users use it, so problems like this come up much more often, which is why we recommend using Xcode 3.2.6 on Snow Leopard, unless you have some other reason to need Xcode 4.2.

But I do intend to fix this. My Snow Leopard machine is currently busy building llvm-gcc42 with Xcode gcc42 to verify that works. Then I'll retry with Xcode llvm-gcc42 to verify that fails. Then I'll retry after blacklisting Xcode llvm-gcc42 to see what compiler it picks and if it builds ok.

comment:5 in reply to:  4 Changed 9 years ago by udbraumann

I was uninstalling llvm-gcc42 @2336.11_1 in order to see if the llvm-gcc42 @2336.11_2 building problems were due to some interference between llvm-gcc42 @2336.11_1 and the Xcode 4.2-shipped llvm-gcc42 @2336.1.00. However, the latter failed building llvm-gcc42 @2336.11_2 with the same error as reported above: dyld: lazy symbol binding failed: Symbol not found: _strncmp.

comment:6 Changed 9 years ago by ryandesign (Ryan Carsten Schmidt)

I was not able to reproduce the issue on my Snow Leopard machine.

comment:7 Changed 9 years ago by jeremyhu (Jeremy Huddleston Sequoia)

Reproducing with DYLD_PRINT_ENV=1 DYLD_PRINT_LIBRARIES=1 in the environment might give some helpful information to see what's going on.

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

Also note that '/usr/llvm-gcc-4.2/libexec/gcc/i686-apple-darwin10/4.2.1/cc1' is from CLTools and not in Xcode proper. Please report the output of:

otool -l /usr/llvm-gcc-4.2/libexec/gcc/i686-apple-darwin10/4.2.1/cc1 | grep uuid

As that will help identifiy which version of CLTools you have installed.

comment:9 in reply to:  8 Changed 9 years ago by udbraumann

$ otool -l /usr/llvm-gcc-4.2/libexec/gcc/i686-apple-darwin10/4.2.1/cc1 | grep uuid
    uuid F108C664-F90E-3B30-AEF9-A31D0C17F292

I will activate the two environment variables and than will post the main.log again.

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

And what version of CLTools do you think that is from? What's the output of '/usr/llvm-gcc-4.2/libexec/gcc/i686-apple-darwin10/4.2.1/cc1 --version' ?

comment:11 in reply to:  10 Changed 9 years ago by udbraumann

$ /usr/llvm-gcc-4.2/libexec/gcc/i686-apple-darwin10/4.2.1/cc1 --version
GNU C version 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2336.1.00) (i686-apple-darwin10)
	compiled by GNU C version 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2336.1.00).
GGC heuristics: --param ggc-min-expand=150 --param ggc-min-heapsize=65536

comment:12 in reply to:  10 Changed 9 years ago by udbraumann

Setting DYLD_PRINT_ENV=1 and DYLD_PRINT_LIBRARIES=1, though making my console verbose, apparently had no effect on main.log or the console during my build attempts using the XCode 4.2 shipped llvm-gcc-42 to build macports-llvm-gcc-4.2. I always end up with the problem I have pasted above.

For the moment I give up an simply build macports-llvm-gcc-42 (i.e. llvm-gcc42 @2336.11_2) using gcc-42 from XCode 3.2.6:

$ sudo port install llvm-gcc42 configure.compiler=gcc-4.2

comment:13 Changed 9 years ago by jeremyhu (Jeremy Huddleston Sequoia)

How did you set the envvar? You need to set those envvars in the environment that spawns /usr/bin/llvm-gcc-4.2. I'd suggest setting it in build.env. Is that what failed?

though making my console verbose, apparently had no effect on main.log or the console

Those statements are contradictory. You say it had no effect on the console and that it made the console output more verbose. Which is it? Did it makes the output more verbose? If so, please show me the requested output from the failed execution.

comment:14 in reply to:  13 ; Changed 9 years ago by udbraumann

Sorry for the confusion, I put the

export DYLD_PRINT_ENV=1
export DYLD_PRINT_LIBRARIES=1

into .bashrc, but as I got aware just now, these settings have no effect since I call port as sudo port.

Could you please advice me how to set build.env?

comment:15 in reply to:  14 ; Changed 9 years ago by larryv (Lawrence Velázquez)

Run this and add the new variables at the appropriate place (somewhere between lines 129 and 145 in the current portfile):

sudo -e $(port file llvm-gcc42)

comment:16 in reply to:  15 Changed 9 years ago by udbraumann

Thanks, I have added the two variables in the Portfile

...
145     OTOOL64=${prefix}/bin/otool \
146     DYLD_PRINT_ENV=1 \
147     DYLD_PRINT_LIBRARIES=1
...

Please see main_DYLD.log.gz, my impression is that a different problem occurs now, but have a look by yourself. Thanks!

Changed 9 years ago by udbraumann

Attachment: main_DYLD.log.gz added

comment:17 Changed 4 years ago by kencu (Ken)

Cc: kencu added

comment:18 Changed 3 years ago by cooljeanius (Eric Gallager)

Cc: cooljeanius added

comment:19 Changed 3 years ago by kencu (Ken)

Cc: kencu removed

comment:20 Changed 2 years ago by barracuda156

llvm-gcc42 fails to build on 10.6.8 Rosetta too.

/bin/sh /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_lang_llvm-gcc42/llvm-gcc42/work/objroot/src/gcc/../move-if-change tmp-gtyp.h gtyp-gen.h
echo timestamp > s-gtyp-gen
rm gcov.pod gfdl.pod cpp.pod gcc.pod fsf-funding.pod gpl.pod
make[4]: *** [all-stage1-gcc] Error 2
make[3]: *** [stage1-bubble] Error 2
make[2]: *** [all] Error 2
+ exit 1
make[1]: *** [llvmgcc42] Error 1
make[1]: Leaving directory `/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_lang_llvm-gcc42/llvm-gcc42/work/llvmgcc42-2336.11'
make: *** [install] Error 2
make: Leaving directory `/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_lang_llvm-gcc42/llvm-gcc42/work/llvmgcc42-2336.11'
Command failed:  cd "/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_lang_llvm-gcc42/llvm-gcc42/work/llvmgcc42-2336.11" && /usr/bin/make -j4 -w install CC="/usr/bin/gcc-4.2 -pipe -std=gnu89" CXX="/usr/bin/g++-4.2 -pipe" PREFIX="/opt/local" SRCROOT="/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_lang_llvm-gcc42/llvm-gcc42/work/llvmgcc42-2336.11" OBJROOT="/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_lang_llvm-gcc42/llvm-gcc42/work/objroot" SYMROOT="/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_lang_llvm-gcc42/llvm-gcc42/work/symroot" DSTROOT="/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_lang_llvm-gcc42/llvm-gcc42/work/destroot" RC_NONARCH_CFLAGS="-pipe -std=gnu89" RC_OS="macos" RC_ARCHS="ppc" RC_ProjectSourceVersion="2336" RC_ProjectSourceSubversion="11" TARGETS="ppc" 
Exit code: 2
Error: Failed to build llvm-gcc42: command execution failed

Changed 2 years ago by barracuda156

Attachment: main_10.6.8_Rosetta.log added

comment:21 Changed 2 years ago by barracuda156

Is there a special reason why the portfile has the following?

compiler.cpath /usr/include
compiler.library_path /usr/lib

# TODO: Better use of MacPorts dependencies
build.env \
    LIBRARY_PATH=/usr/lib \
    CPATH=/usr/include \
    PATH=/bin:/usr/bin:/sbin:/usr/sbin \

comment:22 Changed 2 years ago by barracuda156

Weirdly, with macports-gcc-10 it fails very early with:

In file included from /opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_lang_llvm-gcc42/llvm-gcc42/work/objroot/obj-llvmCore/src/include/llvm/Support/Allocator.h:17,
                 from /opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_lang_llvm-gcc42/llvm-gcc42/work/objroot/obj-llvmCore/src/include/llvm/ADT/StringMap.h:18,
                 from /opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_lang_llvm-gcc42/llvm-gcc42/work/objroot/obj-llvmCore/src/include/llvm/System/Host.h:17,
                 from /opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_lang_llvm-gcc42/llvm-gcc42/work/objroot/obj-llvmCore/src/lib/System/Host.cpp:14:
/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_lang_llvm-gcc42/llvm-gcc42/work/objroot/obj-llvmCore/src/include/llvm/Support/AlignOf.h:57:24: error: expected unqualified-id before 'alignof'
   57 | static inline unsigned alignof() { return AlignOf<T>::Alignment; }
      |                        ^~~~~~~
In file included from /opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_lang_llvm-gcc42/llvm-gcc42/work/objroot/obj-llvmCore/src/include/llvm/ADT/StringMap.h:18,
                 from /opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_lang_llvm-gcc42/llvm-gcc42/work/objroot/obj-llvmCore/src/include/llvm/System/Host.h:17,
                 from /opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_lang_llvm-gcc42/llvm-gcc42/work/objroot/obj-llvmCore/src/lib/System/Host.cpp:14:
/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_lang_llvm-gcc42/llvm-gcc42/work/objroot/obj-llvmCore/src/include/llvm/Support/Allocator.h: In member function 'void llvm::SpecificBumpPtrAllocator<T>::DestroyAll()':
/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_lang_llvm-gcc42/llvm-gcc42/work/objroot/obj-llvmCore/src/include/llvm/Support/Allocator.h:204:46: error: expected primary-expression before '<' token
  204 |         Ptr = Allocator.AlignPtr(Ptr, alignof<T>());
      |                                              ^
/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_lang_llvm-gcc42/llvm-gcc42/work/objroot/obj-llvmCore/src/include/llvm/Support/Allocator.h:204:48: error: expected primary-expression before '>' token
  204 |         Ptr = Allocator.AlignPtr(Ptr, alignof<T>());
      |                                                ^
/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_lang_llvm-gcc42/llvm-gcc42/work/objroot/obj-llvmCore/src/include/llvm/Support/Allocator.h:204:50: error: expected primary-expression before ')' token
  204 |         Ptr = Allocator.AlignPtr(Ptr, alignof<T>());
      |                                                  ^
In file included from /opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_lang_llvm-gcc42/llvm-gcc42/work/objroot/obj-llvmCore/src/include/llvm/System/Host.h:17,
                 from /opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_lang_llvm-gcc42/llvm-gcc42/work/objroot/obj-llvmCore/src/lib/System/Host.cpp:14:
/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_lang_llvm-gcc42/llvm-gcc42/work/objroot/obj-llvmCore/src/include/llvm/ADT/StringMap.h: In static member function 'static llvm::StringMapEntry<ValueTy>* llvm::StringMapEntry<ValueTy>::Create(const char*, const char*, AllocatorTy&, InitType)':
/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_lang_llvm-gcc42/llvm-gcc42/work/objroot/obj-llvmCore/src/include/llvm/ADT/StringMap.h:170:33: error: expected primary-expression before '<' token
  170 |     unsigned Alignment = alignof<StringMapEntry>();
      |                                 ^
/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_lang_llvm-gcc42/llvm-gcc42/work/objroot/obj-llvmCore/src/include/llvm/ADT/StringMap.h:170:48: error: expected primary-expression before '>' token
  170 |     unsigned Alignment = alignof<StringMapEntry>();
      |                                                ^
/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_lang_llvm-gcc42/llvm-gcc42/work/objroot/obj-llvmCore/src/include/llvm/ADT/StringMap.h:170:50: error: expected primary-expression before ')' token
  170 |     unsigned Alignment = alignof<StringMapEntry>();
      |                                                  ^
llvm[3]: Compiling IncludeFile.cpp for Release+Debug-Asserts build
Note: See TracTickets for help on using tickets.