Linking to statically compiled z3 needs additional libraries on LinuxWhen to use dynamic vs. static librariesWhat do 'statically linked' and 'dynamically linked' mean?Do I need static libraries to statically link?Static linking vs dynamic linkingLinux static linking is dead?How can I statically link a C++ library to a C application in OSX?lib OSMesa off-screen context creation fails in C++, but only when statically linkedStatic link libraries in Qt application with CMakeHow to figure out where linking to static library of Boost's thread component is postulated when building Field3D?Compiling and linking static library with gfortran
Resolving moral conflict
Wrong result by FindRoot
What benefits does the Power Word Kill spell have?
Leaving a job that I just took based on false promise of a raise. What do I tell future interviewers?
My 15 year old son is gay. How do I express my feelings about this?
Why is the missed-approach course for the "RNAV (GNSS) - A" approach to runway 28 at ENSB shaped all funny?
What happens if nobody can form a government in Israel?
What is this utensil for?
Does the Orange League not count as an official Pokemon League, making the Alolan League his first-ever win?
How use custom order in folder on Windows 7 and 10
Idiom for "I came, I saw, I ate" (or drank)
What is the lowest voltage that a microcontroller can successfully read on the analog pin?
Social leper versus social leopard
How is the problem, ⟨G⟩ in Logspace?
How to deal with my team leader who keeps calling me about project updates even though I am on leave for personal reasons?
If an object moving in a circle experiences centripetal force, then doesn't it also experience centrifugal force, because of Newton's third law?
reverse a list of generic type
Can this word order be rearranged?
How do I improve in sight reading?
The quicker I go up, the sooner I’ll go down - Riddle
Hilbert's hotel, why can't I repeat it infinitely many times?
Why is there not a feasible solution for a MIP?
What do you do if you have developments on your paper during the long peer review process?
Is there any reason nowadays to use a neon indicator lamp instead of an LED?
Linking to statically compiled z3 needs additional libraries on Linux
When to use dynamic vs. static librariesWhat do 'statically linked' and 'dynamically linked' mean?Do I need static libraries to statically link?Static linking vs dynamic linkingLinux static linking is dead?How can I statically link a C++ library to a C application in OSX?lib OSMesa off-screen context creation fails in C++, but only when statically linkedStatic link libraries in Qt application with CMakeHow to figure out where linking to static library of Boost's thread component is postulated when building Field3D?Compiling and linking static library with gfortran
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;
I used CMake to compile a static version of (a fairly recent of) z3 using:
cmake -DBUILD_LIBZ3_SHARED=false -DCMAKE_INSTALL_PREFIX=/opt/z3-devel -G "Unix Makefiles" ../
Now when I statically link the library against a C++ program, say this small variation of a z3 example:
#include"z3++.h"
using namespace z3;
int main(int argc, char** argv)
config conf;
context c(conf);
expr x = c.int_const("x");
expr y = c.int_const("y");
expr z = c.int_const("z");
goal g(c);
g.add( ((2*x)+y)+z == 4);
g.add( (x+(2*y))+z == 4);
g.add( x+y == 4);
std::cout << g << "n";
tactic t(c, "fm");
apply_result r = t(g);
std::cout << r << "n";
return 0;
via
g++ -c -I /opt/z3-devel/include -static -o main.o main.cc
g++ -static -L /opt/z3-devel/lib64 -o main main.o -lz3
I receive a long list of undefined reference linking errors. What solves the issue is to add -lgomp -pthread -lrt -ldl
as additional libraries. The linker outputs the following warning:
/usr/bin/ld: /usr/lib/gcc/x86_64-redhat-linux/8/libgomp.a(target.o): in function `gomp_target_init':
(.text+0x32c): warning: Using 'dlopen' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking
Nevertheless, the program runs fine on my own machine and on Starexec.
Is this combination of static and dynamic linking the best I can do? Shouldn't those libraries be already statically linked into libz3.a? I have static versions of gomp, pthread and rt available on the system.
z3 static-linking
add a comment
|
I used CMake to compile a static version of (a fairly recent of) z3 using:
cmake -DBUILD_LIBZ3_SHARED=false -DCMAKE_INSTALL_PREFIX=/opt/z3-devel -G "Unix Makefiles" ../
Now when I statically link the library against a C++ program, say this small variation of a z3 example:
#include"z3++.h"
using namespace z3;
int main(int argc, char** argv)
config conf;
context c(conf);
expr x = c.int_const("x");
expr y = c.int_const("y");
expr z = c.int_const("z");
goal g(c);
g.add( ((2*x)+y)+z == 4);
g.add( (x+(2*y))+z == 4);
g.add( x+y == 4);
std::cout << g << "n";
tactic t(c, "fm");
apply_result r = t(g);
std::cout << r << "n";
return 0;
via
g++ -c -I /opt/z3-devel/include -static -o main.o main.cc
g++ -static -L /opt/z3-devel/lib64 -o main main.o -lz3
I receive a long list of undefined reference linking errors. What solves the issue is to add -lgomp -pthread -lrt -ldl
as additional libraries. The linker outputs the following warning:
/usr/bin/ld: /usr/lib/gcc/x86_64-redhat-linux/8/libgomp.a(target.o): in function `gomp_target_init':
(.text+0x32c): warning: Using 'dlopen' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking
Nevertheless, the program runs fine on my own machine and on Starexec.
Is this combination of static and dynamic linking the best I can do? Shouldn't those libraries be already statically linked into libz3.a? I have static versions of gomp, pthread and rt available on the system.
z3 static-linking
One immediate thought: I remember that at least on Windows, OpenMP is not available in static form, so the build scripts may be set up to use the dynamic libraries regardless of the target. Going by the warning message from the linker, it looks to be similar on your platform though.
– Christoph Wintersteiger
Mar 28 at 17:45
That's well possible - if I understand the cmake flag correctly, this just expresses a preference of static libraries over dynamic ones.It might make sense to raise an issue at the github repository then -- I just want to make sure that this is not a specific problem that only occurs for me.
– lambda.xy.x
Mar 28 at 17:56
add a comment
|
I used CMake to compile a static version of (a fairly recent of) z3 using:
cmake -DBUILD_LIBZ3_SHARED=false -DCMAKE_INSTALL_PREFIX=/opt/z3-devel -G "Unix Makefiles" ../
Now when I statically link the library against a C++ program, say this small variation of a z3 example:
#include"z3++.h"
using namespace z3;
int main(int argc, char** argv)
config conf;
context c(conf);
expr x = c.int_const("x");
expr y = c.int_const("y");
expr z = c.int_const("z");
goal g(c);
g.add( ((2*x)+y)+z == 4);
g.add( (x+(2*y))+z == 4);
g.add( x+y == 4);
std::cout << g << "n";
tactic t(c, "fm");
apply_result r = t(g);
std::cout << r << "n";
return 0;
via
g++ -c -I /opt/z3-devel/include -static -o main.o main.cc
g++ -static -L /opt/z3-devel/lib64 -o main main.o -lz3
I receive a long list of undefined reference linking errors. What solves the issue is to add -lgomp -pthread -lrt -ldl
as additional libraries. The linker outputs the following warning:
/usr/bin/ld: /usr/lib/gcc/x86_64-redhat-linux/8/libgomp.a(target.o): in function `gomp_target_init':
(.text+0x32c): warning: Using 'dlopen' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking
Nevertheless, the program runs fine on my own machine and on Starexec.
Is this combination of static and dynamic linking the best I can do? Shouldn't those libraries be already statically linked into libz3.a? I have static versions of gomp, pthread and rt available on the system.
z3 static-linking
I used CMake to compile a static version of (a fairly recent of) z3 using:
cmake -DBUILD_LIBZ3_SHARED=false -DCMAKE_INSTALL_PREFIX=/opt/z3-devel -G "Unix Makefiles" ../
Now when I statically link the library against a C++ program, say this small variation of a z3 example:
#include"z3++.h"
using namespace z3;
int main(int argc, char** argv)
config conf;
context c(conf);
expr x = c.int_const("x");
expr y = c.int_const("y");
expr z = c.int_const("z");
goal g(c);
g.add( ((2*x)+y)+z == 4);
g.add( (x+(2*y))+z == 4);
g.add( x+y == 4);
std::cout << g << "n";
tactic t(c, "fm");
apply_result r = t(g);
std::cout << r << "n";
return 0;
via
g++ -c -I /opt/z3-devel/include -static -o main.o main.cc
g++ -static -L /opt/z3-devel/lib64 -o main main.o -lz3
I receive a long list of undefined reference linking errors. What solves the issue is to add -lgomp -pthread -lrt -ldl
as additional libraries. The linker outputs the following warning:
/usr/bin/ld: /usr/lib/gcc/x86_64-redhat-linux/8/libgomp.a(target.o): in function `gomp_target_init':
(.text+0x32c): warning: Using 'dlopen' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking
Nevertheless, the program runs fine on my own machine and on Starexec.
Is this combination of static and dynamic linking the best I can do? Shouldn't those libraries be already statically linked into libz3.a? I have static versions of gomp, pthread and rt available on the system.
z3 static-linking
z3 static-linking
edited Mar 28 at 16:06
lambda.xy.x
asked Mar 28 at 15:58
lambda.xy.xlambda.xy.x
3,47416 silver badges28 bronze badges
3,47416 silver badges28 bronze badges
One immediate thought: I remember that at least on Windows, OpenMP is not available in static form, so the build scripts may be set up to use the dynamic libraries regardless of the target. Going by the warning message from the linker, it looks to be similar on your platform though.
– Christoph Wintersteiger
Mar 28 at 17:45
That's well possible - if I understand the cmake flag correctly, this just expresses a preference of static libraries over dynamic ones.It might make sense to raise an issue at the github repository then -- I just want to make sure that this is not a specific problem that only occurs for me.
– lambda.xy.x
Mar 28 at 17:56
add a comment
|
One immediate thought: I remember that at least on Windows, OpenMP is not available in static form, so the build scripts may be set up to use the dynamic libraries regardless of the target. Going by the warning message from the linker, it looks to be similar on your platform though.
– Christoph Wintersteiger
Mar 28 at 17:45
That's well possible - if I understand the cmake flag correctly, this just expresses a preference of static libraries over dynamic ones.It might make sense to raise an issue at the github repository then -- I just want to make sure that this is not a specific problem that only occurs for me.
– lambda.xy.x
Mar 28 at 17:56
One immediate thought: I remember that at least on Windows, OpenMP is not available in static form, so the build scripts may be set up to use the dynamic libraries regardless of the target. Going by the warning message from the linker, it looks to be similar on your platform though.
– Christoph Wintersteiger
Mar 28 at 17:45
One immediate thought: I remember that at least on Windows, OpenMP is not available in static form, so the build scripts may be set up to use the dynamic libraries regardless of the target. Going by the warning message from the linker, it looks to be similar on your platform though.
– Christoph Wintersteiger
Mar 28 at 17:45
That's well possible - if I understand the cmake flag correctly, this just expresses a preference of static libraries over dynamic ones.It might make sense to raise an issue at the github repository then -- I just want to make sure that this is not a specific problem that only occurs for me.
– lambda.xy.x
Mar 28 at 17:56
That's well possible - if I understand the cmake flag correctly, this just expresses a preference of static libraries over dynamic ones.It might make sense to raise an issue at the github repository then -- I just want to make sure that this is not a specific problem that only occurs for me.
– lambda.xy.x
Mar 28 at 17:56
add a comment
|
0
active
oldest
votes
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/4.0/"u003ecc by-sa 4.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55402008%2flinking-to-statically-compiled-z3-needs-additional-libraries-on-linux%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
0
active
oldest
votes
0
active
oldest
votes
active
oldest
votes
active
oldest
votes
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55402008%2flinking-to-statically-compiled-z3-needs-additional-libraries-on-linux%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
One immediate thought: I remember that at least on Windows, OpenMP is not available in static form, so the build scripts may be set up to use the dynamic libraries regardless of the target. Going by the warning message from the linker, it looks to be similar on your platform though.
– Christoph Wintersteiger
Mar 28 at 17:45
That's well possible - if I understand the cmake flag correctly, this just expresses a preference of static libraries over dynamic ones.It might make sense to raise an issue at the github repository then -- I just want to make sure that this is not a specific problem that only occurs for me.
– lambda.xy.x
Mar 28 at 17:56