Skip to content

Static link #3

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

Open
Peter2121 opened this issue Oct 13, 2019 · 2 comments
Open

Static link #3

Peter2121 opened this issue Oct 13, 2019 · 2 comments

Comments

@Peter2121
Copy link

Hi,
By default FLTK library is linked dynamically. How can I create a statically linked image of my nim program?
Thanks

@Skrylar
Copy link
Owner

Skrylar commented Oct 15, 2019

Depending on the environment, change the name of the library the module links to and possibly add some C defines so the FLTK headers know you are doing a static build.

{.passL: "-lfltk".}

@Peter2121
Copy link
Author

I am on Mac OS X.
I tried to replace Line 2 in fltk.nim with:
{.passL: "/usr/local/Cellar/fltk/1.3.5/lib/libfltk.a -lpthread -framework Cocoa".}
(It is the options returned by fltk-config --ldstaticflags command)
No luck, the linker says:

duplicate symbol _FL_NORMAL_SIZE in:
    /Users/peter/.cache/nim/testpeter_d/@mprivate@senumerations.nim.cpp.o
    /usr/local/Cellar/fltk/1.3.5/lib/libfltk.a(Fl_Widget.o)
ld: 1 duplicate symbol for architecture x86_64

Sure, the symbol is defined in both files.
I tried to add --dynlibOverrideAll to build command, but it changes nothing.

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

2 participants