Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

tbb: use stdenv to fix building. #22837

Closed
wants to merge 1 commit into from

3 participants

@manphiz
Collaborator
  • Under superenv tbb FTBFS with undeclared identifier.

Closes #22545.

@manphiz manphiz tbb: use stdenv to fix building.
* Under superenv tbb FTBFS with undeclared identifier.

Closes #22545.
307ec3b
@adamv
Owner

We don't want to add more env :std to formulae, we want to figure out why superenv is broken and fix it.

@manphiz
Collaborator

@adamv OK. Will try to figure out what part of superenv may cause this. Though I'll take a while longer.

@manphiz
Collaborator

So after some digging, I kind of know the cause of the problem. It turns out tbb will generate version string during the process using the following command:

sh ../../build/version_info_macos.sh clang++ -g -O0 -DTBB_USE_DEBUG -DUSE_PTHREAD -m64 -fPIC -D__TBB_BUILD=1 -Wall -Wno-non-virtual-dtor -w -pipe -I../../src -I../../src/rml/include -I../../include >version_string.ver

Under stdenv it will generate

#define __TBB_VERSION_STRINGS(N) \
#N": BUILD_HOST     Xiyues-MBP (i386)" ENDL \
#N": BUILD_OS       Mac OS X version 10.8.5" ENDL \
#N": BUILD_KERNEL   Darwin Kernel Version 12.5.0: Mon Jul 29 16:33:49 PDT 2013; root:xnu-2050.48.11~1/RELEASE_X86_64" ENDL \
#N": BUILD_GCC      Apple LLVM version 5.0 (clang-500.2.76) (based on LLVM 3.3svn)" ENDL \
#N": BUILD_TARGET   intel64 on cc4.2.1_os10.8.5" ENDL \
#N": BUILD_COMMAND  clang++ -g -O0 -DTBB_USE_DEBUG -DUSE_PTHREAD -m64 -fPIC -D__TBB_BUILD=1 -Wall -Wno-non-virtual-dtor -w -pipe -I../../src -I../../src/rml/include -I../../include" ENDL \

#define __TBB_DATETIME "Fri Sep 27 10:32:54 UTC 2013"

And under superenv, the content becomes:

$ cat version_string.ver 
#define __TBB_VERSION_STRINGS(N) \
#N": BUILD_HOST     Xiyues-MBP (i386)" ENDL \
#N": BUILD_OS       Mac OS X version 10.8.5" ENDL \
#N": BUILD_KERNEL   Darwin Kernel Version 12.5.0: Mon Jul 29 16:33:49 PDT 2013; root:xnu-2050.48.11~1/RELEASE_X86_64" ENDL \
#N": BUILD_GCC      Apple LLVM version 5.0 (clang-500.2.76) (based on LLVM 3.3svn) "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld" -demangle -dynamic -arch x86_64 -macosx_version_min 10.8.0 -w -o a.out -L/usr/local/lib -L/System/Library/Frameworks/OpenGL.framework/Versions/Current/Libraries -headerpad_max_install_names -lSystem /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/clang/5.0/lib/darwin/libclang_rt.osx.a" ENDL \
#N": BUILD_TARGET   intel64 on cc4.2.1_os10.8.5" ENDL \
#N": BUILD_COMMAND  clang++ -g -O0 -DTBB_USE_DEBUG -DUSE_PTHREAD -m64 -fPIC -D__TBB_BUILD=1 -Wall -Wno-non-virtual-dtor -I../../src -I../../src/rml/include -I../../include" ENDL \

#define __TBB_DATETIME "Fri Sep 27 10:30:45 UTC 2013"

Notice the BUILD_GCC line, the double quote around the ld command confuses the process. I checked the gcc -v under superenv and got:

$ gcc -v
Apple LLVM version 5.0 (clang-500.2.76) (based on LLVM 3.3svn)
Target: x86_64-apple-darwin12.5.0
Thread model: posix
 "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld" -demangle -dynamic -arch x86_64 -macosx_version_min 10.8.0 -o a.out -L/usr/local/lib -L/System/Library/Frameworks/OpenGL.framework/Versions/Current/Libraries -headerpad_max_install_names -lSystem /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/clang/5.0/lib/darwin/libclang_rt.osx.a
Undefined symbols for architecture x86_64:
  "_main", referenced from:
     implicit entry/start for main executable
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

Looks like the gcc wrapper under superenv is borked. Not sure what could cause this though.

@manphiz
Collaborator
@mistydemeo
Owner

I'll look at this when I get home.

@mistydemeo
Owner

It's also possible this is from the xcrun wrapper, which was spewing nonsense in the past as well.

@mistydemeo
Owner

Appears to have been introduced in 585d7c6.

@mistydemeo
Owner

OK, figured it out. This is actually normal behaviour for clang and gcc, and it not really our fault.

-v is the verbose flag for clang and gcc, not the version flag as tbb appears to think it is. (That's --version.) It does incidentally print the version information, and if the compiler just compiling and not running ld that's all it will do. Starting in 585d7c6, we began passing -Wl,-headerpad_max_install_names to all compiler invocations; as a result, gcc and clang are always invoking the linker. Since -v was passed, clang/gcc are displaying the verbose information for the linker, which includes the actual command being executed. And, since no compilation was being done, the linker issues an error about not being able to find main().

In other words, tbb is actually using the wrong option and should be fixed.

@manphiz
Collaborator
@mistydemeo
Owner

The error messages don't actually affect the compiler's behaviour. The real problem is that Intel is requesting verbose output from the compiler when that's not really what they want.

@mistydemeo
Owner

Though I agree it's kinda weird we're invoking the linker in a ton more places than we used to, which is the source of the extra ld errors.

@mistydemeo
Owner

Fixed and submitted a patch upstream.

@handyman5 handyman5 referenced this pull request from a commit
Commit has since been removed from the repository and is no longer available.
@pborzenkov pborzenkov referenced this pull request from a commit
Commit has since been removed from the repository and is no longer available.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Sep 26, 2013
  1. @manphiz

    tbb: use stdenv to fix building.

    manphiz authored
    * Under superenv tbb FTBFS with undeclared identifier.
    
    Closes #22545.
This page is out of date. Refresh to see the latest.
Showing with 2 additions and 0 deletions.
  1. +2 −0  Library/Formula/tbb.rb
View
2  Library/Formula/tbb.rb
@@ -6,6 +6,8 @@ class Tbb < Formula
sha1 'f354bd9b67295f65c43531b751e34f483ed8a024'
version '4.2'
+ env :std
+
fails_with :llvm do
cause 'llvm is not supported on macos. Add build/macos.llvm.inc file with compiler-specific settings.'
end
Something went wrong with that request. Please try again.