static-linking

How to prevent already defined objects error when linking two statically built libs that use the same header file?

感情迁移 提交于 2021-01-29 05:39:35
问题 I have several libraries that I want to statically link together. Let's call them Lib1 , Lib2 , Lib3 and Lib4 . Lib4 uses Lib1 and Lib3 ( Lib1 internally uses Lib2 ). I can easily create the DLLs and all work just fine. the issue however is, when I try to build them as static libs I get the already defined objects error which are given bellow. I get these errors when I include Utility.h header file which contains some utility functions that can be used in several libs. For now I am forced to

Xcode 9: Linking a static framework against another static framework

生来就可爱ヽ(ⅴ<●) 提交于 2021-01-27 07:59:56
问题 In the spirit of Xcode 9's "revolutionary" feature, namely compiling static frameworks, we are trying to make our subprojects build as static frameworks, so they can be linked statically against the main application target. One of our sub-projects has a static framework dependency itself (Firebase). When we build the sub-project as a dynamic framework, everything works fine, but once we switch it to mach-o staticlib, suddenly, it loses the Firebase library symbols. Here is the output of nm

Xcode 9: Linking a static framework against another static framework

[亡魂溺海] 提交于 2021-01-27 07:59:12
问题 In the spirit of Xcode 9's "revolutionary" feature, namely compiling static frameworks, we are trying to make our subprojects build as static frameworks, so they can be linked statically against the main application target. One of our sub-projects has a static framework dependency itself (Firebase). When we build the sub-project as a dynamic framework, everything works fine, but once we switch it to mach-o staticlib, suddenly, it loses the Firebase library symbols. Here is the output of nm

Xcode 9: Linking a static framework against another static framework

℡╲_俬逩灬. 提交于 2021-01-27 07:59:01
问题 In the spirit of Xcode 9's "revolutionary" feature, namely compiling static frameworks, we are trying to make our subprojects build as static frameworks, so they can be linked statically against the main application target. One of our sub-projects has a static framework dependency itself (Firebase). When we build the sub-project as a dynamic framework, everything works fine, but once we switch it to mach-o staticlib, suddenly, it loses the Firebase library symbols. Here is the output of nm

Xcode 9: Linking a static framework against another static framework

 ̄綄美尐妖づ 提交于 2021-01-27 07:57:11
问题 In the spirit of Xcode 9's "revolutionary" feature, namely compiling static frameworks, we are trying to make our subprojects build as static frameworks, so they can be linked statically against the main application target. One of our sub-projects has a static framework dependency itself (Firebase). When we build the sub-project as a dynamic framework, everything works fine, but once we switch it to mach-o staticlib, suddenly, it loses the Firebase library symbols. Here is the output of nm

How to compile a static musl binary of a Rust project with native dependencies?

我是研究僧i 提交于 2021-01-21 07:43:28
问题 I have a project with dependencies on Hyper and Diesel, and because of that, on native libraries OpenSSL and libpq. The project builds on nightly Rust because it uses compiler plugins. My current attempt is to build on a Docker container. I have the MUSL libc and the libraries make 'd and installed with prefix /usr/local/musl . I run cargo with the following command: (Not sure if some of the options are redundant, I'm not too well-versed with the compiler chain, and not even sure if they end

Access static variable from CPP file to other header file

匆匆过客 提交于 2021-01-16 04:21:04
问题 I'm trying to access the static variable in other header file from a CPP file. " Boo.hpp " #ifndef Boo_hpp #define Boo_hpp static int num; class Boo { public: Boo() { num = 35; } }; #endif /* Boo_hpp */ " Foo.hpp " #ifndef Foo_hpp #define Foo_hpp class Foo { public: Foo(); }; #endif /* Foo_hpp */ " Foo.cpp " #include "Foo.hpp" #include "Boo.hpp" #include <iostream> Foo::Foo() { std::cout << "Num : " << num << '\n'; } " main.cpp " #include <iostream> #include "Foo.hpp" #include "Boo.hpp" int

Access static variable from CPP file to other header file

淺唱寂寞╮ 提交于 2021-01-16 04:18:56
问题 I'm trying to access the static variable in other header file from a CPP file. " Boo.hpp " #ifndef Boo_hpp #define Boo_hpp static int num; class Boo { public: Boo() { num = 35; } }; #endif /* Boo_hpp */ " Foo.hpp " #ifndef Foo_hpp #define Foo_hpp class Foo { public: Foo(); }; #endif /* Foo_hpp */ " Foo.cpp " #include "Foo.hpp" #include "Boo.hpp" #include <iostream> Foo::Foo() { std::cout << "Num : " << num << '\n'; } " main.cpp " #include <iostream> #include "Foo.hpp" #include "Boo.hpp" int

Access static variable from CPP file to other header file

↘锁芯ラ 提交于 2021-01-16 04:17:27
问题 I'm trying to access the static variable in other header file from a CPP file. " Boo.hpp " #ifndef Boo_hpp #define Boo_hpp static int num; class Boo { public: Boo() { num = 35; } }; #endif /* Boo_hpp */ " Foo.hpp " #ifndef Foo_hpp #define Foo_hpp class Foo { public: Foo(); }; #endif /* Foo_hpp */ " Foo.cpp " #include "Foo.hpp" #include "Boo.hpp" #include <iostream> Foo::Foo() { std::cout << "Num : " << num << '\n'; } " main.cpp " #include <iostream> #include "Foo.hpp" #include "Boo.hpp" int

Building libcurl with static linking to openssl

依然范特西╮ 提交于 2021-01-01 07:32:21
问题 I am trying to build libcurl with static linking to openssl. So to achieve that, I have used following configuration: OpenSSL: LDFLAGS="-static” LIBS="-ldl” cURL: LDFLAGS="-static” CPPFLAGS="-I$(CURDIR)/$(3RDPARTY_DIR)$(OPENSSL)/include LDFLAGS="-L$(CURDIR)/$(3RDPARTY_DIR)$(OPENSSL)" ./configure --disable-shared --without-zlib --without-libidn --without-librtmp --disable-ldap —-with-ssl=<path where my openssl is installed> With this, I am to generate libcurl.a and link it to my code where I