Author Topic: Using libxlsxwriter : how to use -lz  (Read 6166 times)

Offline bonelli

  • Single posting newcomer
  • *
  • Posts: 9
Using libxlsxwriter : how to use -lz
« on: July 22, 2020, 07:51:09 pm »
Hello,

I'm trying to use the libxlsxwriter lib to write basic excel files.

- I successfully compiled it
- The example are compiling and working using gcc or g++ from the msys command line:

gcc myexcel.c -o myexcel -I /path/to/libxlsxwriter/include \
                           /path/to/libxlsxwriter/lib/libxlsxwriter.a -lz

It is mandatory to specify -lz.

How to do that from codeblocks?
I have already specified the include/lib path.

=> Without -lz option I have numerous errors: undefined reference to __getreent...
=> With -lz option I have: error: cannot find -lz

According to this link https://libxlsxwriter.github.io/getting_started.html#gsg_minizip
Quote
The source files for minizip are included in the src tree of libxlsxwriter and are statically linked by default.

Beyond this point I'm not sure to understand what is statically linked or not. If minizip  is statically linked at compile-time of libxlsxwriter, why should take care of "-lz" at compile time of a source code using libxlsxwriter?

I really don't konw what to do. Any help appreciated  :)


--Below is a optional religious debate--
Why does software-people ALWAYS provides sources codes to recompile each time and VERY RARELY precompiled binaries? The instruction set of x86-64 computers is standardized. Even if they where open sources, no ones want to recompile notepad++, google earth, chrome, 7z... I'm from the hardware world, hopefully, I don't have to recompile solidworks, eagle, ADS, Altium to use them  :o I'm using USB connected hardware tools: the manufacturers provides .h/.lib/.dll files. Nothing to recompile, not my job, and what a lost of time (considering millions of people are basically compiling the same sources for a couple of OS). Don't understand how it could be better to recompile libxlsxwriter and the zipper instead of using precompiled binaries. This is necessary for a particular CPU-architecture, but most of people are using standard OS on a well-known standard architecture.

Offline Miguel Gimenez

  • Developer
  • Lives here!
  • *****
  • Posts: 1553
Re: Using libxlsxwriter : how to use -lz
« Reply #1 on: July 22, 2020, 10:36:33 pm »
You must add this to Linker settings -> Link libraries

Code
/path/to/libxlsxwriter/lib/libxlsxwriter.a
/path/to/zlib/libz.a

libz.a can be in the minizip folder or you can have it beforehand (from zlib, for example).

Offline bonelli

  • Single posting newcomer
  • *
  • Posts: 9
Re: Using libxlsxwriter : how to use -lz
« Reply #2 on: August 03, 2020, 12:37:52 pm »
You must add this to Linker settings -> Link libraries

Code
/path/to/libxlsxwriter/lib/libxlsxwriter.a
/path/to/zlib/libz.a

libz.a can be in the minizip folder or you can have it beforehand (from zlib, for example).

Hi Miguel and thanks for your response... But this didn't solve the problem, I still have the same errors.

Offline Miguel Gimenez

  • Developer
  • Lives here!
  • *****
  • Posts: 1553
Re: Using libxlsxwriter : how to use -lz
« Reply #3 on: August 03, 2020, 12:54:38 pm »
I didn't know libxlsxwriter when I read your message, but then I wrote a small test project before answering, and it was so easy to integrate that I added xlsx capability to my biggest project.

I have attached the CBP and the main.c file, it assumes you have defined a global variable named xlsxwriter pointing to the folder containing the library source (base = G:\Librerias81\xlsxwriter-0.9.5 in my system) and another global variable zlib (in my system it contains G:\Librerias81\zlib-1.2.11 in base, include and lib).

If you can't compile this small project then attach a full rebuild log:

http://wiki.codeblocks.org/index.php?title=FAQ-Compiling_%28general%29#Q:_How_do_I_report_a_compilation_problem_on_the_forums.3F
« Last Edit: August 03, 2020, 01:15:50 pm by Miguel Gimenez »

Offline bonelli

  • Single posting newcomer
  • *
  • Posts: 9
Re: Using libxlsxwriter : how to use -lz
« Reply #4 on: August 03, 2020, 01:44:52 pm »
compiler=gcc (mingw32)
OS=win10/x64
code::blocks 17.12


Code
<html>
<head>
<title>Excel build log</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /></head>
<body>
<tt>
Build started on: <u>03-08-2020 at 13:40.53</u><br />
Build ended on: <u>03-08-2020 at 13:40.53</u><p />
<b>-------------- Build: Release in Excel (compiler: GNU GCC Compiler)---------------</b><br />
mingw32-g++.exe  -o bin\Excel.exe obj\main.o  -s  D:\libxlsxwriter\libxlsxwriter\lib\libxlsxwriter.a D:\libxlsxwriter\libxlsxwriter\zlib-1.2.11\libz.a<br />
D:\libxlsxwriter\libxlsxwriter\lib\libxlsxwriter.a(workbook.o): In function "store_defined_name':<br />
<font color="#ff0000">/d/libxlsxwriter/libxlsxwriter/src/workbook.c:591: undefined reference to "__getreent'</font><br />
D:\libxlsxwriter\libxlsxwriter\lib\libxlsxwriter.a(workbook.o): In function "populate_range_data_cache':<br />
<font color="#ff0000">/d/libxlsxwriter/libxlsxwriter/src/workbook.c:744: undefined reference to "__getreent'</font><br />
D:\libxlsxwriter\libxlsxwriter\lib\libxlsxwriter.a(workbook.o): In function "populate_range_dimensions':<br />
<font color="#ff0000">/d/libxlsxwriter/libxlsxwriter/src/workbook.c:852: undefined reference to "__getreent'</font><br />
D:\libxlsxwriter\libxlsxwriter\lib\libxlsxwriter.a(workbook.o): In function "prepare_workbook':<br />
<font color="#ff0000">/d/libxlsxwriter/libxlsxwriter/src/workbook.c:370: undefined reference to "__getreent'</font><br />
<font color="#ff0000">/d/libxlsxwriter/libxlsxwriter/src/workbook.c:379: undefined reference to "__getreent'</font><br />
<font color="#ff0000">D:\libxlsxwriter\libxlsxwriter\lib\libxlsxwriter.a(workbook.o):/d/libxlsxwriter/libxlsxwriter/src/workbook.c:376: more undefined references to "__getreent' follow</font><br />
D:\libxlsxwriter\libxlsxwriter\lib\libxlsxwriter.a(workbook.o): In function "workbook_close':<br />
<font color="#ff0000">/d/libxlsxwriter/libxlsxwriter/src/workbook.c:1936: undefined reference to "__errno'</font><br />
<font color="#ff0000">/d/libxlsxwriter/libxlsxwriter/src/workbook.c:1933: undefined reference to "__getreent'</font><br />
<font color="#ff0000">/d/libxlsxwriter/libxlsxwriter/src/workbook.c:1928: undefined reference to "__errno'</font><br />
<font color="#ff0000">/d/libxlsxwriter/libxlsxwriter/src/workbook.c:1926: undefined reference to "__getreent'</font><br />
<font color="#ff0000">/d/libxlsxwriter/libxlsxwriter/src/workbook.c:1943: undefined reference to "__errno'</font><br />
<font color="#ff0000">/d/libxlsxwriter/libxlsxwriter/src/workbook.c:1941: undefined reference to "__getreent'</font><br />
<font color="#ff0000">/d/libxlsxwriter/libxlsxwriter/src/workbook.c:1948: undefined reference to "__getreent'</font><br />
<font color="#ff0000">/d/libxlsxwriter/libxlsxwriter/src/workbook.c:1953: undefined reference to "__getreent'</font><br />
<font color="#ff0000">/d/libxlsxwriter/libxlsxwriter/src/workbook.c:1914: undefined reference to "__errno'</font><br />
<font color="#ff0000">/d/libxlsxwriter/libxlsxwriter/src/workbook.c:1912: undefined reference to "__getreent'</font><br />
<font color="#ff0000">/d/libxlsxwriter/libxlsxwriter/src/workbook.c:1921: undefined reference to "__errno'</font><br />
<font color="#ff0000">/d/libxlsxwriter/libxlsxwriter/src/workbook.c:1919: undefined reference to "__getreent'</font><br />
<font color="#ff0000">/d/libxlsxwriter/libxlsxwriter/src/workbook.c:1898: undefined reference to "__errno'</font><br />
<font color="#ff0000">/d/libxlsxwriter/libxlsxwriter/src/workbook.c:1896: undefined reference to "__getreent'</font><br />
D:\libxlsxwriter\libxlsxwriter\lib\libxlsxwriter.a(workbook.o): In function "workbook_add_chartsheet':<br />
<font color="#ff0000">/d/libxlsxwriter/libxlsxwriter/src/workbook.c:1733: undefined reference to "__getreent'</font><br />
<font color="#ff0000">/d/libxlsxwriter/libxlsxwriter/src/workbook.c:1754: undefined reference to "__getreent'</font><br />
<font color="#ff0000">/d/libxlsxwriter/libxlsxwriter/src/workbook.c:1762: undefined reference to "__getreent'</font><br />
<font color="#ff0000">/d/libxlsxwriter/libxlsxwriter/src/workbook.c:1741: undefined reference to "__getreent'</font><br />
<font color="#ff0000">D:\libxlsxwriter\libxlsxwriter\lib\libxlsxwriter.a(workbook.o):/d/libxlsxwriter/libxlsxwriter/src/workbook.c:1722: more undefined references to "__getreent' follow</font><br />
D:\libxlsxwriter\libxlsxwriter\lib\libxlsxwriter.a(worksheet.o): In function "write_inline_rich_string_cell':<br />
<font color="#ff0000">/d/libxlsxwriter/libxlsxwriter/src/worksheet.c:3192: undefined reference to "__locale_ctype_ptr'</font><br />
D:\libxlsxwriter\libxlsxwriter\lib\libxlsxwriter.a(worksheet.o): In function "write_inline_string_cell':<br />
<font color="#ff0000">/d/libxlsxwriter/libxlsxwriter/src/worksheet.c:3153: undefined reference to "__locale_ctype_ptr'</font><br />
D:\libxlsxwriter\libxlsxwriter\lib\libxlsxwriter.a(worksheet.o): In function "write_inline_rich_string_cell':<br />
<font color="#ff0000">/d/libxlsxwriter/libxlsxwriter/src/worksheet.c:3193: undefined reference to "__locale_ctype_ptr'</font><br />
D:\libxlsxwriter\libxlsxwriter\lib\libxlsxwriter.a(worksheet.o): In function "write_inline_string_cell':<br />
<font color="#ff0000">/d/libxlsxwriter/libxlsxwriter/src/worksheet.c:3154: undefined reference to "__locale_ctype_ptr'</font><br />
D:\libxlsxwriter\libxlsxwriter\lib\libxlsxwriter.a(worksheet.o): In function "new_row':<br />
<font color="#ff0000">/d/libxlsxwriter/libxlsxwriter/src/worksheet.c:561: undefined reference to "__getreent'</font><br />
<font color="#ff0000">/d/libxlsxwriter/libxlsxwriter/src/worksheet.c:564: undefined reference to "__getreent'</font><br />
D:\libxlsxwriter\libxlsxwriter\lib\libxlsxwriter.a(worksheet.o): In function "lxw_worksheet_new':<br />
<font color="#ff0000">/d/libxlsxwriter/libxlsxwriter/src/worksheet.c:105: undefined reference to "__getreent'</font><br />
<font color="#ff0000">/d/libxlsxwriter/libxlsxwriter/src/worksheet.c:164: undefined reference to "__getreent'</font><br />
<font color="#ff0000">/d/libxlsxwriter/libxlsxwriter/src/worksheet.c:176: undefined reference to "__getreent'</font><br />
<font color="#ff0000">D:\libxlsxwriter\libxlsxwriter\lib\libxlsxwriter.a(worksheet.o):/d/libxlsxwriter/libxlsxwriter/src/worksheet.c:147: more undefined references to "__getreent' follow</font><br />
D:\libxlsxwriter\libxlsxwriter\lib\libxlsxwriter.a(xmlwriter.o): In function "lxw_escape_url_characters':<br />
<font color="#ff0000">/d/libxlsxwriter/libxlsxwriter/src/xmlwriter.c:328: undefined reference to "__locale_ctype_ptr'</font><br />
<font color="#ff0000">/d/libxlsxwriter/libxlsxwriter/src/xmlwriter.c:328: undefined reference to "__locale_ctype_ptr'</font><br />
D:\libxlsxwriter\libxlsxwriter\lib\libxlsxwriter.a(utility.o): In function "lxw_name_to_row':<br />
<font color="#ff0000">/d/libxlsxwriter/libxlsxwriter/src/utility.c:247: undefined reference to "__locale_ctype_ptr'</font><br />
D:\libxlsxwriter\libxlsxwriter\lib\libxlsxwriter.a(utility.o): In function "lxw_name_to_col':<br />
<font color="#ff0000">/d/libxlsxwriter/libxlsxwriter/src/utility.c:270: undefined reference to "__locale_ctype_ptr'</font><br />
D:\libxlsxwriter\libxlsxwriter\lib\libxlsxwriter.a(utility.o): In function "lxw_name_to_row':<br />
<font color="#ff0000">/d/libxlsxwriter/libxlsxwriter/src/utility.c:247: undefined reference to "__locale_ctype_ptr'</font><br />
<font color="#ff0000">D:\libxlsxwriter\libxlsxwriter\lib\libxlsxwriter.a(utility.o):/d/libxlsxwriter/libxlsxwriter/src/utility.c:247: more undefined references to "__locale_ctype_ptr' follow</font><br />
D:\libxlsxwriter\libxlsxwriter\lib\libxlsxwriter.a(utility.o): In function "lxw_quote_sheetname':<br />
<font color="#ff0000">/d/libxlsxwriter/libxlsxwriter/src/utility.c:504: undefined reference to "__getreent'</font><br />
D:\libxlsxwriter\libxlsxwriter\lib\libxlsxwriter.a(chartsheet.o): In function "lxw_chartsheet_new':<br />
<font color="#ff0000">/d/libxlsxwriter/libxlsxwriter/src/chartsheet.c:36: undefined reference to "__getreent'</font><br />
<font color="#ff0000">/d/libxlsxwriter/libxlsxwriter/src/chartsheet.c:31: undefined reference to "__getreent'</font><br />
D:\libxlsxwriter\libxlsxwriter\lib\libxlsxwriter.a(chartsheet.o): In function "chartsheet_set_chart_opt':<br />
<font color="#ff0000">/d/libxlsxwriter/libxlsxwriter/src/chartsheet.c:256: undefined reference to "__getreent'</font><br />
<font color="#ff0000">/d/libxlsxwriter/libxlsxwriter/src/chartsheet.c:240: undefined reference to "__getreent'</font><br />
<font color="#ff0000">D:\libxlsxwriter\libxlsxwriter\lib\libxlsxwriter.a(chartsheet.o):/d/libxlsxwriter/libxlsxwriter/src/chartsheet.c:234: more undefined references to "__getreent' follow</font><br />
D:\libxlsxwriter\libxlsxwriter\lib\libxlsxwriter.a(shared_strings.o): In function "write_t':<br />
<font color="#ff0000">/d/libxlsxwriter/libxlsxwriter/src/shared_strings.c:128: undefined reference to "__locale_ctype_ptr'</font><br />
<font color="#ff0000">/d/libxlsxwriter/libxlsxwriter/src/shared_strings.c:129: undefined reference to "__locale_ctype_ptr'</font><br />
D:\libxlsxwriter\libxlsxwriter\lib\libxlsxwriter.a(packager.o): In function "add_file_to_zip':<br />
<font color="#ff0000">/d/libxlsxwriter/libxlsxwriter/src/packager.c:1259: undefined reference to "__getreent'</font><br />
<font color="#ff0000">/d/libxlsxwriter/libxlsxwriter/src/packager.c:1290: undefined reference to "__getreent'</font><br />
<font color="#ff0000">/d/libxlsxwriter/libxlsxwriter/src/packager.c:1281: undefined reference to "__getreent'</font><br />
<font color="#ff0000">/d/libxlsxwriter/libxlsxwriter/src/packager.c:1272: undefined reference to "__getreent'</font><br />
D:\libxlsxwriter\libxlsxwriter\lib\libxlsxwriter.a(packager.o): In function "lxw_packager_new':<br />
<font color="#ff0000">/d/libxlsxwriter/libxlsxwriter/src/packager.c:89: undefined reference to "__getreent'</font><br />
<font color="#ff0000">D:\libxlsxwriter\libxlsxwriter\lib\libxlsxwriter.a(packager.o):/d/libxlsxwriter/libxlsxwriter/src/packager.c:82: more undefined references to "__getreent' follow</font><br />
D:\libxlsxwriter\libxlsxwriter\lib\libxlsxwriter.a(styles.o): In function "lxw_styles_write_string_fragment':<br />
<font color="#ff0000">/d/libxlsxwriter/libxlsxwriter/src/styles.c:83: undefined reference to "__locale_ctype_ptr'</font><br />
<font color="#ff0000">/d/libxlsxwriter/libxlsxwriter/src/styles.c:84: undefined reference to "__locale_ctype_ptr'</font><br />
<font color="#ff0000">D:\libxlsxwriter\libxlsxwriter\lib\libxlsxwriter.a(tmpfileplus.o):tmpfileplus.c:(.text+0x182): undefined reference to "__errno'</font><br />
<font color="#ff0000">D:\libxlsxwriter\libxlsxwriter\lib\libxlsxwriter.a(tmpfileplus.o):tmpfileplus.c:(.text+0x1db): undefined reference to "__errno'</font><br />
<font color="#ff0000">D:\libxlsxwriter\libxlsxwriter\lib\libxlsxwriter.a(tmpfileplus.o):tmpfileplus.c:(.text+0x27c): undefined reference to "__errno'</font><br />
<font color="#ff0000">D:\libxlsxwriter\libxlsxwriter\lib\libxlsxwriter.a(tmpfileplus.o):tmpfileplus.c:(.text+0x3bb): undefined reference to "__errno'</font><br />
<font color="#ff0000">D:\libxlsxwriter\libxlsxwriter\lib\libxlsxwriter.a(tmpfileplus.o):tmpfileplus.c:(.text+0x4ea): undefined reference to "__errno'</font><br />
C:/Program Files (x86)/CodeBlocks/MinGW/bin/../lib/gcc/mingw32/5.1.0/../../../../mingw32/bin/ld.exe: D:\libxlsxwriter\libxlsxwriter\lib\libxlsxwriter.a(tmpfileplus.o): bad reloc address 0x20 in section ".eh_frame'<br />
C:/Program Files (x86)/CodeBlocks/MinGW/bin/../lib/gcc/mingw32/5.1.0/../../../../mingw32/bin/ld.exe: final link failed: Invalid operation<br />
<font color="#ff0000">collect2.exe: error: ld returned 1 exit status</font><br />
<font color="#a00000">Process terminated with status 1 (0 minute(s), 0 second(s))</font><br />
<font color="#a00000">50 error(s), 0 warning(s) (0 minute(s), 0 second(s))</font><br />
</tt>
</body>
</html>

Offline Miguel Gimenez

  • Developer
  • Lives here!
  • *****
  • Posts: 1553
Re: Using libxlsxwriter : how to use -lz
« Reply #5 on: August 03, 2020, 01:53:47 pm »
For me the output is

Code
gcc.exe -Wall -O2 -Wno-deprecated-declarations -Wno-unused-local-typedefs -IG:\Librerias81\xlsxwriter-0.9.5\include -c G:\Documentos\Codeblocks\Excel\main.c -o obj\main.o
gcc.exe  -o bin\Excel.exe obj\main.o  -s  G:\Librerias81\xlsxwriter-0.9.5\lib\libxlsxwriter.a G:\Librerias81\zlib-1.2.11\libz.a
Output file is bin\Excel.exe with size 315.50 KB
Process terminated with status 0 (0 minute(s), 1 second(s))
0 error(s), 0 warning(s) (0 minute(s), 1 second(s))

Did you use the same compiler when creating the libraries and with C::B?. This message

Code
bad reloc address 0x20 in section ".eh_frame"

is shown usually when there is a compiler mismatch.

EDIT: This is not a full rebuild log, just a build one. Why are you linking using mingw32-g++.exe?. main.c should be compiled and linked with gcc.exe, as shown above.
« Last Edit: August 03, 2020, 02:41:07 pm by Miguel Gimenez »

Offline bonelli

  • Single posting newcomer
  • *
  • Posts: 9
Re: Using libxlsxwriter : how to use -lz
« Reply #6 on: August 03, 2020, 04:08:31 pm »
Quote
Did you use the same compiler when creating the libraries and with C::B?. This message
Probably not...
Recompiling zlib and checking for the good version of gcc did solve the problem.
Your example project and my own project are now both compiling and working.
Thank you so much  :)

Offline bonelli

  • Single posting newcomer
  • *
  • Posts: 9
Re: Using libxlsxwriter : how to use -lz
« Reply #7 on: August 04, 2020, 01:59:58 pm »
After integrating other libs to my project, nothing is working. I'm going back to your simple project and nothing is compiling anymore...

I noticed my gcc version was old (4.8.1, 2013). I updated it using "mingw-get install gcc", "mingw-get install g++".
- I am now compiling with gcc 9.2.0.
- The libz.a is compiled using msys with gcc 9.3.0
- I don't know which version of gcc is used to compile libxlsxwriter.a

My project is written in C++ and calls C compiled lib. To make things easier I'm trying to compile your project that is C-only, using gcc and not g++.

After clean/full rebuild I still get:

Code
Build started on: 04-08-2020 at 13:44.14
Build ended on: 04-08-2020 at 13:44.15
-------------- Build: Release in Excel (compiler: GNU GCC Compiler)---------------
gcc.exe -Wall -O2 -ID:\libxlsxwriter\libxlsxwriter\include\ -c D:\temp\xlsx\main.c -o obj\main.o
gcc.exe -o bin\Excel.exe obj\main.o -s D:\libxlsxwriter\libxlsxwriter\lib\libxlsxwriter.a D:\libxlsxwriter\libxlsxwriter\zlib-1.2.11\libz.a
c:/mingw/bin/../lib/gcc/mingw32/9.2.0/../../../../mingw32/bin/ld.exe: D:\libxlsxwriter\libxlsxwriter\lib\libxlsxwriter.a(workbook.o): in function "store_defined_name':
/d/libxlsxwriter/libxlsxwriter/src/workbook.c:591: undefined reference to "__getreent'
c:/mingw/bin/../lib/gcc/mingw32/9.2.0/../../../../mingw32/bin/ld.exe: D:\libxlsxwriter\libxlsxwriter\lib\libxlsxwriter.a(workbook.o): in function "populate_range_data_cache':
/d/libxlsxwriter/libxlsxwriter/src/workbook.c:744: undefined reference to "__getreent'
c:/mingw/bin/../lib/gcc/mingw32/9.2.0/../../../../mingw32/bin/ld.exe: D:\libxlsxwriter\libxlsxwriter\lib\libxlsxwriter.a(workbook.o): in function "populate_range_dimensions':
/d/libxlsxwriter/libxlsxwriter/src/workbook.c:852: undefined reference to "__getreent'
c:/mingw/bin/../lib/gcc/mingw32/9.2.0/../../../../mingw32/bin/ld.exe: D:\libxlsxwriter\libxlsxwriter\lib\libxlsxwriter.a(workbook.o): in function "prepare_fills':
/d/libxlsxwriter/libxlsxwriter/src/workbook.c:370: undefined reference to "__getreent'
c:/mingw/bin/../lib/gcc/mingw32/9.2.0/../../../../mingw32/bin/ld.exe: /d/libxlsxwriter/libxlsxwriter/src/workbook.c:379: undefined reference to "__getreent'
c:/mingw/bin/../lib/gcc/mingw32/9.2.0/../../../../mingw32/bin/ld.exe: D:\libxlsxwriter\libxlsxwriter\lib\libxlsxwriter.a(workbook.o):/d/libxlsxwriter/libxlsxwriter/src/workbook.c:376: more undefined references to "__getreent' follow
c:/mingw/bin/../lib/gcc/mingw32/9.2.0/../../../../mingw32/bin/ld.exe: D:\libxlsxwriter\libxlsxwriter\lib\libxlsxwriter.a(workbook.o): in function "workbook_close':
/d/libxlsxwriter/libxlsxwriter/src/workbook.c:1936: undefined reference to "__errno'
c:/mingw/bin/../lib/gcc/mingw32/9.2.0/../../../../mingw32/bin/ld.exe: /d/libxlsxwriter/libxlsxwriter/src/workbook.c:1933: undefined reference to "__getreent'
c:/mingw/bin/../lib/gcc/mingw32/9.2.0/../../../../mingw32/bin/ld.exe: /d/libxlsxwriter/libxlsxwriter/src/workbook.c:1928: undefined reference to "__errno'
c:/mingw/bin/../lib/gcc/mingw32/9.2.0/../../../../mingw32/bin/ld.exe: /d/libxlsxwriter/libxlsxwriter/src/workbook.c:1926: undefined reference to "__getreent'
c:/mingw/bin/../lib/gcc/mingw32/9.2.0/../../../../mingw32/bin/ld.exe: /d/libxlsxwriter/libxlsxwriter/src/workbook.c:1943: undefined reference to "__errno'
c:/mingw/bin/../lib/gcc/mingw32/9.2.0/../../../../mingw32/bin/ld.exe: /d/libxlsxwriter/libxlsxwriter/src/workbook.c:1941: undefined reference to "__getreent'
c:/mingw/bin/../lib/gcc/mingw32/9.2.0/../../../../mingw32/bin/ld.exe: /d/libxlsxwriter/libxlsxwriter/src/workbook.c:1948: undefined reference to "__getreent'
c:/mingw/bin/../lib/gcc/mingw32/9.2.0/../../../../mingw32/bin/ld.exe: /d/libxlsxwriter/libxlsxwriter/src/workbook.c:1953: undefined reference to "__getreent'
c:/mingw/bin/../lib/gcc/mingw32/9.2.0/../../../../mingw32/bin/ld.exe: /d/libxlsxwriter/libxlsxwriter/src/workbook.c:1914: undefined reference to "__errno'
c:/mingw/bin/../lib/gcc/mingw32/9.2.0/../../../../mingw32/bin/ld.exe: /d/libxlsxwriter/libxlsxwriter/src/workbook.c:1912: undefined reference to "__getreent'
c:/mingw/bin/../lib/gcc/mingw32/9.2.0/../../../../mingw32/bin/ld.exe: /d/libxlsxwriter/libxlsxwriter/src/workbook.c:1921: undefined reference to "__errno'
c:/mingw/bin/../lib/gcc/mingw32/9.2.0/../../../../mingw32/bin/ld.exe: /d/libxlsxwriter/libxlsxwriter/src/workbook.c:1919: undefined reference to "__getreent'
c:/mingw/bin/../lib/gcc/mingw32/9.2.0/../../../../mingw32/bin/ld.exe: /d/libxlsxwriter/libxlsxwriter/src/workbook.c:1898: undefined reference to "__errno'
c:/mingw/bin/../lib/gcc/mingw32/9.2.0/../../../../mingw32/bin/ld.exe: /d/libxlsxwriter/libxlsxwriter/src/workbook.c:1896: undefined reference to "__getreent'
c:/mingw/bin/../lib/gcc/mingw32/9.2.0/../../../../mingw32/bin/ld.exe: D:\libxlsxwriter\libxlsxwriter\lib\libxlsxwriter.a(workbook.o): in function "workbook_add_chartsheet':
/d/libxlsxwriter/libxlsxwriter/src/workbook.c:1733: undefined reference to "__getreent'
c:/mingw/bin/../lib/gcc/mingw32/9.2.0/../../../../mingw32/bin/ld.exe: /d/libxlsxwriter/libxlsxwriter/src/workbook.c:1754: undefined reference to "__getreent'
c:/mingw/bin/../lib/gcc/mingw32/9.2.0/../../../../mingw32/bin/ld.exe: /d/libxlsxwriter/libxlsxwriter/src/workbook.c:1762: undefined reference to "__getreent'
c:/mingw/bin/../lib/gcc/mingw32/9.2.0/../../../../mingw32/bin/ld.exe: /d/libxlsxwriter/libxlsxwriter/src/workbook.c:1741: undefined reference to "__getreent'
c:/mingw/bin/../lib/gcc/mingw32/9.2.0/../../../../mingw32/bin/ld.exe: D:\libxlsxwriter\libxlsxwriter\lib\libxlsxwriter.a(workbook.o):/d/libxlsxwriter/libxlsxwriter/src/workbook.c:1722: more undefined references to "__getreent' follow
c:/mingw/bin/../lib/gcc/mingw32/9.2.0/../../../../mingw32/bin/ld.exe: D:\libxlsxwriter\libxlsxwriter\lib\libxlsxwriter.a(worksheet.o): in function "write_inline_rich_string_cell':
/d/libxlsxwriter/libxlsxwriter/src/worksheet.c:3192: undefined reference to "__locale_ctype_ptr'
c:/mingw/bin/../lib/gcc/mingw32/9.2.0/../../../../mingw32/bin/ld.exe: D:\libxlsxwriter\libxlsxwriter\lib\libxlsxwriter.a(worksheet.o): in function "write_inline_string_cell':
/d/libxlsxwriter/libxlsxwriter/src/worksheet.c:3153: undefined reference to "__locale_ctype_ptr'
c:/mingw/bin/../lib/gcc/mingw32/9.2.0/../../../../mingw32/bin/ld.exe: D:\libxlsxwriter\libxlsxwriter\lib\libxlsxwriter.a(worksheet.o): in function "write_inline_rich_string_cell':
/d/libxlsxwriter/libxlsxwriter/src/worksheet.c:3193: undefined reference to "__locale_ctype_ptr'
c:/mingw/bin/../lib/gcc/mingw32/9.2.0/../../../../mingw32/bin/ld.exe: D:\libxlsxwriter\libxlsxwriter\lib\libxlsxwriter.a(worksheet.o): in function "write_inline_string_cell':
/d/libxlsxwriter/libxlsxwriter/src/worksheet.c:3154: undefined reference to "__locale_ctype_ptr'
c:/mingw/bin/../lib/gcc/mingw32/9.2.0/../../../../mingw32/bin/ld.exe: D:\libxlsxwriter\libxlsxwriter\lib\libxlsxwriter.a(worksheet.o): in function "new_row':
/d/libxlsxwriter/libxlsxwriter/src/worksheet.c:561: undefined reference to "__getreent'
c:/mingw/bin/../lib/gcc/mingw32/9.2.0/../../../../mingw32/bin/ld.exe: /d/libxlsxwriter/libxlsxwriter/src/worksheet.c:564: undefined reference to "__getreent'
c:/mingw/bin/../lib/gcc/mingw32/9.2.0/../../../../mingw32/bin/ld.exe: D:\libxlsxwriter\libxlsxwriter\lib\libxlsxwriter.a(worksheet.o): in function "lxw_worksheet_new':
/d/libxlsxwriter/libxlsxwriter/src/worksheet.c:105: undefined reference to "__getreent'
c:/mingw/bin/../lib/gcc/mingw32/9.2.0/../../../../mingw32/bin/ld.exe: /d/libxlsxwriter/libxlsxwriter/src/worksheet.c:164: undefined reference to "__getreent'
c:/mingw/bin/../lib/gcc/mingw32/9.2.0/../../../../mingw32/bin/ld.exe: /d/libxlsxwriter/libxlsxwriter/src/worksheet.c:176: undefined reference to "__getreent'
c:/mingw/bin/../lib/gcc/mingw32/9.2.0/../../../../mingw32/bin/ld.exe: D:\libxlsxwriter\libxlsxwriter\lib\libxlsxwriter.a(worksheet.o):/d/libxlsxwriter/libxlsxwriter/src/worksheet.c:147: more undefined references to "__getreent' follow
c:/mingw/bin/../lib/gcc/mingw32/9.2.0/../../../../mingw32/bin/ld.exe: D:\libxlsxwriter\libxlsxwriter\lib\libxlsxwriter.a(xmlwriter.o): in function "lxw_escape_url_characters':
/d/libxlsxwriter/libxlsxwriter/src/xmlwriter.c:328: undefined reference to "__locale_ctype_ptr'
c:/mingw/bin/../lib/gcc/mingw32/9.2.0/../../../../mingw32/bin/ld.exe: /d/libxlsxwriter/libxlsxwriter/src/xmlwriter.c:328: undefined reference to "__locale_ctype_ptr'
c:/mingw/bin/../lib/gcc/mingw32/9.2.0/../../../../mingw32/bin/ld.exe: D:\libxlsxwriter\libxlsxwriter\lib\libxlsxwriter.a(chart.o): in function "chart_init_data_cache':
/d/libxlsxwriter/libxlsxwriter/src/chart.c:137: undefined reference to "__getreent'
c:/mingw/bin/../lib/gcc/mingw32/9.2.0/../../../../mingw32/bin/ld.exe: D:\libxlsxwriter\libxlsxwriter\lib\libxlsxwriter.a(chart.o): in function "chart_set_default_marker_type':
/d/libxlsxwriter/libxlsxwriter/src/chart.c:434: undefined reference to "__getreent'
c:/mingw/bin/../lib/gcc/mingw32/9.2.0/../../../../mingw32/bin/ld.exe: D:\libxlsxwriter\libxlsxwriter\lib\libxlsxwriter.a(chart.o): in function "chart_convert_line_args':
/d/libxlsxwriter/libxlsxwriter/src/chart.c:349: undefined reference to "__getreent'
c:/mingw/bin/../lib/gcc/mingw32/9.2.0/../../../../mingw32/bin/ld.exe: D:\libxlsxwriter\libxlsxwriter\lib\libxlsxwriter.a(chart.o): in function "chart_convert_fill_args':
/d/libxlsxwriter/libxlsxwriter/src/chart.c:376: undefined reference to "__getreent'
c:/mingw/bin/../lib/gcc/mingw32/9.2.0/../../../../mingw32/bin/ld.exe: D:\libxlsxwriter\libxlsxwriter\lib\libxlsxwriter.a(chart.o): in function "chart_initialize':
/d/libxlsxwriter/libxlsxwriter/src/chart.c:4925: undefined reference to "__getreent'
c:/mingw/bin/../lib/gcc/mingw32/9.2.0/../../../../mingw32/bin/ld.exe: D:\libxlsxwriter\libxlsxwriter\lib\libxlsxwriter.a(chart.o):/d/libxlsxwriter/libxlsxwriter/src/chart.c:252: more undefined references to "__getreent' follow
c:/mingw/bin/../lib/gcc/mingw32/9.2.0/../../../../mingw32/bin/ld.exe: D:\libxlsxwriter\libxlsxwriter\lib\libxlsxwriter.a(shared_strings.o): in function "write_t':
/d/libxlsxwriter/libxlsxwriter/src/shared_strings.c:128: undefined reference to "__locale_ctype_ptr'
c:/mingw/bin/../lib/gcc/mingw32/9.2.0/../../../../mingw32/bin/ld.exe: /d/libxlsxwriter/libxlsxwriter/src/shared_strings.c:129: undefined reference to "__locale_ctype_ptr'
c:/mingw/bin/../lib/gcc/mingw32/9.2.0/../../../../mingw32/bin/ld.exe: D:\libxlsxwriter\libxlsxwriter\lib\libxlsxwriter.a(styles.o): in function "lxw_styles_new':
/d/libxlsxwriter/libxlsxwriter/src/styles.c:33: undefined reference to "__getreent'
c:/mingw/bin/../lib/gcc/mingw32/9.2.0/../../../../mingw32/bin/ld.exe: /d/libxlsxwriter/libxlsxwriter/src/styles.c:36: undefined reference to "__getreent'
c:/mingw/bin/../lib/gcc/mingw32/9.2.0/../../../../mingw32/bin/ld.exe: D:\libxlsxwriter\libxlsxwriter\lib\libxlsxwriter.a(styles.o): in function "lxw_styles_write_string_fragment':
/d/libxlsxwriter/libxlsxwriter/src/styles.c:83: undefined reference to "__locale_ctype_ptr'
c:/mingw/bin/../lib/gcc/mingw32/9.2.0/../../../../mingw32/bin/ld.exe: /d/libxlsxwriter/libxlsxwriter/src/styles.c:84: undefined reference to "__locale_ctype_ptr'
c:/mingw/bin/../lib/gcc/mingw32/9.2.0/../../../../mingw32/bin/ld.exe: D:\libxlsxwriter\libxlsxwriter\lib\libxlsxwriter.a(theme.o): in function "lxw_theme_new':
/d/libxlsxwriter/libxlsxwriter/src/theme.c:295: undefined reference to "__getreent'
c:/mingw/bin/../lib/gcc/mingw32/9.2.0/../../../../mingw32/bin/ld.exe: D:\libxlsxwriter\libxlsxwriter\lib\libxlsxwriter.a(utility.o): in function "lxw_name_to_row':
/d/libxlsxwriter/libxlsxwriter/src/utility.c:247: undefined reference to "__locale_ctype_ptr'
c:/mingw/bin/../lib/gcc/mingw32/9.2.0/../../../../mingw32/bin/ld.exe: D:\libxlsxwriter\libxlsxwriter\lib\libxlsxwriter.a(utility.o): in function "lxw_name_to_col':
/d/libxlsxwriter/libxlsxwriter/src/utility.c:270: undefined reference to "__locale_ctype_ptr'
c:/mingw/bin/../lib/gcc/mingw32/9.2.0/../../../../mingw32/bin/ld.exe: D:\libxlsxwriter\libxlsxwriter\lib\libxlsxwriter.a(utility.o): in function "lxw_name_to_row':
/d/libxlsxwriter/libxlsxwriter/src/utility.c:247: undefined reference to "__locale_ctype_ptr'
c:/mingw/bin/../lib/gcc/mingw32/9.2.0/../../../../mingw32/bin/ld.exe: /d/libxlsxwriter/libxlsxwriter/src/utility.c:247: undefined reference to "__locale_ctype_ptr'
c:/mingw/bin/../lib/gcc/mingw32/9.2.0/../../../../mingw32/bin/ld.exe: D:\libxlsxwriter\libxlsxwriter\lib\libxlsxwriter.a(utility.o): in function "lxw_name_to_col':
/d/libxlsxwriter/libxlsxwriter/src/utility.c:270: undefined reference to "__locale_ctype_ptr'
c:/mingw/bin/../lib/gcc/mingw32/9.2.0/../../../../mingw32/bin/ld.exe: D:\libxlsxwriter\libxlsxwriter\lib\libxlsxwriter.a(utility.o):/d/libxlsxwriter/libxlsxwriter/src/utility.c:467: more undefined references to "__locale_ctype_ptr' follow
c:/mingw/bin/../lib/gcc/mingw32/9.2.0/../../../../mingw32/bin/ld.exe: D:\libxlsxwriter\libxlsxwriter\lib\libxlsxwriter.a(utility.o): in function "lxw_quote_sheetname':
/d/libxlsxwriter/libxlsxwriter/src/utility.c:504: undefined reference to "__getreent'
c:/mingw/bin/../lib/gcc/mingw32/9.2.0/../../../../mingw32/bin/ld.exe: D:\libxlsxwriter\libxlsxwriter\lib\libxlsxwriter.a(vml.o): in function "lxw_vml_new':
/d/libxlsxwriter/libxlsxwriter/src/vml.c:31: undefined reference to "__getreent'
c:/mingw/bin/../lib/gcc/mingw32/9.2.0/../../../../mingw32/bin/ld.exe: D:\libxlsxwriter\libxlsxwriter\lib\libxlsxwriter.a(tmpfileplus.o):tmpfileplus.c:(.text+0x182): undefined reference to "__errno'
c:/mingw/bin/../lib/gcc/mingw32/9.2.0/../../../../mingw32/bin/ld.exe: D:\libxlsxwriter\libxlsxwriter\lib\libxlsxwriter.a(tmpfileplus.o):tmpfileplus.c:(.text+0x1db): undefined reference to "__errno'
c:/mingw/bin/../lib/gcc/mingw32/9.2.0/../../../../mingw32/bin/ld.exe: D:\libxlsxwriter\libxlsxwriter\lib\libxlsxwriter.a(tmpfileplus.o):tmpfileplus.c:(.text+0x27c): undefined reference to "__errno'
c:/mingw/bin/../lib/gcc/mingw32/9.2.0/../../../../mingw32/bin/ld.exe: D:\libxlsxwriter\libxlsxwriter\lib\libxlsxwriter.a(tmpfileplus.o):tmpfileplus.c:(.text+0x3bb): undefined reference to "__errno'
c:/mingw/bin/../lib/gcc/mingw32/9.2.0/../../../../mingw32/bin/ld.exe: D:\libxlsxwriter\libxlsxwriter\lib\libxlsxwriter.a(tmpfileplus.o):tmpfileplus.c:(.text+0x4ea): undefined reference to "__errno'
c:/mingw/bin/../lib/gcc/mingw32/9.2.0/../../../../mingw32/bin/ld.exe: D:\libxlsxwriter\libxlsxwriter\lib\libxlsxwriter.a(app.o): in function "lxw_app_new':
/d/libxlsxwriter/libxlsxwriter/src/app.c:31: undefined reference to "__getreent'
c:/mingw/bin/../lib/gcc/mingw32/9.2.0/../../../../mingw32/bin/ld.exe: /d/libxlsxwriter/libxlsxwriter/src/app.c:38: undefined reference to "__getreent'
c:/mingw/bin/../lib/gcc/mingw32/9.2.0/../../../../mingw32/bin/ld.exe: /d/libxlsxwriter/libxlsxwriter/src/app.c:34: undefined reference to "__getreent'
c:/mingw/bin/../lib/gcc/mingw32/9.2.0/../../../../mingw32/bin/ld.exe: D:\libxlsxwriter\libxlsxwriter\lib\libxlsxwriter.a(app.o): in function "lxw_app_add_part_name':
/d/libxlsxwriter/libxlsxwriter/src/app.c:397: undefined reference to "__getreent'
c:/mingw/bin/../lib/gcc/mingw32/9.2.0/../../../../mingw32/bin/ld.exe: /d/libxlsxwriter/libxlsxwriter/src/app.c:394: undefined reference to "__getreent'
c:/mingw/bin/../lib/gcc/mingw32/9.2.0/../../../../mingw32/bin/ld.exe: D:\libxlsxwriter\libxlsxwriter\lib\libxlsxwriter.a(app.o):/d/libxlsxwriter/libxlsxwriter/src/app.c:427: more undefined references to "__getreent' follow
collect2.exe: error: ld returned 1 exit status
Process terminated with status 1 (0 minute(s), 1 second(s))
50 error(s), 0 warning(s) (0 minute(s), 1 second(s))

Offline Miguel Gimenez

  • Developer
  • Lives here!
  • *****
  • Posts: 1553
Re: Using libxlsxwriter : how to use -lz
« Reply #8 on: August 04, 2020, 02:30:04 pm »
You must use the same compiler for your program and the libraries, and the same target (32 or 64 bits). I would start deleting the zlib and libxlxwriter folders and uncompressing them again, and removing all the compilers but one.

Compile zlib without msys, just open a cmd, go to the folder where you uncompressed zlib and execute
Code
mingw32-make -f win32/Makefile.gcc

Then you can copy libz.a to the libxlsxwriter folder, but that is not really needed; just change the global variable zlib to point where libz.a is.

To compile libxlxwriter open msys, go to the library's source folder and execute "make".

You must configure the same compiler in C::B before compiling your project. Use Settings->Compiler for that.

Offline bonelli

  • Single posting newcomer
  • *
  • Posts: 9
Re: Using libxlsxwriter : how to use -lz
« Reply #9 on: August 04, 2020, 04:16:17 pm »
1/
Quote
Compile zlib without msys, just open a cmd, go to the folder where you uncompressed zlib and execute
Code
mingw32-make -f win32/Makefile.gcc
> Done with a fresh version of zlib => libz.a compiled with tools from C:/MinGW/bin
MinGW installed with command-line tool

2/
Quote
To compile libxlxwriter open msys, go to the library's source folder and execute "make".
> Done with a fresh version of libxlxwriter and after a clean install of msys32

3/
Quote
You must configure the same compiler in C::B before compiling your project. Use Settings->Compiler for that.
> I'm using the same tools from the /bin folder used at step 1

Doing that libxlxwriter is compiled with a different compiler.

Results is still the same............
Code
Build started on: 04-08-2020 at 16:15.30
Build ended on: 04-08-2020 at 16:15.32
-------------- Build: Release in Excel (compiler: GNU GCC Compiler)---------------
mingw32-gcc.exe -Wall -O2 -ID:\soft\lib\xlsx\include -c D:\temp\xlsx\main.c -o obj\main.o
mingw32-gcc.exe -o bin\Excel.exe obj\main.o -s D:\soft\lib\xlsx\lib\libxlsxwriter.a D:\soft\lib\zlib\libz.a
c:/mingw/bin/../lib/gcc/mingw32/9.2.0/../../../../mingw32/bin/ld.exe: D:\soft\lib\xlsx\lib\libxlsxwriter.a(workbook.o): in function "store_defined_name':
/d/soft/lib/xlsx/src/workbook.c:591: undefined reference to "__getreent'
c:/mingw/bin/../lib/gcc/mingw32/9.2.0/../../../../mingw32/bin/ld.exe: D:\soft\lib\xlsx\lib\libxlsxwriter.a(workbook.o): in function "populate_range_data_cache':
/d/soft/lib/xlsx/src/workbook.c:744: undefined reference to "__getreent'
c:/mingw/bin/../lib/gcc/mingw32/9.2.0/../../../../mingw32/bin/ld.exe: D:\soft\lib\xlsx\lib\libxlsxwriter.a(workbook.o): in function "populate_range_dimensions':
/d/soft/lib/xlsx/src/workbook.c:852: undefined reference to "__getreent'
c:/mingw/bin/../lib/gcc/mingw32/9.2.0/../../../../mingw32/bin/ld.exe: D:\soft\lib\xlsx\lib\libxlsxwriter.a(workbook.o): in function "prepare_fills':
/d/soft/lib/xlsx/src/workbook.c:370: undefined reference to "__getreent'
c:/mingw/bin/../lib/gcc/mingw32/9.2.0/../../../../mingw32/bin/ld.exe: /d/soft/lib/xlsx/src/workbook.c:379: undefined reference to "__getreent'
c:/mingw/bin/../lib/gcc/mingw32/9.2.0/../../../../mingw32/bin/ld.exe: D:\soft\lib\xlsx\lib\libxlsxwriter.a(workbook.o):/d/soft/lib/xlsx/src/workbook.c:376: more undefined references to "__getreent' follow
c:/mingw/bin/../lib/gcc/mingw32/9.2.0/../../../../mingw32/bin/ld.exe: D:\soft\lib\xlsx\lib\libxlsxwriter.a(workbook.o): in function "workbook_close':
/d/soft/lib/xlsx/src/workbook.c:1936: undefined reference to "__errno'
c:/mingw/bin/../lib/gcc/mingw32/9.2.0/../../../../mingw32/bin/ld.exe: /d/soft/lib/xlsx/src/workbook.c:1933: undefined reference to "__getreent'
c:/mingw/bin/../lib/gcc/mingw32/9.2.0/../../../../mingw32/bin/ld.exe: /d/soft/lib/xlsx/src/workbook.c:1928: undefined reference to "__errno'
c:/mingw/bin/../lib/gcc/mingw32/9.2.0/../../../../mingw32/bin/ld.exe: /d/soft/lib/xlsx/src/workbook.c:1926: undefined reference to "__getreent'
c:/mingw/bin/../lib/gcc/mingw32/9.2.0/../../../../mingw32/bin/ld.exe: /d/soft/lib/xlsx/src/workbook.c:1943: undefined reference to "__errno'
c:/mingw/bin/../lib/gcc/mingw32/9.2.0/../../../../mingw32/bin/ld.exe: /d/soft/lib/xlsx/src/workbook.c:1941: undefined reference to "__getreent'
c:/mingw/bin/../lib/gcc/mingw32/9.2.0/../../../../mingw32/bin/ld.exe: /d/soft/lib/xlsx/src/workbook.c:1948: undefined reference to "__getreent'
c:/mingw/bin/../lib/gcc/mingw32/9.2.0/../../../../mingw32/bin/ld.exe: /d/soft/lib/xlsx/src/workbook.c:1953: undefined reference to "__getreent'
c:/mingw/bin/../lib/gcc/mingw32/9.2.0/../../../../mingw32/bin/ld.exe: /d/soft/lib/xlsx/src/workbook.c:1914: undefined reference to "__errno'
c:/mingw/bin/../lib/gcc/mingw32/9.2.0/../../../../mingw32/bin/ld.exe: /d/soft/lib/xlsx/src/workbook.c:1912: undefined reference to "__getreent'
c:/mingw/bin/../lib/gcc/mingw32/9.2.0/../../../../mingw32/bin/ld.exe: /d/soft/lib/xlsx/src/workbook.c:1921: undefined reference to "__errno'
c:/mingw/bin/../lib/gcc/mingw32/9.2.0/../../../../mingw32/bin/ld.exe: /d/soft/lib/xlsx/src/workbook.c:1919: undefined reference to "__getreent'
c:/mingw/bin/../lib/gcc/mingw32/9.2.0/../../../../mingw32/bin/ld.exe: /d/soft/lib/xlsx/src/workbook.c:1898: undefined reference to "__errno'
c:/mingw/bin/../lib/gcc/mingw32/9.2.0/../../../../mingw32/bin/ld.exe: /d/soft/lib/xlsx/src/workbook.c:1896: undefined reference to "__getreent'
c:/mingw/bin/../lib/gcc/mingw32/9.2.0/../../../../mingw32/bin/ld.exe: D:\soft\lib\xlsx\lib\libxlsxwriter.a(workbook.o): in function "workbook_add_chartsheet':
/d/soft/lib/xlsx/src/workbook.c:1733: undefined reference to "__getreent'
c:/mingw/bin/../lib/gcc/mingw32/9.2.0/../../../../mingw32/bin/ld.exe: /d/soft/lib/xlsx/src/workbook.c:1754: undefined reference to "__getreent'
c:/mingw/bin/../lib/gcc/mingw32/9.2.0/../../../../mingw32/bin/ld.exe: /d/soft/lib/xlsx/src/workbook.c:1762: undefined reference to "__getreent'
c:/mingw/bin/../lib/gcc/mingw32/9.2.0/../../../../mingw32/bin/ld.exe: /d/soft/lib/xlsx/src/workbook.c:1741: undefined reference to "__getreent'
c:/mingw/bin/../lib/gcc/mingw32/9.2.0/../../../../mingw32/bin/ld.exe: D:\soft\lib\xlsx\lib\libxlsxwriter.a(workbook.o):/d/soft/lib/xlsx/src/workbook.c:1722: more undefined references to "__getreent' follow
c:/mingw/bin/../lib/gcc/mingw32/9.2.0/../../../../mingw32/bin/ld.exe: D:\soft\lib\xlsx\lib\libxlsxwriter.a(worksheet.o): in function "write_inline_rich_string_cell':
/d/soft/lib/xlsx/src/worksheet.c:3192: undefined reference to "__locale_ctype_ptr'
c:/mingw/bin/../lib/gcc/mingw32/9.2.0/../../../../mingw32/bin/ld.exe: D:\soft\lib\xlsx\lib\libxlsxwriter.a(worksheet.o): in function "write_inline_string_cell':
/d/soft/lib/xlsx/src/worksheet.c:3153: undefined reference to "__locale_ctype_ptr'
c:/mingw/bin/../lib/gcc/mingw32/9.2.0/../../../../mingw32/bin/ld.exe: D:\soft\lib\xlsx\lib\libxlsxwriter.a(worksheet.o): in function "write_inline_rich_string_cell':
/d/soft/lib/xlsx/src/worksheet.c:3193: undefined reference to "__locale_ctype_ptr'
c:/mingw/bin/../lib/gcc/mingw32/9.2.0/../../../../mingw32/bin/ld.exe: D:\soft\lib\xlsx\lib\libxlsxwriter.a(worksheet.o): in function "write_inline_string_cell':
/d/soft/lib/xlsx/src/worksheet.c:3154: undefined reference to "__locale_ctype_ptr'
c:/mingw/bin/../lib/gcc/mingw32/9.2.0/../../../../mingw32/bin/ld.exe: D:\soft\lib\xlsx\lib\libxlsxwriter.a(worksheet.o): in function "new_row':
/d/soft/lib/xlsx/src/worksheet.c:561: undefined reference to "__getreent'
c:/mingw/bin/../lib/gcc/mingw32/9.2.0/../../../../mingw32/bin/ld.exe: /d/soft/lib/xlsx/src/worksheet.c:564: undefined reference to "__getreent'
c:/mingw/bin/../lib/gcc/mingw32/9.2.0/../../../../mingw32/bin/ld.exe: D:\soft\lib\xlsx\lib\libxlsxwriter.a(worksheet.o): in function "lxw_worksheet_new':
/d/soft/lib/xlsx/src/worksheet.c:105: undefined reference to "__getreent'
c:/mingw/bin/../lib/gcc/mingw32/9.2.0/../../../../mingw32/bin/ld.exe: /d/soft/lib/xlsx/src/worksheet.c:164: undefined reference to "__getreent'
c:/mingw/bin/../lib/gcc/mingw32/9.2.0/../../../../mingw32/bin/ld.exe: /d/soft/lib/xlsx/src/worksheet.c:176: undefined reference to "__getreent'
c:/mingw/bin/../lib/gcc/mingw32/9.2.0/../../../../mingw32/bin/ld.exe: D:\soft\lib\xlsx\lib\libxlsxwriter.a(worksheet.o):/d/soft/lib/xlsx/src/worksheet.c:147: more undefined references to "__getreent' follow
c:/mingw/bin/../lib/gcc/mingw32/9.2.0/../../../../mingw32/bin/ld.exe: D:\soft\lib\xlsx\lib\libxlsxwriter.a(xmlwriter.o): in function "lxw_escape_url_characters':
/d/soft/lib/xlsx/src/xmlwriter.c:328: undefined reference to "__locale_ctype_ptr'
c:/mingw/bin/../lib/gcc/mingw32/9.2.0/../../../../mingw32/bin/ld.exe: /d/soft/lib/xlsx/src/xmlwriter.c:328: undefined reference to "__locale_ctype_ptr'
c:/mingw/bin/../lib/gcc/mingw32/9.2.0/../../../../mingw32/bin/ld.exe: D:\soft\lib\xlsx\lib\libxlsxwriter.a(chart.o): in function "chart_init_data_cache':
/d/soft/lib/xlsx/src/chart.c:137: undefined reference to "__getreent'
c:/mingw/bin/../lib/gcc/mingw32/9.2.0/../../../../mingw32/bin/ld.exe: D:\soft\lib\xlsx\lib\libxlsxwriter.a(chart.o): in function "chart_set_default_marker_type':
/d/soft/lib/xlsx/src/chart.c:434: undefined reference to "__getreent'
c:/mingw/bin/../lib/gcc/mingw32/9.2.0/../../../../mingw32/bin/ld.exe: D:\soft\lib\xlsx\lib\libxlsxwriter.a(chart.o): in function "chart_convert_line_args':
/d/soft/lib/xlsx/src/chart.c:349: undefined reference to "__getreent'
c:/mingw/bin/../lib/gcc/mingw32/9.2.0/../../../../mingw32/bin/ld.exe: D:\soft\lib\xlsx\lib\libxlsxwriter.a(chart.o): in function "chart_convert_fill_args':
/d/soft/lib/xlsx/src/chart.c:376: undefined reference to "__getreent'
c:/mingw/bin/../lib/gcc/mingw32/9.2.0/../../../../mingw32/bin/ld.exe: D:\soft\lib\xlsx\lib\libxlsxwriter.a(chart.o): in function "chart_initialize':
/d/soft/lib/xlsx/src/chart.c:4925: undefined reference to "__getreent'
c:/mingw/bin/../lib/gcc/mingw32/9.2.0/../../../../mingw32/bin/ld.exe: D:\soft\lib\xlsx\lib\libxlsxwriter.a(chart.o):/d/soft/lib/xlsx/src/chart.c:252: more undefined references to "__getreent' follow
c:/mingw/bin/../lib/gcc/mingw32/9.2.0/../../../../mingw32/bin/ld.exe: D:\soft\lib\xlsx\lib\libxlsxwriter.a(shared_strings.o): in function "write_t':
/d/soft/lib/xlsx/src/shared_strings.c:128: undefined reference to "__locale_ctype_ptr'
c:/mingw/bin/../lib/gcc/mingw32/9.2.0/../../../../mingw32/bin/ld.exe: /d/soft/lib/xlsx/src/shared_strings.c:129: undefined reference to "__locale_ctype_ptr'
c:/mingw/bin/../lib/gcc/mingw32/9.2.0/../../../../mingw32/bin/ld.exe: D:\soft\lib\xlsx\lib\libxlsxwriter.a(styles.o): in function "lxw_styles_new':
/d/soft/lib/xlsx/src/styles.c:33: undefined reference to "__getreent'
c:/mingw/bin/../lib/gcc/mingw32/9.2.0/../../../../mingw32/bin/ld.exe: /d/soft/lib/xlsx/src/styles.c:36: undefined reference to "__getreent'
c:/mingw/bin/../lib/gcc/mingw32/9.2.0/../../../../mingw32/bin/ld.exe: D:\soft\lib\xlsx\lib\libxlsxwriter.a(styles.o): in function "lxw_styles_write_string_fragment':
/d/soft/lib/xlsx/src/styles.c:83: undefined reference to "__locale_ctype_ptr'
c:/mingw/bin/../lib/gcc/mingw32/9.2.0/../../../../mingw32/bin/ld.exe: /d/soft/lib/xlsx/src/styles.c:84: undefined reference to "__locale_ctype_ptr'
c:/mingw/bin/../lib/gcc/mingw32/9.2.0/../../../../mingw32/bin/ld.exe: D:\soft\lib\xlsx\lib\libxlsxwriter.a(theme.o): in function "lxw_theme_new':
/d/soft/lib/xlsx/src/theme.c:295: undefined reference to "__getreent'
c:/mingw/bin/../lib/gcc/mingw32/9.2.0/../../../../mingw32/bin/ld.exe: D:\soft\lib\xlsx\lib\libxlsxwriter.a(utility.o): in function "lxw_name_to_row':
/d/soft/lib/xlsx/src/utility.c:247: undefined reference to "__locale_ctype_ptr'
c:/mingw/bin/../lib/gcc/mingw32/9.2.0/../../../../mingw32/bin/ld.exe: D:\soft\lib\xlsx\lib\libxlsxwriter.a(utility.o): in function "lxw_name_to_col':
/d/soft/lib/xlsx/src/utility.c:270: undefined reference to "__locale_ctype_ptr'
c:/mingw/bin/../lib/gcc/mingw32/9.2.0/../../../../mingw32/bin/ld.exe: D:\soft\lib\xlsx\lib\libxlsxwriter.a(utility.o): in function "lxw_name_to_row':
/d/soft/lib/xlsx/src/utility.c:247: undefined reference to "__locale_ctype_ptr'
c:/mingw/bin/../lib/gcc/mingw32/9.2.0/../../../../mingw32/bin/ld.exe: /d/soft/lib/xlsx/src/utility.c:247: undefined reference to "__locale_ctype_ptr'
c:/mingw/bin/../lib/gcc/mingw32/9.2.0/../../../../mingw32/bin/ld.exe: D:\soft\lib\xlsx\lib\libxlsxwriter.a(utility.o): in function "lxw_name_to_col':
/d/soft/lib/xlsx/src/utility.c:270: undefined reference to "__locale_ctype_ptr'
c:/mingw/bin/../lib/gcc/mingw32/9.2.0/../../../../mingw32/bin/ld.exe: D:\soft\lib\xlsx\lib\libxlsxwriter.a(utility.o):/d/soft/lib/xlsx/src/utility.c:467: more undefined references to "__locale_ctype_ptr' follow
c:/mingw/bin/../lib/gcc/mingw32/9.2.0/../../../../mingw32/bin/ld.exe: D:\soft\lib\xlsx\lib\libxlsxwriter.a(utility.o): in function "lxw_quote_sheetname':
/d/soft/lib/xlsx/src/utility.c:504: undefined reference to "__getreent'
c:/mingw/bin/../lib/gcc/mingw32/9.2.0/../../../../mingw32/bin/ld.exe: D:\soft\lib\xlsx\lib\libxlsxwriter.a(vml.o): in function "lxw_vml_new':
/d/soft/lib/xlsx/src/vml.c:31: undefined reference to "__getreent'
c:/mingw/bin/../lib/gcc/mingw32/9.2.0/../../../../mingw32/bin/ld.exe: D:\soft\lib\xlsx\lib\libxlsxwriter.a(tmpfileplus.o):tmpfileplus.c:(.text+0x182): undefined reference to "__errno'
c:/mingw/bin/../lib/gcc/mingw32/9.2.0/../../../../mingw32/bin/ld.exe: D:\soft\lib\xlsx\lib\libxlsxwriter.a(tmpfileplus.o):tmpfileplus.c:(.text+0x1db): undefined reference to "__errno'
c:/mingw/bin/../lib/gcc/mingw32/9.2.0/../../../../mingw32/bin/ld.exe: D:\soft\lib\xlsx\lib\libxlsxwriter.a(tmpfileplus.o):tmpfileplus.c:(.text+0x27c): undefined reference to "__errno'
c:/mingw/bin/../lib/gcc/mingw32/9.2.0/../../../../mingw32/bin/ld.exe: D:\soft\lib\xlsx\lib\libxlsxwriter.a(tmpfileplus.o):tmpfileplus.c:(.text+0x3bb): undefined reference to "__errno'
c:/mingw/bin/../lib/gcc/mingw32/9.2.0/../../../../mingw32/bin/ld.exe: D:\soft\lib\xlsx\lib\libxlsxwriter.a(tmpfileplus.o):tmpfileplus.c:(.text+0x4ea): undefined reference to "__errno'
c:/mingw/bin/../lib/gcc/mingw32/9.2.0/../../../../mingw32/bin/ld.exe: D:\soft\lib\xlsx\lib\libxlsxwriter.a(app.o): in function "lxw_app_new':
/d/soft/lib/xlsx/src/app.c:31: undefined reference to "__getreent'
c:/mingw/bin/../lib/gcc/mingw32/9.2.0/../../../../mingw32/bin/ld.exe: /d/soft/lib/xlsx/src/app.c:38: undefined reference to "__getreent'
c:/mingw/bin/../lib/gcc/mingw32/9.2.0/../../../../mingw32/bin/ld.exe: /d/soft/lib/xlsx/src/app.c:34: undefined reference to "__getreent'
c:/mingw/bin/../lib/gcc/mingw32/9.2.0/../../../../mingw32/bin/ld.exe: D:\soft\lib\xlsx\lib\libxlsxwriter.a(app.o): in function "lxw_app_add_part_name':
/d/soft/lib/xlsx/src/app.c:397: undefined reference to "__getreent'
c:/mingw/bin/../lib/gcc/mingw32/9.2.0/../../../../mingw32/bin/ld.exe: /d/soft/lib/xlsx/src/app.c:394: undefined reference to "__getreent'
c:/mingw/bin/../lib/gcc/mingw32/9.2.0/../../../../mingw32/bin/ld.exe: D:\soft\lib\xlsx\lib\libxlsxwriter.a(app.o):/d/soft/lib/xlsx/src/app.c:427: more undefined references to "__getreent' follow
collect2.exe: error: ld returned 1 exit status
Process terminated with status 1 (0 minute(s), 1 second(s))
50 error(s), 0 warning(s) (0 minute(s), 1 second(s))

Offline Miguel Gimenez

  • Developer
  • Lives here!
  • *****
  • Posts: 1553
Re: Using libxlsxwriter : how to use -lz
« Reply #10 on: August 04, 2020, 04:28:20 pm »
msys should use the same toolchain of step 1, you can use gcc --version to check which version msys and cmd are using. Try msys-1.0 from this link:

http://downloads.sourceforge.net/mingw/MSYS-1.0.11.exe

Offline bonelli

  • Single posting newcomer
  • *
  • Posts: 9
Re: Using libxlsxwriter : how to use -lz
« Reply #11 on: August 04, 2020, 05:08:17 pm »
Msys 1 installed, binded to C:/MinGW using etc/fstab

gcc -- version returns 9.2.0, using cmd or msys

Quote
Then you can copy libz.a to the libxlsxwriter folder
> Done
Quote
To compile libxlxwriter open msys, go to the library's source folder and execute "make".

Code
$ make
make[1]: Entering directory `/d/soft/lib/xlsx/third_party/minizip'
make[1]: Nothing to be done for `all'.
make[1]: Leaving directory `/d/soft/lib/xlsx/third_party/minizip'
make[1]: Entering directory `/d/soft/lib/xlsx/third_party/tmpfileplus'
make[1]: Nothing to be done for `all'.
make[1]: Leaving directory `/d/soft/lib/xlsx/third_party/tmpfileplus'
make[1]: Entering directory `/d/soft/lib/xlsx/third_party/md5'
make[1]: Nothing to be done for `all'.
make[1]: Leaving directory `/d/soft/lib/xlsx/third_party/md5'
make[1]: Entering directory `/d/soft/lib/xlsx/src'
c:/mingw/bin/../lib/gcc/mingw32/9.2.0/../../../../mingw32/bin/ld.exe: cannot find -lz
collect2.exe: error: ld returned 1 exit status
make[1]: *** [libxlsxwriter.dll] Error 1
make[1]: Leaving directory `/d/soft/lib/xlsx/src'
make: *** [all] Error 2

Note:
c:/mingw/bin/../lib/gcc/mingw32/9.2.0/../../../../mingw32/bin
is
C:\MinGW\mingw32\bin
I don't know why it didn't use the ld.exe in C:\MinGW\bin
Sounds like they like spaghetti.

Offline Miguel Gimenez

  • Developer
  • Lives here!
  • *****
  • Posts: 1553
Re: Using libxlsxwriter : how to use -lz
« Reply #12 on: August 04, 2020, 05:21:15 pm »
Try copying libz.a into "/d/soft/lib/xlsx/src" and run make again. My MinGW installation (MinGW-w64) has a built-in libz.a, so this step is not needed.

Offline bonelli

  • Single posting newcomer
  • *
  • Posts: 9
Re: Using libxlsxwriter : how to use -lz
« Reply #13 on: August 04, 2020, 05:33:52 pm »
I already did that, but the lib is still not found. Any way to specify where the lib is using the command line?

Offline bonelli

  • Single posting newcomer
  • *
  • Posts: 9
Re: Using libxlsxwriter : how to use -lz
« Reply #14 on: August 04, 2020, 06:02:53 pm »
Code
make LDFLAGS="-L."
  did the job.  :)

How do you do to take care of the global variables? I didn't see where in your project you are asking to use global variables.