diff --git a/lib/clamp-link.in b/lib/clamp-link.in index 9f8b67c51e6..5d2d126dab8 100755 --- a/lib/clamp-link.in +++ b/lib/clamp-link.in @@ -147,15 +147,11 @@ for ARG in $ARGS do # matches -L if [[ "$ARG" =~ ^-L[^[:space:]]+$ ]]; then - + REAL_PATH=$(readlink -f ${ARG:2}) if [ $VERBOSE == 2 ]; then - echo "adding library search path: ${ARG:2}" - fi - - if [[ "$ARG" =~ ^-L\/[^[:space:]]+$ ]]; then - REAL_PATH=$(readlink -f ${ARG:2}) - LIB_SEARCH_PATHS+=( $REAL_PATH ) + echo "add library path: ${ARG:2}, canonical path: $REAL_PATH" fi + LIB_SEARCH_PATHS+=( $REAL_PATH ) fi done @@ -220,6 +216,10 @@ do for LIB_PATH in "${LIB_SEARCH_PATHS[@]}" do FULL_LIB_PATH=$LIB_PATH"/"$STATIC_LIB_NAME + FULL_LIB_PATH=$(readlink -f $FULL_LIB_PATH) + if [ $VERBOSE == 2 ]; then + echo "trying to detect $FULL_LIB_PATH" + fi if [ -f $FULL_LIB_PATH ]; then if [ $VERBOSE == 2 ]; then echo "$FULL_LIB_PATH detected" diff --git a/tests/Unit/StaticLibrary/static_library2.cpp b/tests/Unit/StaticLibrary/static_library2.cpp new file mode 100644 index 00000000000..150970e4a82 --- /dev/null +++ b/tests/Unit/StaticLibrary/static_library2.cpp @@ -0,0 +1,44 @@ +// RUN: %hc -DSTATIC_LIB %s -c -o %T/static_library2.o +// RUN: ar rcs %T/libstatic_library2.a %T/static_library2.o +// RUN: %hc %s -L./Output -lstatic_library2 -o %t.out && %t.out + +#include +#include + +extern "C" int sum(hc::array_view& input); + +#ifdef STATIC_LIB + +int sum(hc::array_view& input) { + + hc::array_view s(1); + s[0]=0; + + hc::parallel_for_each(input.get_extent(), [=](hc::index<1> idx) [[hc]] { + if (idx[0]==0) { + int num = input.get_extent()[0]; + for (int i = 0; i < num; i++) { + s[0]+=input[i]; + } + } + }).wait(); + + return s[0]; +} + +#else + +int main() { + + hc::array_view av(64); + for (int i = 0;i < 64; i++) + av[i] = i; + + int s = sum(av); + + // printf("sum: %d\n",s); + + return !(s==2016); +} + +#endif