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 fails on Cray: attempted static link of dynamic object #41

Open
daboehme opened this issue Jul 3, 2017 · 7 comments
Open

Build fails on Cray: attempted static link of dynamic object #41

daboehme opened this issue Jul 3, 2017 · 7 comments

Comments

@daboehme
Copy link
Member

daboehme commented Jul 3, 2017

Build fails on platforms that prefer static linking, here Cray:

Linking C executable autotee_test
cd /global/homes/b/boehme3/src/GOTCHA/build-cori/src/example/autotee && /usr/bin/cmake -E cmake_link_script CMakeFiles/autotee_test.dir/link.txt --verbose=1
/opt/cray/pe/craype/2.5.7/bin/cc      CMakeFiles/autotee_test.dir/test_autotee.c.o  -o autotee_test -rdynamic libautotee.so ../../libgotcha.so.0.0.1 -Wl,-rpath,/global/homes/b/boehme3/src/GOTCHA/build-cori/src/example/autotee:/global/homes/b/boehme3/src/GOTCHA/build-cori/src 
/usr/bin/ld: attempted static link of dynamic object 'libautotee.so'
src/example/autotee/CMakeFiles/autotee_test.dir/build.make:90: recipe for target 'src/example/autotee/autotee_test' failed
make[2]: *** [src/example/autotee/autotee_test] Error 1
@DavidPoliakoff
Copy link
Contributor

Since it's you, I wanted to try something

Could you set the environment variables

export XTPE_LINK_TYPE=dynamic
export CRAYPE_LINK_TYPE=dynamic

Before building? If that works, I'll push a fix in GOTCHA.

@daboehme
Copy link
Member Author

daboehme commented Jul 3, 2017 via email

@DavidPoliakoff
Copy link
Contributor

I'll need to test it. For now I'm centered around getting GOTCHA not to shoot itself in the foot this way, I think I can make it just build me shared. I don't know what happens if GOTCHA is built shared and you're built static yet. Obviously you can't redirect functions from libcaliper(.a), but you should be able to redirect from libpthread to a function inside yourself, but I need to make very sure of that. You're an endless font of test cases, thanks, this should make the software stronger.

@mplegendre
Copy link
Member

Off the top of my head, I don't see why we shouldn't be able to make gotcha a static library (though it should still be compiled -fPIC) so that it can be linked directly into another tool library. But to be clear, it absolutely will not work with a statically-linked binary. Gotcha works by modifying the dynamic-linker data structures that are only present in dynamically-linked binaries.

The day may come where gotcha has some support for static binaries, but it will be a completely different implementation.

@DavidPoliakoff
Copy link
Contributor

@daboehme , how would you recommend replicating this issue? Is there a Cray machine you'd like to see this work on? A Caliper build line?

@daboehme
Copy link
Member Author

daboehme commented Sep 5, 2017

Essentially it shouldn't fail using a default config / build on Cray. I tried it on Cori.

@DavidPoliakoff
Copy link
Contributor

Cool, I'll see if I can get Cori access and go from there. Appreciate it!

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

No branches or pull requests

3 participants