<html>
    <head>
      <base href="http://llvm.org/bugs/" />
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW --- - unit tests mistakenly linking to installed (not built) shared libraries at run time on darwin"
   href="http://llvm.org/bugs/show_bug.cgi?id=15217">15217</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>unit tests mistakenly linking to installed (not built) shared libraries at run time on darwin
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>Test Suite
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>trunk
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>Macintosh
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>MacOS X
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>normal
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>lit
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>fang@csl.cornell.edu
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>daniel@zuster.org, llvmbugs@cs.uiuc.edu
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Mis-linking at run time is causing many unit tests to fail.
Build of r174335 on powerpc-darwin8, cmake+shared.
Diagnosis follows.

[fangism:src/LLVM-svn/gcc40-cmake-build] fang% bin/llvm-lit -s -v
--filter=ScalarEvol test/Unit
FAIL: LLVM-Unit ::
Analysis/Debug//Volumes/Isolde/builds/LLVM/gcc40-cmake-build/unittests/Analysis/Debug/AnalysisTests/ScalarEvolutionsTest.SCEVUnknownRAUW
(4 of 6)
******************** TEST 'LLVM-Unit ::
Analysis/Debug//Volumes/Isolde/builds/LLVM/gcc40-cmake-build/unittests/Analysis/Debug/AnalysisTests/ScalarEvolutionsTest.SCEVUnknownRAUW'
FAILED ********************
Note: Google Test filter = ScalarEvolutionsTest.SCEVUnknownRAUW
[==========] Running 1 test from 1 test case.
[----------] Global test environment set-up.
[----------] 1 test from ScalarEvolutionsTest
[ RUN      ] ScalarEvolutionsTest.SCEVUnknownRAUW
dyld: lazy symbol binding failed: Symbol not found:
__ZN4llvm14GlobalVariableC1ERNS_6ModuleEPNS_4TypeEbNS_11GlobalValue12LinkageTypesEPNS_8ConstantERKNS_5TwineEPS0_NS0_15ThreadLocalModeEj
  Referenced from:
/Volumes/Isolde/builds/LLVM/gcc40-cmake-build/unittests/Analysis/Debug/AnalysisTests
  Expected in:
/Users/fang/local/src/LLVM-svn/gcc40-cmake-build/lib/libLLVMCore.dylib

dyld: Symbol not found:
__ZN4llvm14GlobalVariableC1ERNS_6ModuleEPNS_4TypeEbNS_11GlobalValue12LinkageTypesEPNS_8ConstantERKNS_5TwineEPS0_NS0_15ThreadLocalModeEj
  Referenced from:
/Volumes/Isolde/builds/LLVM/gcc40-cmake-build/unittests/Analysis/Debug/AnalysisTests
  Expected in:
/Users/fang/local/src/LLVM-svn/gcc40-cmake-build/lib/libLLVMCore.dylib


********************
FAIL: LLVM-Unit ::
Analysis/Release//Volumes/Isolde/builds/LLVM/gcc40-cmake-build/unittests/Analysis/Release/AnalysisTests/ScalarEvolutionsTest.SCEVUnknownRAUW
(5 of 6)
******************** TEST 'LLVM-Unit ::
Analysis/Release//Volumes/Isolde/builds/LLVM/gcc40-cmake-build/unittests/Analysis/Release/AnalysisTests/ScalarEvolutionsTest.SCEVUnknownRAUW'
FAILED ********************
Note: Google Test filter = ScalarEvolutionsTest.SCEVUnknownRAUW
[==========] Running 1 test from 1 test case.
[----------] Global test environment set-up.
[----------] 1 test from ScalarEvolutionsTest
[ RUN      ] ScalarEvolutionsTest.SCEVUnknownRAUW
dyld: lazy symbol binding failed: Symbol not found:
__ZN4llvm14GlobalVariableC1ERNS_6ModuleEPNS_4TypeEbNS_11GlobalValue12LinkageTypesEPNS_8ConstantERKNS_5TwineEPS0_bj
  Referenced from:
/Volumes/Isolde/builds/LLVM/gcc40-cmake-build/unittests/Analysis/Release/AnalysisTests
  Expected in:
/Users/fang/local/src/LLVM-svn/gcc40-cmake-build/lib/libLLVMCore.dylib

dyld: Symbol not found:
__ZN4llvm14GlobalVariableC1ERNS_6ModuleEPNS_4TypeEbNS_11GlobalValue12LinkageTypesEPNS_8ConstantERKNS_5TwineEPS0_bj
  Referenced from:
/Volumes/Isolde/builds/LLVM/gcc40-cmake-build/unittests/Analysis/Release/AnalysisTests
  Expected in:
/Users/fang/local/src/LLVM-svn/gcc40-cmake-build/lib/libLLVMCore.dylib


********************
FAIL: LLVM-Unit ::
Analysis/Release//Volumes/Isolde/builds/LLVM/gcc40-cmake-build/unittests/Analysis/Release/AnalysisTests/ScalarEvolutionsTest.SCEVMultiplyAddRecs
(6 of 6)
******************** TEST 'LLVM-Unit ::
Analysis/Release//Volumes/Isolde/builds/LLVM/gcc40-cmake-build/unittests/Analysis/Release/AnalysisTests/ScalarEvolutionsTest.SCEVMultiplyAddRecs'
FAILED ********************
Note: Google Test filter = ScalarEvolutionsTest.SCEVMultiplyAddRecs
[==========] Running 1 test from 1 test case.
[----------] Global test environment set-up.
[----------] 1 test from ScalarEvolutionsTest
[ RUN      ] ScalarEvolutionsTest.SCEVMultiplyAddRecs

********************
Testing Time: 103.69s
********************
Failing Tests (3):
    LLVM-Unit ::
Analysis/Debug//Volumes/Isolde/builds/LLVM/gcc40-cmake-build/unittests/Analysis/Debug/AnalysisTests/ScalarEvolutionsTest.SCEVUnknownRAUW
    LLVM-Unit ::
Analysis/Release//Volumes/Isolde/builds/LLVM/gcc40-cmake-build/unittests/Analysis/Release/AnalysisTests/ScalarEvolutionsTest.SCEVMultiplyAddRecs
    LLVM-Unit ::
Analysis/Release//Volumes/Isolde/builds/LLVM/gcc40-cmake-build/unittests/Analysis/Release/AnalysisTests/ScalarEvolutionsTest.SCEVUnknownRAUW

  Expected Passes    : 3
  Unexpected Failures: 3


Those undefined symbols:
[fangism:~] fang% echo
__ZN4llvm14GlobalVariableC1ERNS_6ModuleEPNS_4TypeEbNS_11GlobalValue12LinkageTypesEPNS_8ConstantERKNS_5TwineEPS0_bj
| c++filt
llvm::GlobalVariable::GlobalVariable(llvm::Module&, llvm::Type*, bool,
llvm::GlobalValue::LinkageTypes, llvm::Constant*, llvm::Twine const&,
llvm::GlobalVariable*, bool, unsigned int)
[fangism:~] fang% echo
__ZN4llvm14GlobalVariableC1ERNS_6ModuleEPNS_4TypeEbNS_11GlobalValue12LinkageTypesEPNS_8ConstantERKNS_5TwineEPS0_NS0_15ThreadLocalModeEj
| c++filt
llvm::GlobalVariable::GlobalVariable(llvm::Module&, llvm::Type*, bool,
llvm::GlobalValue::LinkageTypes, llvm::Constant*, llvm::Twine const&,
llvm::GlobalVariable*, llvm::GlobalVariable::ThreadLocalMode, unsigned int)

Those symbols are expected in libLLVMCore.dylib, but the recently built version
contains slightly different symbols, due to an API change:

% nm lib/libLLVMCore.dylib | c++filt | grep GlobalVariable::GlobalVariable
000e2474 T llvm::GlobalVariable::GlobalVariable(llvm::Type*, bool,
llvm::GlobalValue::LinkageTypes, llvm::Constant*, llvm::Twine const&,
llvm::GlobalVariable::ThreadLocalMode, unsigned int, bool)
000e27ac T llvm::GlobalVariable::GlobalVariable(llvm::Module&, llvm::Type*,
bool, llvm::GlobalValue::LinkageTypes, llvm::Constant*, llvm::Twine const&,
llvm::GlobalVariable*, llvm::GlobalVariable::ThreadLocalMode, unsigned int,
bool)
000e2610 T llvm::GlobalVariable::GlobalVariable(llvm::Type*, bool,
llvm::GlobalValue::LinkageTypes, llvm::Constant*, llvm::Twine const&,
llvm::GlobalVariable::ThreadLocalMode, unsigned int, bool)
000e29b0 T llvm::GlobalVariable::GlobalVariable(llvm::Module&, llvm::Type*,
bool, llvm::GlobalValue::LinkageTypes, llvm::Constant*, llvm::Twine const&,
llvm::GlobalVariable*, llvm::GlobalVariable::ThreadLocalMode, unsigned int,
bool)

According to svn annotate, API change was introduced by r174295 (mgottesman),
in the constructors of GlobalVariable.

The undefined symbols referenced are however defined in the *installed*
llvm/clang from an earlier revision:

% nm /usr/local/experimental/llvm/lib/libLLVMCore.dylib | c++filt | grep
GlobalVariable::GlobalVariable
000e2710 T llvm::GlobalVariable::GlobalVariable(llvm::Type*, bool,
llvm::GlobalValue::LinkageTypes, llvm::Constant*, llvm::Twine const&,
llvm::GlobalVariable::ThreadLocalMode, unsigned int)
000e2a20 T llvm::GlobalVariable::GlobalVariable(llvm::Module&, llvm::Type*,
bool, llvm::GlobalValue::LinkageTypes, llvm::Constant*, llvm::Twine const&,
llvm::GlobalVariable*, llvm::GlobalVariable::ThreadLocalMode, unsigned int)
000e2898 T llvm::GlobalVariable::GlobalVariable(llvm::Type*, bool,
llvm::GlobalValue::LinkageTypes, llvm::Constant*, llvm::Twine const&,
llvm::GlobalVariable::ThreadLocalMode, unsigned int)
000e2c10 T llvm::GlobalVariable::GlobalVariable(llvm::Module&, llvm::Type*,
bool, llvm::GlobalValue::LinkageTypes, llvm::Constant*, llvm::Twine const&,
llvm::GlobalVariable*, llvm::GlobalVariable::ThreadLocalMode, unsigned int)


When I run just the unit test executable by itself, the tests pass:
[fangism:src/LLVM-svn/gcc40-cmake-build] fang% unittests/Analysis/AnalysisTests 
[==========] Running 2 tests from 1 test case.
[----------] Global test environment set-up.
[----------] 2 tests from ScalarEvolutionsTest
[ RUN      ] ScalarEvolutionsTest.SCEVUnknownRAUW
[       OK ] ScalarEvolutionsTest.SCEVUnknownRAUW (705 ms)
[ RUN      ] ScalarEvolutionsTest.SCEVMultiplyAddRecs
[       OK ] ScalarEvolutionsTest.SCEVMultiplyAddRecs (86 ms)
[----------] 2 tests from ScalarEvolutionsTest (792 ms total)

[----------] Global test environment tear-down
[==========] 2 tests from 1 test case ran. (794 ms total)
[  PASSED  ] 2 tests.

To confirm, shared library linking was bound to the build-area, not the
install-location:
[fangism:src/LLVM-svn/gcc40-cmake-build] fang% otool -L
unittests/Analysis/AnalysisTests
unittests/Analysis/AnalysisTests:
       
/Users/fang/local/src/LLVM-svn/gcc40-cmake-build/lib/libLLVMAnalysis.dylib
(compatibility version 0.0.0, current version 0.0.0)
       
/Users/fang/local/src/LLVM-svn/gcc40-cmake-build/lib/libLLVMTarget.dylib
(compatibility version 0.0.0, current version 0.0.0)
        /Users/fang/local/src/LLVM-svn/gcc40-cmake-build/lib/libLLVMCore.dylib
(compatibility version 0.0.0, current version 0.0.0)
        /Users/fang/local/src/LLVM-svn/gcc40-cmake-build/lib/libLLVMMC.dylib
(compatibility version 0.0.0, current version 0.0.0)
       
/Users/fang/local/src/LLVM-svn/gcc40-cmake-build/lib/libLLVMObject.dylib
(compatibility version 0.0.0, current version 0.0.0)
       
/Users/fang/local/src/LLVM-svn/gcc40-cmake-build/lib/libLLVMSupport.dylib
(compatibility version 0.0.0, current version 0.0.0)
        /Users/fang/local/src/LLVM-svn/gcc40-cmake-build/lib/libgtest.dylib
(compatibility version 0.0.0, current version 0.0.0)
       
/Users/fang/local/src/LLVM-svn/gcc40-cmake-build/lib/libgtest_main.dylib
(compatibility version 0.0.0, current version 0.0.0)
        /usr/lib/libstdc++.6.dylib (compatibility version 7.0.0, current
version 7.4.0)
        /usr/lib/libgcc_s.1.dylib (compatibility version 1.0.0, current version
1.0.0)
        /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current
version 88.1.12)

Something with llvm-lit is hacking the environment to use the installed
locations for the unit tests, which is incorrect.

In IRC, gribozavr pointed out that this might be attributed to the last lines
of test/Unit/lit.cfg.</pre>
        </div>
      </p>
      <hr>
      <span>You are receiving this mail because:</span>
      
      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>