Skip to content
New issue

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

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

Already on GitHub? # to your account

statically linked X10 program #24

Open
yohm opened this issue Jan 4, 2018 · 2 comments
Open

statically linked X10 program #24

yohm opened this issue Jan 4, 2018 · 2 comments

Comments

@yohm
Copy link

yohm commented Jan 4, 2018

I'd like compile an X10 program statically linked to x10 runtime libraries in order to distribute it as a stand-alone executable file. As far as I understand, libx10, libx10rt_sockets, libgc are dynamically linked by default but I'd like to link them statically.

I found that the static libraries are created when we build x10 with an environment variable X10_STATIC_LIB as follows.

export X10_STATIC_LIB=1
cd x10/x10.dist
ant -Davailable.procs=8 -Doptimize=true -DNO_CHECKS=true dist

Even though I found .a files are created under x10.dist/*/lib directories, x10c++ tries to use "libgc.so" file, which causes a run-time error like

./hello.out: error while loading shared libraries: libgc.so.1: cannot open shared object file: No such file or directory

I found a tentative workaround of deleting libgc.so to force a static link, but this must not be a canonical way. Please tell me how to link it statically.

@dgrove-oss
Copy link
Member

Hi, sorry for the slow response.

I think we need to add a test for X10_STATIC_LIB being set in x10.runtime/build.xml in the various stanzas of the build-bdwgc rule that don't already pass: <arg value="--disable-shared" /> to the configure command so that if X10_STATIC_LIB is set, then bdwgc is configured to not build libgc.so. If both libgc.a and libgc.so are available, the C++ compiler will prefer to link to the .so version. So we need to prevent libgc.so from being built.

Does this make sense?

@yohm
Copy link
Author

yohm commented Jan 10, 2018

Thank you for your reply. It makes sense.
Do you have a plan to add an option to suppress building libgc.so?

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

No branches or pull requests

2 participants