Skip to content

Build of shared libraries is broken #14

@daveyc

Description

@daveyc

I ran the build.sh script to build a zoslib shared library. The build incorrectly creates the shared object and side file with a double lib prefix resulting in artifacts with the name liblibzoslib.

> ./build.sh -c -r -s                       -s
~/git/zoslib/build ~/git/zoslib
-- The CXX compiler identification is zOS 2.4.1
-- The C compiler identification is zOS 2.4.1
-- The ASM compiler identification is GNU
-- Found assembler: /bin/xlclang
-- Check for working CXX compiler: /bin/xlclang++
-- Check for working CXX compiler: /bin/xlclang++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working C compiler: /bin/xlclang
-- Check for working C compiler: /bin/xlclang -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Configuring done
-- Generating done
-- Build files have been written to: /u/ts8004/git/zoslib/build
Scanning dependencies of target zoslib
[  5%] Building CXX object src/CMakeFiles/zoslib.dir/zos-bpx.cc.o
[ 11%] Building CXX object src/CMakeFiles/zoslib.dir/zos-char-util.cc.o
[ 17%] Building CXX object src/CMakeFiles/zoslib.dir/zos-getentropy.cc.o
[ 23%] Building CXX object src/CMakeFiles/zoslib.dir/zos-io.cc.o
[ 29%] Building CXX object src/CMakeFiles/zoslib.dir/zos-semaphore.cc.o
[ 35%] Building CXX object src/CMakeFiles/zoslib.dir/zos-sys-info.cc.o
[ 41%] Building CXX object src/CMakeFiles/zoslib.dir/zos-tls.cc.o
[ 47%] Building CXX object src/CMakeFiles/zoslib.dir/zos.cc.o
[ 52%] Building ASM object src/CMakeFiles/zoslib.dir/celquopt.s.o
[ 58%] Linking CXX shared library ../lib/liblibzoslib.so
[ 58%] Built target zoslib
Scanning dependencies of target cctest
[ 64%] Building CXX object test/CMakeFiles/cctest.dir/gtest_main.cc.o
[ 70%] Building CXX object test/CMakeFiles/cctest.dir/gtest/gtest-all.cc.o
 WARNING CLC1145: The function "std::__1::shared_ptr<testing::MatcherInterface<std::__1::_ASCII::basic_string<char, std::__1::_ASCII::char_traits<char>, std::__1::allocator<char> > const&> const>::__enable_weak_this(...)" could not be inlined into "std::__1::shared_ptr<testing::MatcherInterface<std::__1::_ASCII::basic_string<char, std::__1::_ASCII::char_traits<char>, std::__1::allocator<char> > const&> const>::shared_ptr<testing::MatcherInterface<std::__1::_ASCII::basic_string<char, std::__1::_ASCII::char_tr
 WARNING CLC1145: The function "std::__1::shared_ptr<testing::MatcherInterface<std::__1::_ASCII::basic_string<char, std::__1::_ASCII::char_traits<char>, std::__1::allocator<char> > const&> const>::__enable_weak_this(...)" could not be inlined into "std::__1::shared_ptr<testing::MatcherInterface<std::__1::_ASCII::basic_string<char, std::__1::_ASCII::char_traits<char>, std::__1::allocator<char> > const&> const>::shared_ptr<testing::MatcherInterface<std::__1::_ASCII::basic_string<char, std::__1::_ASCII::char_tr
[ 76%] Building CXX object test/CMakeFiles/cctest.dir/test-args.cc.o
[ 82%] Building CXX object test/CMakeFiles/cctest.dir/test-bitset.cc.o
[ 88%] Building CXX object test/CMakeFiles/cctest.dir/test-convert.cc.o
[ 94%] Building CXX object test/CMakeFiles/cctest.dir/test-sys-info.cc.o
gmake[2]: *** No rule to make target 'lib/libzoslib.x', needed by 'test/cctest_so'.  Stop.
CMakeFiles/Makefile2:140: recipe for target 'test/CMakeFiles/cctest.dir/all' failed
gmake[1]: *** [test/CMakeFiles/cctest.dir/all] Error 2
Makefile:127: recipe for target 'all' failed
gmake: *** [all] Error 2

To work around this I changed the CMakeLists.txt file to remove the lib prefix which is being add implicitly. I'm sure this is not optimal but I'm not cmake expert.

diff --git a/CMakeLists.txt b/CMakeLists.txt
index f4760e0..c1bf1d6 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -21,7 +21,7 @@ if(NOT CMAKE_BUILD_TYPE)
 endif()

 if(NOT ${BUILD_SHARED_LIBS} MATCHES "OFF")
-  set_target_properties(zoslib PROPERTIES OUTPUT_NAME "libzoslib")
+  set_target_properties(zoslib PROPERTIES OUTPUT_NAME "zoslib")
   set_target_properties(zoslib PROPERTIES SUFFIX ".so")
 endif()

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions