C linking question / bug

#1

I am using rust 1.31.1 on Ubuntu 18.04 writing a simple rust program to call a function in a C library. It works if I follow samples for libraries like snappy. For my particular use case, I am linking against multiple vendor supplied C libraries (over 100). cargo build correctly builds the executable but when I go to run the executable I get a “symbol lookup error”. If I do a ldd taget/debug/XXX, then the library that contains the symbol is not linked into the executable. However, when I do cargo build --verbose I see the library listed on the command line. Since there are so many shared libraries to link against, I am using a build script and setting cargo:rustc-link-lib=XXX. Should this be filed as a bug? I am hoping there is something simple I am missing or maybe a flag I can set. I would just expect any library that I specify as a rustc-link-lib to be linked into the final executable and shown via ldd on the final executable.

#2

Do you mean it’s not even listed by ldd or that ldd reports it cannot find the .so?

#3

I mean that it is not even listed by ldd. Some of the libraries specified via rustc-link-lib are listed by ldd but the config one is not listed.
What makes this situation more complicated is the number of libraries involved. In my rust code I am invoking the C function Foo defined in the library foo and the library foo is listed by ldd. However, the C Foo function depends on functionality in multiple other shared libraries, which is why I specify those libraries via the rustc-link-lib. I have similar code working in Go and C++ to invoke the C Foo function and when I run ldd against those executables both libraries foo and config are listed in the output.

#4

I’m assuming ldd libfoo.so shows libconfig.so as a dependency?

Do you know if there’s any runtime library (and symbol) loading going on (i.e. dlopen type of thing)? Or is this pretty vanilla stuff?

Also, can you share the linker invocation (stripped down to the libs in question, if you must) that cargo/rustc generate?

#5

For sharing the invocation, do you mean just doing cargo build --verbose and sharing that output?

#6

Argh crap - I thought cargo had an option these days to show link args, but doesn’t appear to be the case.

What you can try is:

  1. Run cargo build -vv ... to get the full rustc invocation.
  2. Take that rustc invocation, and run it (against the nightly compiler) with an additional -Z print-link-args CLI arg. This should show the linker args.
#7

I am relatively new to rust, I used rustup to install 1.31.1 Do I need to use rustup to install the nightly compiler? How would I run rustc against the nightly compiler while having 1.13.1 installed? Is there some documentation that would help me with this?

#8

Yeah, you’d basically do the following:

  1. rustup install nightly
  2. rustup default nightly (this changes your default rustc to be the nightly - use rustup default stable to switch back).
  3. Proceed to use the nightly rustc to invoke the cargo-generated rustc invocation manually, passing that -Z flag.
#9

Okay. I will try that, in the meantime when I just ran cargo build -vv I can see that rust is using cc -Wl,--as-needed ..... Based on the information here: http://www.bnikolic.co.uk/blog/gnu-ld-as-needed.html it looks like the as-needed may be what is making the link libraries not appear on ldd because the linker (incorrectly) thinks the program doesn’t need those libraries. Is there any way I can override the default linker behavior and cause the --as-needed flag to be removed from the link command?

#10

I have the build logs but they are 350 KB files and they exceed the limit of this post. How would you like for me to get them to you?

#11

Is the link order correct? With as-needed, the order becomes important; -lconfig needs to come after (in the link args) any objects or libraries that make use of its provided symbols (such as the foo lib you have).

As for turning as-needed off, you can try setting the following environment variable prior to compilation: RUSTFLAGS=-C link-args='-Wl,—no-as-needed'

I’m on mobile at the moment so the above may be slightly off but hopefully enough for you to further google/search.

#12

I did as you requested and below is the command generated by cargo build. As you can see -l config is present but the libconfig is still not shown by ldd. I am using the library link order as defined by the vendor.

`rustc --edition=2018 --crate-name tclogin src/main.rs --color always --crate-type bin --emit=dep-info,link -C debuginfo=2 -C metadata=16096664381cadba -C extra-filename=-16096664381cadba --out-dir '/home/mauldinl@gvl.is.l-3com.com/code/rust/tclogin/target/debug/deps' -C 'incremental=/home/mauldinl@gvl.is.l-3com.com/code/rust/tclogin/target/debug/incremental' -L 'dependency=/home/mauldinl@gvl.is.l-3com.com/code/rust/tclogin/target/debug/deps' -C link-arg=-Wl,--unresolved-symbols=ignore-all -C link-arg=-Wl,--no-as-needed -L native=/apps/tc9/lib -L native=/apps/tc9/lib/oracle -L native=/usr/lib/x86_64-linux-gnu -l gdis -l eintstub -l nxmgr_im -l internal_exits -l ae -l aie -l appr -l archive -l vis -l vm -l backup -l bmf -l bob -l bom -l cae -l cfm -l config -l cxpom -l dmi -l mgc -l ecm -l eint -l epm -l fclasses -l form -l grm -l tcinit -l tc -l sml -l tccore -l tctrushape -l qsearch -l itk -l base_utils -l ics -l lov -l me -l mld -l objio -l ove -l property -l ps -l publication -l pie -l ai -l qry -l res -l req -l adsfoundation -l tcsoacorestrong -l sa -l schmgt -l schmgt_bridge -l ss -l vispublish -l sub_mgr -l clientcache -l textsrv -l rdv -l TcCrypto -l tcsso -l collabctx -l mechatronics -l docmgtapp -l contmgmt -l server_exits -l internal_server_exits -l tcgsoap -l aiwebservice -l tcxsd -l configurator -l tcsoacommon -l tcsoaclient -l tcgateway -l tcsoaserver -l tcserverutil -l validation -l cp -l tcmultisitetypes -l tcmultisitestrong -l tcsoaworkflow -l tcsoaworkflowtypes -l tcsoaworkflownative -l tc_utils -l tccoreext -l rbf -l ce -l clips -l clipsutil -l gms -l tie -l briefcase -l visualization -l nxclone -l vendormanagementdispatch -l ccdm -l productvariant -l functionality -l icsie -l condvalidation -l smartuibldr -l fnd0soadiagramming -l fnd0soadiagrammingtypes -l tcsoacoretypes -l tcsoacore -l tcsoaprojectmanagement -l tcsoaprojectmanagementtypes -l tcsoaprojectmanagementnative -l bmidebase -l pdi_corba_server -l ict -l cba -l sharedcache -l sharedcachetypes -l booleanmath -l cbaext -l cfilter -l fnd0booleansolve -l dispatcher -l meta -l metaframework -l secore -l foundationdispatch -l cmdispatch -l cm -l Fnd0nweditor -l usagewc -l usage -l constants -l mfg -l mfgbvr -l ssrsccuaclient -l scmccdispatch -l extensionframework -l docmgt -l issuemgmt -l functionality -l condvalidation -l Fnd0profiler -l Fnd0formulamgmt -l pom -l syss -l ugmath -l plmxmlSDK -l plmxmlExtensions -l plmContainerSDK -l icui18n341 -l xerces270 -l xalan110 -l c -l m -l dl -l nsl -l elf -l resolv -l clntsh -l db2 -l icuuc341 -l icudata341 -l TcCryptoUtil -l poco -l TAO -l ACE -l Fnd0propertyrenderer -l nnz10 -l tccurl -l TcMemBinding64 -l TcMemCppBinding64`
mauldinl@l800223280:~/code/rust/tclogin$ ldd ./target/debug/tclogin 
    linux-vdso.so.1 (0x00007ffef9b2b000)
    libtcinit.so => /apps/tc9/lib/libtcinit.so (0x00007f881b4a1000)
    libtc.so => /apps/tc9/lib/libtc.so (0x00007f881ac8c000)
    libtccore.so => /apps/tc9/lib/libtccore.so (0x00007f881a1f8000)
    libtctrushape.so => /apps/tc9/lib/libtctrushape.so (0x00007f881a025000)
    libqsearch.so => /apps/tc9/lib/libqsearch.so (0x00007f88199ce000)
    libbase_utils.so => /apps/tc9/lib/libbase_utils.so (0x00007f88198b2000)
    libics.so => /apps/tc9/lib/libics.so (0x00007f8819556000)
    liblov.so => /apps/tc9/lib/liblov.so (0x00007f881929c000)
    libme.so => /apps/tc9/lib/libme.so (0x00007f8818c57000)
    libmld.so => /apps/tc9/lib/libmld.so (0x00007f8818ab3000)
    libobjio.so => /apps/tc9/lib/libobjio.so (0x00007f88187b0000)
    libove.so => /apps/tc9/lib/libove.so (0x00007f8818649000)
    libproperty.so => /apps/tc9/lib/libproperty.so (0x00007f8818213000)
    libps.so => /apps/tc9/lib/libps.so (0x00007f8817ad0000)
    libpublication.so => /apps/tc9/lib/libpublication.so (0x00007f88175a3000)
    libpie.so => /apps/tc9/lib/libpie.so (0x00007f8817170000)
    libai.so => /apps/tc9/lib/libai.so (0x00007f8816ed6000)
    libqry.so => /apps/tc9/lib/libqry.so (0x00007f8816bc5000)
    libres.so => /apps/tc9/lib/libres.so (0x00007f8816a4c000)
    libreq.so => /apps/tc9/lib/libreq.so (0x00007f8816616000)
    libsa.so => /apps/tc9/lib/libsa.so (0x00007f88160e4000)
    libschmgt.so => /apps/tc9/lib/libschmgt.so (0x00007f8815cb5000)
    libss.so => /apps/tc9/lib/libss.so (0x00007f8815b98000)
    libvispublish.so => /apps/tc9/lib/libvispublish.so (0x00007f8815a8b000)
    libsub_mgr.so => /apps/tc9/lib/libsub_mgr.so (0x00007f88158d8000)
    libtextsrv.so => /apps/tc9/lib/libtextsrv.so (0x00007f881578b000)
    librdv.so => /apps/tc9/lib/librdv.so (0x00007f881530d000)
    libcollabctx.so => /apps/tc9/lib/libcollabctx.so (0x00007f88150d3000)
    libmechatronics.so => /apps/tc9/lib/libmechatronics.so (0x00007f8814d69000)
    libtcgsoap.so => /apps/tc9/lib/libtcgsoap.so (0x00007f8814abf000)
    libconfigurator.so => /apps/tc9/lib/libconfigurator.so (0x00007f8814977000)
    libvalidation.so => /apps/tc9/lib/libvalidation.so (0x00007f881452e000)
    libtc_utils.so => /apps/tc9/lib/libtc_utils.so (0x00007f88143b3000)
    libtccoreext.so => /apps/tc9/lib/libtccoreext.so (0x00007f88141e3000)
    librbf.so => /apps/tc9/lib/librbf.so (0x00007f881406c000)
    libce.so => /apps/tc9/lib/libce.so (0x00007f8813f21000)
    libclipsutil.so => /apps/tc9/lib/libclipsutil.so (0x00007f8813e0e000)
    libgms.so => /apps/tc9/lib/libgms.so (0x00007f8813c9e000)
    libtie.so => /apps/tc9/lib/libtie.so (0x00007f8813829000)
    libbriefcase.so => /apps/tc9/lib/libbriefcase.so (0x00007f8813719000)
    libvisualization.so => /apps/tc9/lib/libvisualization.so (0x00007f88135e4000)
    libfunctionality.so => /apps/tc9/lib/libfunctionality.so (0x00007f88134b7000)
    libcondvalidation.so => /apps/tc9/lib/libcondvalidation.so (0x00007f8813349000)
    libbmidebase.so => /apps/tc9/lib/libbmidebase.so (0x00007f88131cd000)
    libsharedcache.so => /apps/tc9/lib/libsharedcache.so (0x00007f8813097000)
    libsharedcachetypes.so => /apps/tc9/lib/libsharedcachetypes.so (0x00007f8812f83000)
    libbooleanmath.so => /apps/tc9/lib/libbooleanmath.so (0x00007f8812e0c000)
    libfnd0booleansolve.so => /apps/tc9/lib/libfnd0booleansolve.so (0x00007f8812c10000)
    libdispatcher.so => /apps/tc9/lib/libdispatcher.so (0x00007f8812abd000)
    libmetaframework.so => /apps/tc9/lib/libmetaframework.so (0x00007f8812953000)
    libfoundationdispatch.so => /apps/tc9/lib/libfoundationdispatch.so (0x00007f8812352000)
    libusage.so => /apps/tc9/lib/libusage.so (0x00007f8812228000)
    libconstants.so => /apps/tc9/lib/libconstants.so (0x00007f8812069000)
    libmfg.so => /apps/tc9/lib/libmfg.so (0x00007f8811d17000)
    libmfgbvr.so => /apps/tc9/lib/libmfgbvr.so (0x00007f8811674000)
    libssrsccuaclient.so => /apps/tc9/lib/libssrsccuaclient.so (0x00007f881155d000)
    libextensionframework.so => /apps/tc9/lib/libextensionframework.so (0x00007f88113b4000)
    libdocmgt.so => /apps/tc9/lib/libdocmgt.so (0x00007f88111d0000)
    libFnd0formulamgmt.so => /apps/tc9/lib/libFnd0formulamgmt.so (0x00007f881106f000)
    libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f8810c7e000)
    libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007f8810a7a000)
    libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007f881085b000)
    libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007f8810643000)
    /lib64/ld-linux-x86-64.so.2 (0x00007f881b38d000)
    libTcCrypto.so => /apps/tc9/lib/libTcCrypto.so (0x00007f8810392000)
    libtcsso.so => /apps/tc9/lib/libtcsso.so (0x00007f88101e9000)
    libsyss.so => /apps/tc9/lib/libsyss.so (0x00007f880fdc8000)
    libugmath.so => /apps/tc9/lib/libugmath.so (0x00007f880fc4b000)
    libclntsh.so.10.1 => /apps/tc9/lib/libclntsh.so.10.1 (0x00007f880ed8a000)
    libdb2.so.1 => /apps/tc9/lib/libdb2.so.1 (0x00007f880d2be000)
    libplmxmlSDK.so => /apps/tc9/lib/libplmxmlSDK.so (0x00007f880bf7b000)
    libplmxmlExtensions.so => /apps/tc9/lib/libplmxmlExtensions.so (0x00007f880bcbb000)
    libplmContainerSDK.so => /apps/tc9/lib/libplmContainerSDK.so (0x00007f880ba4e000)
    libicui18n341.so => /apps/tc9/lib/libicui18n341.so (0x00007f880b7f3000)
    libxerces270.so => /apps/tc9/lib/libxerces270.so (0x00007f880b2e7000)
    libxalan110.so => /apps/tc9/lib/libxalan110.so (0x00007f880ad8d000)
    libicudata341.so => /apps/tc9/lib/libicudata341.so (0x00007f880a419000)
    libicuuc341.so => /apps/tc9/lib/libicuuc341.so (0x00007f880a1be000)
    libresolv.so.2 => /lib/x86_64-linux-gnu/libresolv.so.2 (0x00007f8809fa3000)
    librt.so.1 => /lib/x86_64-linux-gnu/librt.so.1 (0x00007f8809d9b000)
    libstdc++.so.6 => /usr/lib/x86_64-linux-gnu/libstdc++.so.6 (0x00007f8809a12000)
    libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007f8809674000)
    libTcCryptoUtil.so => /apps/tc9/lib/libTcCryptoUtil.so (0x00007f8809564000)
    libpoco.so => /apps/tc9/lib/libpoco.so (0x00007f8809152000)
    libtcsoacommon.so => /apps/tc9/lib/libtcsoacommon.so (0x00007f8808d1e000)
    libtcsoaclient.so => /apps/tc9/lib/libtcsoaclient.so (0x00007f8808175000)
    libtcmultisitestrong.so => /apps/tc9/lib/libtcmultisitestrong.so (0x00007f8807fa6000)
    libtcmultisitetypes.so => /apps/tc9/lib/libtcmultisitetypes.so (0x00007f8807b45000)
    libtcsoacorestrong.so => /apps/tc9/lib/libtcsoacorestrong.so (0x00007f880782e000)
    libtcsoacoretypes.so => /apps/tc9/lib/libtcsoacoretypes.so (0x00007f8806f35000)
    libsecore.so => /apps/tc9/lib/libsecore.so (0x00007f8806d92000)
    libdocmgtapp.so => /apps/tc9/lib/libdocmgtapp.so (0x00007f8806c4c000)
    libTAO.so => /apps/tc9/lib/libTAO.so (0x00007f88068ab000)
    libACE.so => /apps/tc9/lib/libACE.so (0x00007f88065c3000)
    libclips.so => /apps/tc9/lib/libclips.so (0x00007f88063d6000)
    libFnd0nweditor.so => /apps/tc9/lib/libFnd0nweditor.so (0x00007f8806219000)
    libFnd0profiler.so => /apps/tc9/lib/libFnd0profiler.so (0x00007f8806107000)
    libFnd0propertyrenderer.so => /apps/tc9/lib/libFnd0propertyrenderer.so (0x00007f8805fea000)
    libpom.so => /apps/tc9/lib/libpom.so (0x00007f8805b27000)
    libcxpom.so => /apps/tc9/lib/libcxpom.so (0x00007f8805954000)
    libfclasses.so => /apps/tc9/lib/libfclasses.so (0x00007f8805717000)
    libbom.so => /apps/tc9/lib/libbom.so (0x00007f88050d1000)
    libcfm.so => /apps/tc9/lib/libcfm.so (0x00007f8804e92000)
    libmeta.so => /apps/tc9/lib/libmeta.so (0x00007f8804cc3000)
    libbmf.so => /apps/tc9/lib/libbmf.so (0x00007f8804b1f000)
    libelf.so.0 => /apps/tc9/lib/libelf.so.0 (0x00007f8804a09000)
    libnnz10.so => /apps/tc9/lib/libnnz10.so (0x00007f8804794000)
    libnsl.so.1 => /lib/x86_64-linux-gnu/libnsl.so.1 (0x00007f880457a000)
    libcrypt.so.1 => /lib/x86_64-linux-gnu/libcrypt.so.1 (0x00007f8804342000)
    libtccurl.so => /apps/tc9/lib/libtccurl.so (0x00007f880420f000)
    libTcMemCppBinding64.so => /apps/tc9/tccs/lib/libTcMemCppBinding64.so (0x00007f88040e4000)
    libTcMemBinding64.so => /apps/tc9/tccs/lib/libTcMemBinding64.so (0x00007f8803fd7000)
mauldinl@l800223280:~/code/rust/tclogin$ ldd ./target/debug/tclogin 
    linux-vdso.so.1 (0x00007ffc01593000)
    libtcinit.so => /apps/tc9/lib/libtcinit.so (0x00007f1ed843d000)
    libtc.so => /apps/tc9/lib/libtc.so (0x00007f1ed7c28000)
    libtccore.so => /apps/tc9/lib/libtccore.so (0x00007f1ed7194000)
    libtctrushape.so => /apps/tc9/lib/libtctrushape.so (0x00007f1ed6fc1000)
    libqsearch.so => /apps/tc9/lib/libqsearch.so (0x00007f1ed696a000)
    libbase_utils.so => /apps/tc9/lib/libbase_utils.so (0x00007f1ed684e000)
    libics.so => /apps/tc9/lib/libics.so (0x00007f1ed64f2000)
    liblov.so => /apps/tc9/lib/liblov.so (0x00007f1ed6238000)
    libme.so => /apps/tc9/lib/libme.so (0x00007f1ed5bf3000)
    libmld.so => /apps/tc9/lib/libmld.so (0x00007f1ed5a4f000)
    libobjio.so => /apps/tc9/lib/libobjio.so (0x00007f1ed574c000)
    libove.so => /apps/tc9/lib/libove.so (0x00007f1ed55e5000)
    libproperty.so => /apps/tc9/lib/libproperty.so (0x00007f1ed51af000)
    libps.so => /apps/tc9/lib/libps.so (0x00007f1ed4a6c000)
    libpublication.so => /apps/tc9/lib/libpublication.so (0x00007f1ed453f000)
    libpie.so => /apps/tc9/lib/libpie.so (0x00007f1ed410c000)
    libai.so => /apps/tc9/lib/libai.so (0x00007f1ed3e72000)
    libqry.so => /apps/tc9/lib/libqry.so (0x00007f1ed3b61000)
    libres.so => /apps/tc9/lib/libres.so (0x00007f1ed39e8000)
    libreq.so => /apps/tc9/lib/libreq.so (0x00007f1ed35b2000)
    libsa.so => /apps/tc9/lib/libsa.so (0x00007f1ed3080000)
    libschmgt.so => /apps/tc9/lib/libschmgt.so (0x00007f1ed2c51000)
    libss.so => /apps/tc9/lib/libss.so (0x00007f1ed2b34000)
    libvispublish.so => /apps/tc9/lib/libvispublish.so (0x00007f1ed2a27000)
    libsub_mgr.so => /apps/tc9/lib/libsub_mgr.so (0x00007f1ed2874000)
    libtextsrv.so => /apps/tc9/lib/libtextsrv.so (0x00007f1ed2727000)
    librdv.so => /apps/tc9/lib/librdv.so (0x00007f1ed22a9000)
    libcollabctx.so => /apps/tc9/lib/libcollabctx.so (0x00007f1ed206f000)
    libmechatronics.so => /apps/tc9/lib/libmechatronics.so (0x00007f1ed1d05000)
    libtcgsoap.so => /apps/tc9/lib/libtcgsoap.so (0x00007f1ed1a5b000)
    libconfigurator.so => /apps/tc9/lib/libconfigurator.so (0x00007f1ed1913000)
    libvalidation.so => /apps/tc9/lib/libvalidation.so (0x00007f1ed14ca000)
    libtc_utils.so => /apps/tc9/lib/libtc_utils.so (0x00007f1ed134f000)
    libtccoreext.so => /apps/tc9/lib/libtccoreext.so (0x00007f1ed117f000)
    librbf.so => /apps/tc9/lib/librbf.so (0x00007f1ed1008000)
    libce.so => /apps/tc9/lib/libce.so (0x00007f1ed0ebd000)
    libclipsutil.so => /apps/tc9/lib/libclipsutil.so (0x00007f1ed0daa000)
    libgms.so => /apps/tc9/lib/libgms.so (0x00007f1ed0c3a000)
    libtie.so => /apps/tc9/lib/libtie.so (0x00007f1ed07c5000)
    libbriefcase.so => /apps/tc9/lib/libbriefcase.so (0x00007f1ed06b5000)
    libvisualization.so => /apps/tc9/lib/libvisualization.so (0x00007f1ed0580000)
    libfunctionality.so => /apps/tc9/lib/libfunctionality.so (0x00007f1ed0453000)
    libcondvalidation.so => /apps/tc9/lib/libcondvalidation.so (0x00007f1ed02e5000)
    libbmidebase.so => /apps/tc9/lib/libbmidebase.so (0x00007f1ed0169000)
    libsharedcache.so => /apps/tc9/lib/libsharedcache.so (0x00007f1ed0033000)
    libsharedcachetypes.so => /apps/tc9/lib/libsharedcachetypes.so (0x00007f1ecff1f000)
    libbooleanmath.so => /apps/tc9/lib/libbooleanmath.so (0x00007f1ecfda8000)
    libfnd0booleansolve.so => /apps/tc9/lib/libfnd0booleansolve.so (0x00007f1ecfbac000)
    libdispatcher.so => /apps/tc9/lib/libdispatcher.so (0x00007f1ecfa59000)
    libmetaframework.so => /apps/tc9/lib/libmetaframework.so (0x00007f1ecf8ef000)
    libfoundationdispatch.so => /apps/tc9/lib/libfoundationdispatch.so (0x00007f1ecf2ee000)
    libusage.so => /apps/tc9/lib/libusage.so (0x00007f1ecf1c4000)
    libconstants.so => /apps/tc9/lib/libconstants.so (0x00007f1ecf005000)
    libmfg.so => /apps/tc9/lib/libmfg.so (0x00007f1ececb3000)
    libmfgbvr.so => /apps/tc9/lib/libmfgbvr.so (0x00007f1ece610000)
    libssrsccuaclient.so => /apps/tc9/lib/libssrsccuaclient.so (0x00007f1ece4f9000)
    libextensionframework.so => /apps/tc9/lib/libextensionframework.so (0x00007f1ece350000)
    libdocmgt.so => /apps/tc9/lib/libdocmgt.so (0x00007f1ece16c000)
    libFnd0formulamgmt.so => /apps/tc9/lib/libFnd0formulamgmt.so (0x00007f1ece00b000)
    libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f1ecdc1a000)
    libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007f1ecda16000)
    libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007f1ecd7f7000)
    libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007f1ecd5df000)
    /lib64/ld-linux-x86-64.so.2 (0x00007f1ed8329000)
    libTcCrypto.so => /apps/tc9/lib/libTcCrypto.so (0x00007f1ecd32e000)
    libtcsso.so => /apps/tc9/lib/libtcsso.so (0x00007f1ecd185000)
    libsyss.so => /apps/tc9/lib/libsyss.so (0x00007f1eccd64000)
    libugmath.so => /apps/tc9/lib/libugmath.so (0x00007f1eccbe7000)
    libclntsh.so.10.1 => /apps/tc9/lib/libclntsh.so.10.1 (0x00007f1ecbd26000)
    libdb2.so.1 => /apps/tc9/lib/libdb2.so.1 (0x00007f1eca25a000)
    libplmxmlSDK.so => /apps/tc9/lib/libplmxmlSDK.so (0x00007f1ec8f17000)
    libplmxmlExtensions.so => /apps/tc9/lib/libplmxmlExtensions.so (0x00007f1ec8c57000)
    libplmContainerSDK.so => /apps/tc9/lib/libplmContainerSDK.so (0x00007f1ec89ea000)
    libicui18n341.so => /apps/tc9/lib/libicui18n341.so (0x00007f1ec878f000)
    libxerces270.so => /apps/tc9/lib/libxerces270.so (0x00007f1ec8283000)
    libxalan110.so => /apps/tc9/lib/libxalan110.so (0x00007f1ec7d29000)
    libicudata341.so => /apps/tc9/lib/libicudata341.so (0x00007f1ec73b5000)
    libicuuc341.so => /apps/tc9/lib/libicuuc341.so (0x00007f1ec715a000)
    libresolv.so.2 => /lib/x86_64-linux-gnu/libresolv.so.2 (0x00007f1ec6f3f000)
    librt.so.1 => /lib/x86_64-linux-gnu/librt.so.1 (0x00007f1ec6d37000)
    libstdc++.so.6 => /usr/lib/x86_64-linux-gnu/libstdc++.so.6 (0x00007f1ec69ae000)
    libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007f1ec6610000)
    libTcCryptoUtil.so => /apps/tc9/lib/libTcCryptoUtil.so (0x00007f1ec6500000)
    libpoco.so => /apps/tc9/lib/libpoco.so (0x00007f1ec60ee000)
    libtcsoacommon.so => /apps/tc9/lib/libtcsoacommon.so (0x00007f1ec5cba000)
    libtcsoaclient.so => /apps/tc9/lib/libtcsoaclient.so (0x00007f1ec5111000)
    libtcmultisitestrong.so => /apps/tc9/lib/libtcmultisitestrong.so (0x00007f1ec4f42000)
    libtcmultisitetypes.so => /apps/tc9/lib/libtcmultisitetypes.so (0x00007f1ec4ae1000)
    libtcsoacorestrong.so => /apps/tc9/lib/libtcsoacorestrong.so (0x00007f1ec47ca000)
    libtcsoacoretypes.so => /apps/tc9/lib/libtcsoacoretypes.so (0x00007f1ec3ed1000)
    libsecore.so => /apps/tc9/lib/libsecore.so (0x00007f1ec3d2e000)
    libdocmgtapp.so => /apps/tc9/lib/libdocmgtapp.so (0x00007f1ec3be8000)
    libTAO.so => /apps/tc9/lib/libTAO.so (0x00007f1ec3847000)
    libACE.so => /apps/tc9/lib/libACE.so (0x00007f1ec355f000)
    libclips.so => /apps/tc9/lib/libclips.so (0x00007f1ec3372000)
    libFnd0nweditor.so => /apps/tc9/lib/libFnd0nweditor.so (0x00007f1ec31b5000)
    libFnd0profiler.so => /apps/tc9/lib/libFnd0profiler.so (0x00007f1ec30a3000)
    libFnd0propertyrenderer.so => /apps/tc9/lib/libFnd0propertyrenderer.so (0x00007f1ec2f86000)
    libpom.so => /apps/tc9/lib/libpom.so (0x00007f1ec2ac3000)
    libcxpom.so => /apps/tc9/lib/libcxpom.so (0x00007f1ec28f0000)
    libfclasses.so => /apps/tc9/lib/libfclasses.so (0x00007f1ec26b3000)
    libbom.so => /apps/tc9/lib/libbom.so (0x00007f1ec206d000)
    libcfm.so => /apps/tc9/lib/libcfm.so (0x00007f1ec1e2e000)
    libmeta.so => /apps/tc9/lib/libmeta.so (0x00007f1ec1c5f000)
    libbmf.so => /apps/tc9/lib/libbmf.so (0x00007f1ec1abb000)
    libelf.so.0 => /apps/tc9/lib/libelf.so.0 (0x00007f1ec19a5000)
    libnnz10.so => /apps/tc9/lib/libnnz10.so (0x00007f1ec1730000)
    libnsl.so.1 => /lib/x86_64-linux-gnu/libnsl.so.1 (0x00007f1ec1516000)
    libcrypt.so.1 => /lib/x86_64-linux-gnu/libcrypt.so.1 (0x00007f1ec12de000)
    libtccurl.so => /apps/tc9/lib/libtccurl.so (0x00007f1ec11ab000)
    libTcMemCppBinding64.so => /apps/tc9/tccs/lib/libTcMemCppBinding64.so (0x00007f1ec1080000)
#13

Here is the output of the -Z link args

"cc" "-Wl,--as-needed" "-Wl,-z,noexecstack" "-m64" "-L" "/home/mauldinl@gvl.is.l-3com.com/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib" "/home/mauldinl@gvl.is.l-3com.com/code/rust/tclogin/target/debug/deps/tclogin-5db8faf8d678d9b3.1jaaxaa43dby28dr.rcgu.o" "/home/mauldinl@gvl.is.l-3com.com/code/rust/tclogin/target/debug/deps/tclogin-5db8faf8d678d9b3.1rnoxdvlgpdx445a.rcgu.o" "/home/mauldinl@gvl.is.l-3com.com/code/rust/tclogin/target/debug/deps/tclogin-5db8faf8d678d9b3.1umawbyobguxcy51.rcgu.o" "/home/mauldinl@gvl.is.l-3com.com/code/rust/tclogin/target/debug/deps/tclogin-5db8faf8d678d9b3.1xzkxow43avd7j0r.rcgu.o" "/home/mauldinl@gvl.is.l-3com.com/code/rust/tclogin/target/debug/deps/tclogin-5db8faf8d678d9b3.289zlrrcpzj8tsa3.rcgu.o" "/home/mauldinl@gvl.is.l-3com.com/code/rust/tclogin/target/debug/deps/tclogin-5db8faf8d678d9b3.2b2hsu67b7l32gam.rcgu.o" "/home/mauldinl@gvl.is.l-3com.com/code/rust/tclogin/target/debug/deps/tclogin-5db8faf8d678d9b3.2ysfnsu32indd402.rcgu.o" "/home/mauldinl@gvl.is.l-3com.com/code/rust/tclogin/target/debug/deps/tclogin-5db8faf8d678d9b3.30jyz2855sxau3zd.rcgu.o" "/home/mauldinl@gvl.is.l-3com.com/code/rust/tclogin/target/debug/deps/tclogin-5db8faf8d678d9b3.3b5g9b1snawxd9l.rcgu.o" "/home/mauldinl@gvl.is.l-3com.com/code/rust/tclogin/target/debug/deps/tclogin-5db8faf8d678d9b3.409irdpzmynafrdj.rcgu.o" "/home/mauldinl@gvl.is.l-3com.com/code/rust/tclogin/target/debug/deps/tclogin-5db8faf8d678d9b3.4dmise80b8b0oc4l.rcgu.o" "/home/mauldinl@gvl.is.l-3com.com/code/rust/tclogin/target/debug/deps/tclogin-5db8faf8d678d9b3.4lvyfhrg4rgxv8zo.rcgu.o" "/home/mauldinl@gvl.is.l-3com.com/code/rust/tclogin/target/debug/deps/tclogin-5db8faf8d678d9b3.4sm2t3cgklpv7zsq.rcgu.o" "/home/mauldinl@gvl.is.l-3com.com/code/rust/tclogin/target/debug/deps/tclogin-5db8faf8d678d9b3.4ulyky1ocxwwkank.rcgu.o" "/home/mauldinl@gvl.is.l-3com.com/code/rust/tclogin/target/debug/deps/tclogin-5db8faf8d678d9b3.4vvuaep3yhkvnl4l.rcgu.o" "/home/mauldinl@gvl.is.l-3com.com/code/rust/tclogin/target/debug/deps/tclogin-5db8faf8d678d9b3.58b0w9g4fomm5zdu.rcgu.o" "/home/mauldinl@gvl.is.l-3com.com/code/rust/tclogin/target/debug/deps/tclogin-5db8faf8d678d9b3.5aoj3leo3uutm487.rcgu.o" "/home/mauldinl@gvl.is.l-3com.com/code/rust/tclogin/target/debug/deps/tclogin-5db8faf8d678d9b3.8w7oq3ys437kx7v.rcgu.o" "/home/mauldinl@gvl.is.l-3com.com/code/rust/tclogin/target/debug/deps/tclogin-5db8faf8d678d9b3.hz4a3x6g5rtqsg8.rcgu.o" "/home/mauldinl@gvl.is.l-3com.com/code/rust/tclogin/target/debug/deps/tclogin-5db8faf8d678d9b3.qll39v72xd8wlnk.rcgu.o" "/home/mauldinl@gvl.is.l-3com.com/code/rust/tclogin/target/debug/deps/tclogin-5db8faf8d678d9b3.zrt47p47dyd33mp.rcgu.o" "-o" "/home/mauldinl@gvl.is.l-3com.com/code/rust/tclogin/target/debug/deps/tclogin-5db8faf8d678d9b3" "/home/mauldinl@gvl.is.l-3com.com/code/rust/tclogin/target/debug/deps/tclogin-5db8faf8d678d9b3.1ujalx1pjlrvq1dm.rcgu.o" "-Wl,--gc-sections" "-pie" "-Wl,-zrelro" "-Wl,-znow" "-nodefaultlibs" "-L" "/home/mauldinl@gvl.is.l-3com.com/code/rust/tclogin/target/debug/deps" "-L" "/apps/tc9/lib" "-L" "/apps/tc9/lib/oracle" "-L" "/usr/lib/x86_64-linux-gnu" "-L" "/home/mauldinl@gvl.is.l-3com.com/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib" "-lgdis" "-leintstub" "-lnxmgr_im" "-linternal_exits" "-lae" "-laie" "-lappr" "-larchive" "-lvis" "-lvm" "-lbackup" "-lbmf" "-lbob" "-lbom" "-lcae" "-lcfm" "-lconfig" "-lcxpom" "-ldmi" "-lmgc" "-lecm" "-leint" "-lepm" "-lfclasses" "-lform" "-lgrm" "-ltcinit" "-ltc" "-lsml" "-ltccore" "-ltctrushape" "-lqsearch" "-litk" "-lbase_utils" "-lics" "-llov" "-lme" "-lmld" "-lobjio" "-love" "-lproperty" "-lps" "-lpublication" "-lpie" "-lai" "-lqry" "-lres" "-lreq" "-ladsfoundation" "-ltcsoacorestrong" "-lsa" "-lschmgt" "-lschmgt_bridge" "-lss" "-lvispublish" "-lsub_mgr" "-lclientcache" "-ltextsrv" "-lrdv" "-lTcCrypto" "-ltcsso" "-lcollabctx" "-lmechatronics" "-ldocmgtapp" "-lcontmgmt" "-lserver_exits" "-linternal_server_exits" "-ltcgsoap" "-laiwebservice" "-ltcxsd" "-lconfigurator" "-ltcsoacommon" "-ltcsoaclient" "-ltcgateway" "-ltcsoaserver" "-ltcserverutil" "-lvalidation" "-lcp" "-ltcmultisitetypes" "-ltcmultisitestrong" "-ltcsoaworkflow" "-ltcsoaworkflowtypes" "-ltcsoaworkflownative" "-ltc_utils" "-ltccoreext" "-lrbf" "-lce" "-lclips" "-lclipsutil" "-lgms" "-ltie" "-lbriefcase" "-lvisualization" "-lnxclone" "-lvendormanagementdispatch" "-lccdm" "-lproductvariant" "-lfunctionality" "-licsie" "-lcondvalidation" "-lsmartuibldr" "-lfnd0soadiagramming" "-lfnd0soadiagrammingtypes" "-ltcsoacoretypes" "-ltcsoacore" "-ltcsoaprojectmanagement" "-ltcsoaprojectmanagementtypes" "-ltcsoaprojectmanagementnative" "-lbmidebase" "-lpdi_corba_server" "-lict" "-lcba" "-lsharedcache" "-lsharedcachetypes" "-lbooleanmath" "-lcbaext" "-lcfilter" "-lfnd0booleansolve" "-ldispatcher" "-lmeta" "-lmetaframework" "-lsecore" "-lfoundationdispatch" "-lcmdispatch" "-lcm" "-lFnd0nweditor" "-lusagewc" "-lusage" "-lconstants" "-lmfg" "-lmfgbvr" "-lssrsccuaclient" "-lscmccdispatch" "-lextensionframework" "-ldocmgt" "-lissuemgmt" "-lFnd0profiler" "-lFnd0formulamgmt" "-lpom" "-lsyss" "-lugmath" "-lplmxmlSDK" "-lplmxmlExtensions" "-lplmContainerSDK" "-licui18n341" "-lxerces270" "-lxalan110" "-lc" "-lm" "-ldl" "-lnsl" "-lelf" "-lresolv" "-lclntsh" "-ldb2" "-licuuc341" "-licudata341" "-lTcCryptoUtil" "-lpoco" "-lTAO" "-lACE" "-lFnd0propertyrenderer" "-lnnz10" "-ltccurl" "-lTcMemBinding64" "-lTcMemCppBinding64" "-Wl,--start-group" "-Wl,-Bstatic" "/home/mauldinl@gvl.is.l-3com.com/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libstd-de5969744423fb69.rlib" "/home/mauldinl@gvl.is.l-3com.com/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libpanic_unwind-349473e71495321d.rlib" "/home/mauldinl@gvl.is.l-3com.com/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libbacktrace_sys-586a1c8092fef75c.rlib" "/home/mauldinl@gvl.is.l-3com.com/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libunwind-132eea50c4719d58.rlib" "/home/mauldinl@gvl.is.l-3com.com/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/librustc_demangle-ceaa2d4e2e4490ea.rlib" "/home/mauldinl@gvl.is.l-3com.com/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/liblibc-b0584d127f427a22.rlib" "/home/mauldinl@gvl.is.l-3com.com/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/liballoc-8570ae25713836c4.rlib" "/home/mauldinl@gvl.is.l-3com.com/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/librustc_std_workspace_core-4ea1c8a0d2fa277d.rlib" "/home/mauldinl@gvl.is.l-3com.com/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libcore-c04ea2c3b5f80e64.rlib" "-Wl,--end-group" "/home/mauldinl@gvl.is.l-3com.com/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libcompiler_builtins-a3371a772297084a.rlib" "-Wl,-Bdynamic" "-ldl" "-lrt" "-lpthread" "-lgcc_s" "-lc" "-lm" "-lrt" "-lpthread" "-lutil" "-lutil" "-Wl,--unresolved-symbols=ignore-all" "-Wl,--no-as-needed" "-Wl,-rpath-link=/apps/tc9/lib"
#14

What’s the lib in that list that uses symbols from libconfig? The one you were calling “foo” before. Does that lib’s ldd output show a dependency on libconfig?

Also, why do you tell the linker to ignore unresolved symbols?

Alas, it’s a bit difficult to debug this over a forum post :frowning:. I’d try comparing the Go and C++ linker args vs the Rust one, and see what’s different - perhaps something will stand out.

#15

I took the steps you recommended and discovered that I think the issue is in the system linker. On red hat system (gcc-4.5 and ld 2.27), the resulting compiled binary has all of the libraries listed in the link command in the final executable. I have a Ubuntu 18.04 system, (gcc-4.5 and ld 2.30) and I run the exact same link command but it does not have all of the libraries in the final executable (as shown by ldd). At this point I know it isn’t a rust issue because I am getting this behavior when compiling and linking a C program. I have tried some google searches to figure it out but haven’t hit on the right search terms. Do you have any recommendation on how to proceed or where I could ask for help?
This is the command:

/usr/bin/gcc -m64 -L/apps/tc9/lib -L/apps/tc9/lib/oracle -L/usr/lib -L/usr/lib64 -L/usr/lib /apps/tc9/lib/itk_main.o main.o -L/apps/tc9/lib -luser_exits -lgdis -leintstub -lnxmgr_im -linternal_exits -lae -laie -lappr -larchive -lvis -lvm -lbackup -lbmf -lbob -lbom -lcae -lcfm -lconfig -lcxpom -ldmi -lmgc -lecm -leint -lepm -lfclasses -lform -lgrm -ltcinit -ltc -lsml -ltccore -ltctrushape -lqsearch -litk -lbase_utils -lics -llov -lme -lmld -lobjio -love -lproperty -lps -lpublication -lpie -lai -lqry -lres -lreq -ladsfoundation -ltcsoacorestrong -lsa -lschmgt -lschmgt_bridge -lss -lvispublish -lsub_mgr -lclientcache -ltextsrv -lrdv -lTcCrypto -ltcsso -lcollabctx -lmechatronics -ldocmgtapp -lcontmgmt -lserver_exits -linternal_server_exits -ltcgsoap -laiwebservice -ltcxsd -lconfigurator -ltcsoacommon -ltcsoaclient -ltcgateway -ltcsoaserver -ltcserverutil -lvalidation -lcp -ltcmultisitetypes -ltcmultisitestrong -ltcsoaworkflow -ltcsoaworkflowtypes -ltcsoaworkflownative -ltc_utils -ltccoreext -lrbf -lce -lclips -lclipsutil -lgms -ltie -lbriefcase -lvisualization -lnxclone -lvendormanagementdispatch -lccdm -lproductvariant -lfunctionality -licsie -lcondvalidation -lsmartuibldr -lfnd0soadiagramming -lfnd0soadiagrammingtypes -ltcsoacoretypes -ltcsoacore -ltcsoaprojectmanagement -ltcsoaprojectmanagementtypes -ltcsoaprojectmanagementnative -lbmidebase -lpdi_corba_server -lict -lcba -lsharedcache -lsharedcachetypes -lbooleanmath -lcbaext -lcfilter -lfnd0booleansolve -ldispatcher -lmeta -lmetaframework -lsecore -lfoundationdispatch -lcmdispatch -lcm -lFnd0nweditor -lusagewc -lusage -lconstants -lmfg -lmfgbvr -lssrsccuaclient -lscmccdispatch -lextensionframework -ldocmgt -lissuemgmt -lfunctionality -lcondvalidation -lFnd0profiler -lFnd0formulamgmt -larm -lpom -lsyss -lugmath -lplmxmlSDK -lplmxmlExtensions -lplmContainerSDK -licui18n341 -lxerces270 -lxalan110 -lc -lm -ldl -lnsl -lelf -lresolv -lclntsh -ldb2 -lstdc++ -Wl,--unresolved-symbols=ignore-in-shared-libs -o main
#16

I think I am finally making some progress. I discovered the Ubuntu defaults the flag --as-needed to be sent to the linker. The way to work-around that in the C build is to put --no-as-needed after specifying the .o files but before the libraries. Adding -Wl,--no-as-needed at the end of the linking command did not work. It appears that order matters for this specific flag. I have added the -Wl,--no-as-needed flag into my RUSTFLAGS but as you can see from the command line below, by default rust puts it at the end of the linking command. How can I get the rust build process to put it at the front of the command?

Rust command which does not correctly link shared libraries:

"cc" "-Wl,--as-needed" "-Wl,-z,noexecstack" "-m64" "-L" "/home/mauldinl@gvl.is.l-3com.com/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib" "/home/mauldinl@gvl.is.l-3com.com/code/rust/tclogin/target/debug/deps/tclogin-1d2993c5e8dcf6e2.10imwdy594ztd6bq.rcgu.o" "/home/mauldinl@gvl.is.l-3com.com/code/rust/tclogin/target/debug/deps/tclogin-1d2993c5e8dcf6e2.16d1j1qvoz2m2jvs.rcgu.o" "/home/mauldinl@gvl.is.l-3com.com/code/rust/tclogin/target/debug/deps/tclogin-1d2993c5e8dcf6e2.1fyaisel7xwy8gol.rcgu.o" "/home/mauldinl@gvl.is.l-3com.com/code/rust/tclogin/target/debug/deps/tclogin-1d2993c5e8dcf6e2.1m1fmcgm6riw3k8x.rcgu.o" "/home/mauldinl@gvl.is.l-3com.com/code/rust/tclogin/target/debug/deps/tclogin-1d2993c5e8dcf6e2.1ofvdi3023mvvvco.rcgu.o" "/home/mauldinl@gvl.is.l-3com.com/code/rust/tclogin/target/debug/deps/tclogin-1d2993c5e8dcf6e2.1sxelb0w7h73vp0e.rcgu.o" "/home/mauldinl@gvl.is.l-3com.com/code/rust/tclogin/target/debug/deps/tclogin-1d2993c5e8dcf6e2.26gzaqs5j4288ipr.rcgu.o" "/home/mauldinl@gvl.is.l-3com.com/code/rust/tclogin/target/debug/deps/tclogin-1d2993c5e8dcf6e2.2b1t8ich07w2gvrl.rcgu.o" "/home/mauldinl@gvl.is.l-3com.com/code/rust/tclogin/target/debug/deps/tclogin-1d2993c5e8dcf6e2.2roea1mze8w2afh0.rcgu.o" "/home/mauldinl@gvl.is.l-3com.com/code/rust/tclogin/target/debug/deps/tclogin-1d2993c5e8dcf6e2.3j13xg5n5tgud8iy.rcgu.o" "/home/mauldinl@gvl.is.l-3com.com/code/rust/tclogin/target/debug/deps/tclogin-1d2993c5e8dcf6e2.3sx17r8001u8o3w5.rcgu.o" "/home/mauldinl@gvl.is.l-3com.com/code/rust/tclogin/target/debug/deps/tclogin-1d2993c5e8dcf6e2.4113mge63r7rocsc.rcgu.o" "/home/mauldinl@gvl.is.l-3com.com/code/rust/tclogin/target/debug/deps/tclogin-1d2993c5e8dcf6e2.419w4t766q8u6dci.rcgu.o" "/home/mauldinl@gvl.is.l-3com.com/code/rust/tclogin/target/debug/deps/tclogin-1d2993c5e8dcf6e2.45cnk29n205b6w8p.rcgu.o" "/home/mauldinl@gvl.is.l-3com.com/code/rust/tclogin/target/debug/deps/tclogin-1d2993c5e8dcf6e2.49ob1frj11j54voq.rcgu.o" "/home/mauldinl@gvl.is.l-3com.com/code/rust/tclogin/target/debug/deps/tclogin-1d2993c5e8dcf6e2.4lo6dh84os25q8en.rcgu.o" "/home/mauldinl@gvl.is.l-3com.com/code/rust/tclogin/target/debug/deps/tclogin-1d2993c5e8dcf6e2.4td2c64b2g0tc0pa.rcgu.o" "/home/mauldinl@gvl.is.l-3com.com/code/rust/tclogin/target/debug/deps/tclogin-1d2993c5e8dcf6e2.4ulw9y80xwlyly7h.rcgu.o" "/home/mauldinl@gvl.is.l-3com.com/code/rust/tclogin/target/debug/deps/tclogin-1d2993c5e8dcf6e2.4zvsimlxb9npcpqm.rcgu.o" "/home/mauldinl@gvl.is.l-3com.com/code/rust/tclogin/target/debug/deps/tclogin-1d2993c5e8dcf6e2.9ud5haptujyqskc.rcgu.o" "/home/mauldinl@gvl.is.l-3com.com/code/rust/tclogin/target/debug/deps/tclogin-1d2993c5e8dcf6e2.agcn0tji9vk7e22.rcgu.o" "-o" "/home/mauldinl@gvl.is.l-3com.com/code/rust/tclogin/target/debug/deps/tclogin-1d2993c5e8dcf6e2" "/home/mauldinl@gvl.is.l-3com.com/code/rust/tclogin/target/debug/deps/tclogin-1d2993c5e8dcf6e2.4kzuzfmqupnpce59.rcgu.o" "-Wl,--gc-sections" "-pie" "-Wl,-zrelro" "-Wl,-znow" "-nodefaultlibs" "-L" "/home/mauldinl@gvl.is.l-3com.com/code/rust/tclogin/target/debug/deps" "-L" "/apps/tc9/lib" "-L" "/apps/tc9/lib/oracle" "-L" "/usr/lib/x86_64-linux-gnu" "-L" "/home/mauldinl@gvl.is.l-3com.com/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib" "-lgdis" "-leintstub" "-lnxmgr_im" "-linternal_exits" "-lae" "-laie" "-lappr" "-larchive" "-lvis" "-lvm" "-lbackup" "-lbmf" "-lbob" "-lbom" "-lcae" "-lcfm" "-lconfig" "-lcxpom" "-ldmi" "-lmgc" "-lecm" "-leint" "-lepm" "-lfclasses" "-lform" "-lgrm" "-ltcinit" "-ltc" "-lsml" "-ltccore" "-ltctrushape" "-lqsearch" "-litk" "-lbase_utils" "-lics" "-llov" "-lme" "-lmld" "-lobjio" "-love" "-lproperty" "-lps" "-lpublication" "-lpie" "-lai" "-lqry" "-lres" "-lreq" "-ladsfoundation" "-ltcsoacorestrong" "-lsa" "-lschmgt" "-lschmgt_bridge" "-lss" "-lvispublish" "-lsub_mgr" "-lclientcache" "-ltextsrv" "-lrdv" "-lTcCrypto" "-ltcsso" "-lcollabctx" "-lmechatronics" "-ldocmgtapp" "-lcontmgmt" "-lserver_exits" "-linternal_server_exits" "-ltcgsoap" "-laiwebservice" "-ltcxsd" "-lconfigurator" "-ltcsoacommon" "-ltcsoaclient" "-ltcgateway" "-ltcsoaserver" "-ltcserverutil" "-lvalidation" "-lcp" "-ltcmultisitetypes" "-ltcmultisitestrong" "-ltcsoaworkflow" "-ltcsoaworkflowtypes" "-ltcsoaworkflownative" "-ltc_utils" "-ltccoreext" "-lrbf" "-lce" "-lclips" "-lclipsutil" "-lgms" "-ltie" "-lbriefcase" "-lvisualization" "-lnxclone" "-lvendormanagementdispatch" "-lccdm" "-lproductvariant" "-lfunctionality" "-licsie" "-lcondvalidation" "-lsmartuibldr" "-lfnd0soadiagramming" "-lfnd0soadiagrammingtypes" "-ltcsoacoretypes" "-ltcsoacore" "-ltcsoaprojectmanagement" "-ltcsoaprojectmanagementtypes" "-ltcsoaprojectmanagementnative" "-lbmidebase" "-lpdi_corba_server" "-lict" "-lcba" "-lsharedcache" "-lsharedcachetypes" "-lbooleanmath" "-lcbaext" "-lcfilter" "-lfnd0booleansolve" "-ldispatcher" "-lmeta" "-lmetaframework" "-lsecore" "-lfoundationdispatch" "-lcmdispatch" "-lcm" "-lFnd0nweditor" "-lusagewc" "-lusage" "-lconstants" "-lmfg" "-lmfgbvr" "-lssrsccuaclient" "-lscmccdispatch" "-lextensionframework" "-ldocmgt" "-lissuemgmt" "-lFnd0profiler" "-lFnd0formulamgmt" "-lpom" "-lsyss" "-lugmath" "-lplmxmlSDK" "-lplmxmlExtensions" "-lplmContainerSDK" "-licui18n341" "-lxerces270" "-lxalan110" "-lc" "-lm" "-ldl" "-lnsl" "-lelf" "-lresolv" "-lclntsh" "-ldb2" "-licuuc341" "-licudata341" "-lTcCryptoUtil" "-lpoco" "-lTAO" "-lACE" "-lFnd0propertyrenderer" "-lnnz10" "-ltccurl" "-lTcMemBinding64" "-lTcMemCppBinding64" "-lstdc++" "-Wl,--start-group" "-Wl,-Bstatic" "/home/mauldinl@gvl.is.l-3com.com/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libstd-de5969744423fb69.rlib" "/home/mauldinl@gvl.is.l-3com.com/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libpanic_unwind-349473e71495321d.rlib" "/home/mauldinl@gvl.is.l-3com.com/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libbacktrace_sys-586a1c8092fef75c.rlib" "/home/mauldinl@gvl.is.l-3com.com/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libunwind-132eea50c4719d58.rlib" "/home/mauldinl@gvl.is.l-3com.com/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/librustc_demangle-ceaa2d4e2e4490ea.rlib" "/home/mauldinl@gvl.is.l-3com.com/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/liblibc-b0584d127f427a22.rlib" "/home/mauldinl@gvl.is.l-3com.com/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/liballoc-8570ae25713836c4.rlib" "/home/mauldinl@gvl.is.l-3com.com/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/librustc_std_workspace_core-4ea1c8a0d2fa277d.rlib" "/home/mauldinl@gvl.is.l-3com.com/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libcore-c04ea2c3b5f80e64.rlib" "-Wl,--end-group" "/home/mauldinl@gvl.is.l-3com.com/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libcompiler_builtins-a3371a772297084a.rlib" "-Wl,-Bdynamic" "-ldl" "-lrt" "-lpthread" "-lgcc_s" "-lc" "-lm" "-lrt" "-lpthread" "-lutil" "-lutil" "-Wl,--unresolved-symbols=ignore-all" "-Wl,--no-as-needed"

For reference the direct gcc linking command that works (notice the position of the --no-as-needed)

/usr/bin/gcc -m64 -L/apps/tc9/lib -L/apps/tc9/lib/oracle -L/usr/lib -L/usr/lib64 -L/usr/lib /apps/tc9/lib/itk_main.o main.o -Wl,--no-as-needed -L/apps/tc9/lib -luser_exits -lgdis -leintstub -lnxmgr_im -linternal_exits -lae -laie -lappr -larchive -lvis -lvm -lbackup -lbmf -lbob -lbom -lcae -lcfm -lconfig -lcxpom -ldmi -lmgc -lecm -leint -lepm -lfclasses -lform -lgrm -ltcinit -ltc -lsml -ltccore -ltctrushape -lqsearch -litk -lbase_utils -lics -llov -lme -lmld -lobjio -love -lproperty -lps -lpublication -lpie -lai -lqry -lres -lreq -ladsfoundation -ltcsoacorestrong -lsa -lschmgt -lschmgt_bridge -lss -lvispublish -lsub_mgr -lclientcache -ltextsrv -lrdv -lTcCrypto -ltcsso -lcollabctx -lmechatronics -ldocmgtapp -lcontmgmt -lserver_exits -linternal_server_exits -ltcgsoap -laiwebservice -ltcxsd -lconfigurator -ltcsoacommon -ltcsoaclient -ltcgateway -ltcsoaserver -ltcserverutil -lvalidation -lcp -ltcmultisitetypes -ltcmultisitestrong -ltcsoaworkflow -ltcsoaworkflowtypes -ltcsoaworkflownative -ltc_utils -ltccoreext -lrbf -lce -lclips -lclipsutil -lgms -ltie -lbriefcase -lvisualization -lnxclone -lvendormanagementdispatch -lccdm -lproductvariant -lfunctionality -licsie -lcondvalidation -lsmartuibldr -lfnd0soadiagramming -lfnd0soadiagrammingtypes -ltcsoacoretypes -ltcsoacore -ltcsoaprojectmanagement -ltcsoaprojectmanagementtypes -ltcsoaprojectmanagementnative -lbmidebase -lpdi_corba_server -lict -lcba -lsharedcache -lsharedcachetypes -lbooleanmath -lcbaext -lcfilter -lfnd0booleansolve -ldispatcher -lmeta -lmetaframework -lsecore -lfoundationdispatch -lcmdispatch -lcm -lFnd0nweditor -lusagewc -lusage -lconstants -lmfg -lmfgbvr -lssrsccuaclient -lscmccdispatch -lextensionframework -ldocmgt -lissuemgmt -lfunctionality -lcondvalidation -lFnd0profiler -lFnd0formulamgmt -larm -lpom -lsyss -lugmath -lplmxmlSDK -lplmxmlExtensions -lplmContainerSDK -licui18n341 -lxerces270 -lxalan110 -lc -lm -ldl -lnsl -lelf -lresolv -lclntsh -ldb2 -lstdc++ -Wl,--unresolved-symbols=ignore-in-shared-libs -o main_ubuntu