Compiling libyaml on Windows

So, I was developing an amazing Linux project, and I need to make a port on Windows. The problem is that libyaml is part of my dependencies, and I need to compile it for Windows.

So, I got my cygwin environment, I ran. / configure did, and everything went well: the library was built, I received the .a file.

Except that the make file never ended because it could not collect examples: it turns out that some symbols are missing in the library:

undefined reference to `_imp__yaml_parser_initialize' undefined reference to `_imp__yaml_parser_set_input_file' undefined reference to `_imp__yaml_parser_scan' undefined reference to `_imp__yaml_token_delete' undefined reference to `_imp__yaml_parser_delete' 

So, of course, wondering how this could be true, I continued to search for the specified characters, and I essentially found them in binary format, although this character is slightly different, as you can see:

 $ nm src/.libs/libyaml.a | grep parser_set_input_file 000005a8 T _yaml_parser_set_input_file 

So, this is usually how the function name is displayed when compiling a dynamically loaded library. What is buzzing me, WHY can't the linker find these functions? Where does this impulse come from?

And what can I do so that my programs can properly communicate with libyaml? Everything else works as it should, with the exception of these features.

Will you save me from this diabolical compilation material? I thank you for your attention.

EDIT: I'm already working on this issue for a few more hours. So apparently this MAY come from mingw: gcc from cygwin has no problem compiling the examples. However, errors remain even if I try to do this with cygwin gcc. I'm starting to get tired of this backward OS. Every time I develop Windows, I spend more time solving problems than it actually works. Why should it always be such a pain?

Is there an EASY way to explain the linker not to look for the distorted name of these functions?

EDIT: I found this: http://cygwin.com/ml/cygwin/2001-04/msg00942.html It seems someone had a similar problem with ncurses. Although I could not do anything from this.

+4
source share
1 answer

Old thread, but the answer is still not clear. The following versions are for version 0.1.5:

 ./configure CFLAGS="-DYAML_DECLARE_STATIC" --enable-static --disable-shared 
+2
source

Source: https://habr.com/ru/post/1393868/


All Articles