Open oxoocoffee opened 7 years ago
you need to
YAML_CPP_API
macro with
__declspec(package)
for classesextern
for functions, operators etcYAML_CPP_API
from struct
definitions or redeclare the struct
as a class
I'm planning to rewrite YAML_CPP_API
as YAML_CPP_EXPORT
for classes and YAML_CPP_EXTERN
for functions etc. The new macros would use the appropriate key word depending on whether you're building as a DLL or as a static lib.
Could do a pull request when done, if there's a need for that.
Thinking about adding this first. Which top H file is good place to do so? dll.h?
// Microsoft
#define YAML_CPP_EXPORT __declspec(dllexport)
#define YAML_CPP_IMPORT __declspec(dllimport)
// GCC
#define YAML_CPP_EXPORT __attribute__((visibility("default")))
#define YAML_CPP_IMPORT
#define YAML_CPP_EXPORT
#define YAML_CPP_IMPORT
#pragma warning Unknown dynamic link import/export semantics.
yes, dll.h
oxoocoffee's solution is the correct direction, now that GCC (and clang/llvm) have gone to hidden symbols by default.
Hello,
I just cloned latest main and did try to cross-compile to aarm64. I used main since I do not have boost. Thank you guys for dropping boost :) Yaml-cpp built was fine and it produced static lib. After installing to to my sys root I did try to compile my application. My application did build just fine before I added yaml support.Whe I am trying to link my application with yaml static libI get this error
aarch64-gnu-linux/../../libexec/aarch64-gnu-linux/gcc/aarch64-gnu-linux/4.9.2/ld: /opt/cross-arm/sysroot/usr/local/lib/libyaml-cpp.a(convert.cpp.o)(.text+0xcc): unresolvable R_AARCH64_ADR_PREL_PG_HI21 relocation against symbol `_ZNSs4_Rep20_S_empty_rep_storageE@@GLIBCXX_3.4'
../libexec/aarch64-gnu-linux/gcc/aarch64-gnu-linux/4.9.2/ld: final link failed: Nonrepresentable section on output
Compiler version used to cross compile: aarch64-gnu-linux-g++ --version aarch64-gnu-linux-g++ (GCC) 4.9.2
My project by default build and links to dynamic libs. I did try to add -Bstatic libyaml-cpp.a -Bdynamic to my make but did not work. After rebuilding yaml-cpp -DBUILD_SHARED_LIBS=ON everything worked fine.
https://reverseengineering.stackexchange.com/questions/10722/what-is-s-empty-rep-storage-used-for-in-this-code