Skip to content

Using many cxx libraries at the same time #252

Open
@TheZoq2

Description

@TheZoq2

Since I liked the first time I used this crate, I figured I could start RIIRing another part of my project. This part is a standalone library, so I don't want to merge it with my first converted part, but unfortunately that means I run into some linker errors because I now link against the cxx library twice.

  = note: /usr/bin/ld: /home/frans/Documents/phd/cinnabar/mercurous/target/debug/deps/libcxx-3ab177cc3e5e5c69.rlib(cxx-3ab177cc3e5e5c69.cxx.ed64qtld-cgu.13.rcgu.o): in function `cxxbridge03$str$valid':
          /home/frans/.cargo/registry/src/github.tiyicn.workers.dev-1ecc6299db9ec823/cxx-0.3.4/src/symbols/rust_str.rs:5: multiple definition of `cxxbridge03$str$valid'; ../affine-arith/build/libaffine_arith_rust.a(cxx-34c4476bdb46593d.cxx.c3ul3jrz-cgu.13.rcgu.o):cxx.c3ul3jrz-cgu.13:(.text.cxxbridge03$str$valid+0x0): first defined here
          /usr/bin/ld: /home/frans/Documents/phd/cinnabar/mercurous/target/debug/deps/libcxx-3ab177cc3e5e5c69.rlib(cxx-3ab177cc3e5e5c69.cxx.ed64qtld-cgu.5.rcgu.o): in function `cxxbridge03$exception':
          /home/frans/.cargo/registry/src/github.tiyicn.workers.dev-1ecc6299db9ec823/cxx-0.3.4/src/symbols/exception.rs:4: multiple definition of `cxxbridge03$exception'; ../affine-arith/build/libaffine_arith_rust.a(cxx-34c4476bdb46593d.cxx.c3ul3jrz-cgu.10.rcgu.o):cxx.c3ul3jrz-cgu.10:(.text.cxxbridge03$exception+0x0): first defined here
          /usr/bin/ld: /home/frans/Documents/phd/cinnabar/mercurous/target/debug/deps/libcxx-3ab177cc3e5e5c69.rlib(cxx-3ab177cc3e5e5c69.cxx.ed64qtld-cgu.8.rcgu.o): in function `cxxbridge03$string$clone':
          /home/frans/.cargo/registry/src/github.tiyicn.workers.dev-1ecc6299db9ec823/cxx-0.3.4/src/symbols/rust_string.rs:12: multiple definition of `cxxbridge03$string$clone'; ../affine-arith/build/libaffine_arith_rust.a(cxx-34c4476bdb46593d.cxx.c3ul3jrz-cgu.7.rcgu.o):cxx.c3ul3jrz-cgu.7:(.text.cxxbridge03$string$clone+0x0): first defined here
          /usr/bin/ld: /home/frans/Documents/phd/cinnabar/mercurous/target/debug/deps/libcxx-3ab177cc3e5e5c69.rlib(cxx-3ab177cc3e5e5c69.cxx.ed64qtld-cgu.8.rcgu.o): in function `cxxbridge03$string$drop':
          /home/frans/.cargo/registry/src/github.tiyicn.workers.dev-1ecc6299db9ec823/cxx-0.3.4/src/symbols/rust_string.rs:33: multiple definition of `cxxbridge03$string$drop'; ../affine-arith/build/libaffine_arith_rust.a(cxx-34c4476bdb46593d.cxx.c3ul3jrz-cgu.7.rcgu.o):cxx.c3ul3jrz-cgu.7:(.text.cxxbridge03$string$drop+0x0): first defined here
          /usr/bin/ld: /home/frans/Documents/phd/cinnabar/mercurous/target/debug/deps/libcxx-3ab177cc3e5e5c69.rlib(cxx-3ab177cc3e5e5c69.cxx.ed64qtld-cgu.8.rcgu.o): in function `cxxbridge03$string$from':
          /home/frans/.cargo/registry/src/github.tiyicn.workers.dev-1ecc6299db9ec823/cxx-0.3.4/src/symbols/rust_string.rs:17: multiple definition of `cxxbridge03$string$from'; ../affine-arith/build/libaffine_arith_rust.a(cxx-34c4476bdb46593d.cxx.c3ul3jrz-cgu.7.rcgu.o):cxx.c3ul3jrz-cgu.7:(.text.cxxbridge03$string$from+0x0): first defined here
          /usr/bin/ld: /home/frans/Documents/phd/cinnabar/mercurous/target/debug/deps/libcxx-3ab177cc3e5e5c69.rlib(cxx-3ab177cc3e5e5c69.cxx.ed64qtld-cgu.8.rcgu.o): in function `cxxbridge03$string$len':
          /home/frans/.cargo/registry/src/github.tiyicn.workers.dev-1ecc6299db9ec823/cxx-0.3.4/src/symbols/rust_string.rs:43: multiple definition of `cxxbridge03$string$len'; ../affine-arith/build/libaffine_arith_rust.a(cxx-34c4476bdb46593d.cxx.c3ul3jrz-cgu.7.rcgu.o):cxx.c3ul3jrz-cgu.7:(.text.cxxbridge03$string$len+0x0): first defined here
          /usr/bin/ld: /home/frans/Documents/phd/cinnabar/mercurous/target/debug/deps/libcxx-3ab177cc3e5e5c69.rlib(cxx-3ab177cc3e5e5c69.cxx.ed64qtld-cgu.8.rcgu.o): in function `cxxbridge03$string$new':
          /home/frans/.cargo/registry/src/github.tiyicn.workers.dev-1ecc6299db9ec823/cxx-0.3.4/src/symbols/rust_string.rs:7: multiple definition of `cxxbridge03$string$new'; ../affine-arith/build/libaffine_arith_rust.a(cxx-34c4476bdb46593d.cxx.c3ul3jrz-cgu.7.rcgu.o):cxx.c3ul3jrz-cgu.7:(.text.cxxbridge03$string$new+0x0): first defined here
          /usr/bin/ld: /home/frans/Documents/phd/cinnabar/mercurous/target/debug/deps/libcxx-3ab177cc3e5e5c69.rlib(cxx-3ab177cc3e5e5c69.cxx.ed64qtld-cgu.8.rcgu.o): in function `cxxbridge03$string$ptr':
          /home/frans/.cargo/registry/src/github.tiyicn.workers.dev-1ecc6299db9ec823/cxx-0.3.4/src/symbols/rust_string.rs:38: multiple definition of `cxxbridge03$string$ptr'; ../affine-arith/build/libaffine_arith_rust.a(cxx-34c4476bdb46593d.cxx.c3ul3jrz-cgu.7.rcgu.o):cxx.c3ul3jrz-cgu.7:(.text.cxxbridge03$string$ptr+0x0): first defined here
          collect2: error: ld returned 1 exit status

Is there a way to work around this, something like optionally not building against the cxx cpp file?

Metadata

Metadata

Assignees

No one assigned

    Labels

    integrationHow cxx fits into the big picture of an organization's codebase and buildslinkingIssues that manifest as link failures

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions