Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build Script Refinements/Static Linking #16

Open
wants to merge 6 commits into
base: master
Choose a base branch
from

Conversation

murl-digital
Copy link

This simplifies the build script a bit and adds a static linking feature flag for those who may want it

@revmischa
Copy link
Contributor

Thanks for this, I added automatic static linking for windows and emscripten platforms in #13. Now there's some conflicts in the build script though, sorry. Want me to try to resolve them?

@@ -1,2 +1,5 @@
[target.wasm32-unknown-emscripten]
linker = ".cargo/linker-emscripten"

[target.x86_64-unknown-linux-gnu]
rustflags = "-C link-arg=-lGL -C link-arg=-lstdc++ -C link-arg=-lgomp"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

are these needed?
should we really overwrite linker args just for linux/x86?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've found that these are necessary otherwise the linker complains. I think rustc only links libc, not libc++, and gomp which I guess is a projectm dependency of some sort.

@murl-digital
Copy link
Author

Thanks for this, I added automatic static linking for windows and emscripten platforms in #13. Now there's some conflicts in the build script though, sorry. Want me to try to resolve them?

Sorry for the belated response, I just now got a chance to check my github notifications. Sure, go ahead if you haven't already

@revmischa
Copy link
Contributor

I've tried to merge your static build option with the latest, want to try it out? I hope that rustflags bit isn't necessary. It builds okay for me on macOS.

@murl-digital
Copy link
Author

static linking doesn't work for me, ld vomits out a whole bunch of errors about extern functions not being found, here's a snippet:

          /home/draconium/.cargo/registry/src/index.crates.io-6f17d22bba15001f/projectm-sys-1.1.0-alpha.1/libprojectM/vendor/hlslparser/src/Engine.h:173:(.text._ZN2M45ArrayIPKcE11SetCapacityEi[_ZN2M45ArrayIPKcE11SetCapacityEi]+0x90): undefined reference to `__cxa_allocate_exception'
          /usr/bin/ld: /home/draconium/.cargo/registry/src/index.crates.io-6f17d22bba15001f/projectm-sys-1.1.0-alpha.1/libprojectM/vendor/hlslparser/src/Engine.h:173:(.text._ZN2M45ArrayIPKcE11SetCapacityEi[_ZN2M45ArrayIPKcE11SetCapacityEi]+0xa2): undefined reference to `std::bad_alloc::~bad_alloc()'
          /usr/bin/ld: /home/draconium/.cargo/registry/src/index.crates.io-6f17d22bba15001f/projectm-sys-1.1.0-alpha.1/libprojectM/vendor/hlslparser/src/Engine.h:173:(.text._ZN2M45ArrayIPKcE11SetCapacityEi[_ZN2M45ArrayIPKcE11SetCapacityEi]+0xac): undefined reference to `typeinfo for std::bad_alloc'
          /usr/bin/ld: /home/draconium/.cargo/registry/src/index.crates.io-6f17d22bba15001f/projectm-sys-1.1.0-alpha.1/libprojectM/vendor/hlslparser/src/Engine.h:173:(.text._ZN2M45ArrayIPKcE11SetCapacityEi[_ZN2M45ArrayIPKcE11SetCapacityEi]+0xb7): undefined reference to `__cxa_throw'
          collect2: error: ld returned 1 exit status

= note: some `extern` functions couldn't be found; some native libraries may need to be installed or have their path specified
  = note: use the `-l` flag to specify native libraries to link
  = note: use the `cargo:rustc-link-lib` directive to specify the native libraries to link with Cargo (see https://doc.rust-lang.org/cargo/reference/build-scripts.html#rustc-link-lib)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants