I’m trying to get iostreams working with shared libraries on VxWorks

The tests will compile with clang  if I comment out the forced dependency on static libraries

 

But I’d like to understand the reason for forcing a link of static libraries with a dynamic executable?

 

https://github.com/boostorg/iostreams/blob/4d2e763ba8b88f3350fbea29b54507a3f5adf0f0/test/Jamfile.v2#L25

 

rule test-iostreams ( sources * : requirements * : target-name ? ) {

    return [

            run

                $(sources)

                /boost/test//boost_unit_test_framework # /<link>static

                /boost/filesystem//boost_filesystem    # /<link>static

            : # command

            : # input files

            : # build requirements

                <toolset>msvc:<define>_CRT_SECURE_NO_DEPRECATE

                <toolset>msvc:<define>_SCL_SECURE_NO_DEPRECATE

                <toolset>cw-9.3,<os>darwin:<runtime-link>static

                <define>BOOST_IOSTREAMS_NO_LIB

                <link>shared:<define>BOOST_IOSTREAMS_DYN_LINK=1

                $(requirements)

            : $(target-name)

        ] ;

}

 

If I don’t comments I get a link error.

VxWorks only supports -fpic vs -fPIC

 

clang-vxworks.compile.c++ ../bin.v2/libs/test/build/clang-vxworks-11.0.0.1/debug/cross-compile-vxworks/link-static/unit_test_parameters.o

    "wr-c++" -x c++ -Wno-c99-extensions -Wno-variadic-macros -O3 -finline-functions -Wno-inline -Wall -pedantic -g -Wno-inline -DBOOST_ALL_NO_LIB=1 -DBOOST_BEAST_ALLOW_DEPRECATED -DBOOST_BEAST_SEPARATE_COMPILATION -I".."  -c -o "../bin.v2/libs/test/build/clang-vxworks-11.0.0.1/debug/cross-compile-vxworks/link-static/unit_test_parameters.o" "../libs/test/src/unit_test_parameters.cpp"

clang-vxworks.archive ../bin.v2/libs/test/build/clang-vxworks-11.0.0.1/debug/cross-compile-vxworks/link-static/libboost_unit_test_framework.a

  "wr-ar"  rcu "../bin.v2/libs/test/build/clang-vxworks-11.0.0.1/debug/cross-compile-vxworks/link-static/libboost_unit_test_framework.a" "../bin.v2/libs/test/build/clang-vxworks-11.0.0.1/debug/cross-compile-vxworks/link-static/compiler_log_formatter.o" "../bin.v2/libs/test/build/clang-vxworks-11.0.0.1/debug/cross-compile-vxworks/link-static/debug.o" "../bin.v2/libs/test/build/clang-vxworks-11.0.0.1/debug/cross-compile-vxworks/link-static/decorator.o" "../bin.v2/libs/test/build/clang-vxworks-11.0.0.1/debug/cross-compile-vxworks/link-static/execution_monitor.o" "../bin.v2/libs/test/build/clang-vxworks-11.0.0.1/debug/cross-compile-vxworks/link-static/framework.o" "../bin.v2/libs/test/build/clang-vxworks-11.0.0.1/debug/cross-compile-vxworks/link-static/plain_report_formatter.o" "../bin.v2/libs/test/build/clang-vxworks-11.0.0.1/debug/cross-compile-vxworks/link-static/progress_monitor.o" "../bin.v2/libs/test/build/clang-vxworks-11.0.0.1/debug/cross-compile-vxworks/link-static/results_collector.o" "../bin.v2/libs/test/build/clang-vxworks-11.0.0.1/debug/cross-compile-vxworks/link-static/results_reporter.o" "../bin.v2/libs/test/build/clang-vxworks-11.0.0.1/debug/cross-compile-vxworks/link-static/test_framework_init_observer.o" "../bin.v2/libs/test/build/clang-vxworks-11.0.0.1/debug/cross-compile-vxworks/link-static/test_tools.o" "../bin.v2/libs/test/build/clang-vxworks-11.0.0.1/debug/cross-compile-vxworks/link-static/test_tree.o" "../bin.v2/libs/test/build/clang-vxworks-11.0.0.1/debug/cross-compile-vxworks/link-static/unit_test_log.o" "../bin.v2/libs/test/build/clang-vxworks-11.0.0.1/debug/cross-compile-vxworks/link-static/unit_test_main.o" "../bin.v2/libs/test/build/clang-vxworks-11.0.0.1/debug/cross-compile-vxworks/link-static/unit_test_monitor.o" "../bin.v2/libs/test/build/clang-vxworks-11.0.0.1/debug/cross-compile-vxworks/link-static/unit_test_parameters.o" "../bin.v2/libs/test/build/clang-vxworks-11.0.0.1/debug/cross-compile-vxworks/link-static/junit_log_formatter.o" "../bin.v2/libs/test/build/clang-vxworks-11.0.0.1/debug/cross-compile-vxworks/link-static/xml_log_formatter.o" "../bin.v2/libs/test/build/clang-vxworks-11.0.0.1/debug/cross-compile-vxworks/link-static/xml_report_formatter.o"

clang-vxworks.link ../bin.v2/libs/iostreams/test/array_test.test/clang-vxworks-11.0.0.1/debug/cross-compile-vxworks/array_test.vxe

    "wr-c++"  -o "../bin.v2/libs/iostreams/test/array_test.test/clang-vxworks-11.0.0.1/debug/cross-compile-vxworks/array_test.vxe"    "../bin.v2/libs/iostreams/test/array_test.test/clang-vxworks-11.0.0.1/debug/cross-compile-vxworks/array_test.o" "../bin.v2/libs/test/build/clang-vxworks-11.0.0.1/debug/cross-compile-vxworks/link-static/libboost_unit_test_framework.a" "../bin.v2/libs/filesystem/build/clang-vxworks-11.0.0.1/debug/cross-compile-vxworks/link-static/libboost_filesystem.a" -shared --start-group      --end-group  -fpic

/opt/git/vx7/compilers/llvm-11.0.0.1/LINUX64/bin/ldarm: ../bin.v2/libs/test/build/clang-vxworks-11.0.0.1/debug/cross-compile-vxworks/link-static/libboost_unit_test_framework.a(test_tools.o): relocation R_ARM_MOVW_ABS_NC against `a local symbol' can not be used when making a shared object; recompile with -fPIC

/opt/git/vx7/compilers/llvm-11.0.0.1/LINUX64/bin/ldarm: ../bin.v2/libs/test/build/clang-vxworks-11.0.0.1/debug/cross-compile-vxworks/link-static/libboost_unit_test_framework.a(test_tree.o): relocation R_ARM_MOVW_ABS_NC against `a local symbol' can not be used when making a shared object; recompile with -fPIC