Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compile&run on linux #1

Open
janbenda opened this issue Apr 2, 2017 · 0 comments
Open

Compile&run on linux #1

janbenda opened this issue Apr 2, 2017 · 0 comments

Comments

@janbenda
Copy link

janbenda commented Apr 2, 2017

I am trying compile and use this nice wrapper on linux. All test for library libxlsxwriter passed clean.
I can compile wrapper after small changes in source code (lower, case and dll->so, adding xhb.hbc to libxlw.hbp):
[jan@ hblibxlsxwriter]$ diff hblibxlsxwriter.prg hblibxlsxwriter.prg.new
17,18c17,18
#include "CStruct.ch" // required for "typedef struct"
#include "Wintypes.ch"
#include "cstruct.ch" // required for "typedef struct"
#include "wintypes.ch"
23c23,24
nHDll:= hb_libLoad( "libxlsxwriter.dll" )
nHDll:= hb_libLoad( "libxlsxwriter.so" )
But running is SIGSEGV in
lxw_workbook_close (lxw_format_get_xf_index (self=0x4034000000000000) at format.c:265).

If I set format to NULL in library code (src/worksheet.c), program demo.p
demo.prg.txt

rg runs correctly and xlsx file is created (missing formats visibly affect only date values):
diff --git a/src/worksheet.c b/src/worksheet.c
index d8e8752..3b10416 100644
--- a/src/worksheet.c
+++ b/src/worksheet.c
@@ -4547,6 +4547,7 @@ worksheet_set_column_opt(lxw_worksheet *self,
lxw_col_t col;
lxw_error err;

  • format = NULL;
    if (user_options) {
    hidden = user_options->hidden;
    level = user_options->level;

Here is gdb and valgrind output for run demo.prg. My knowledge ends here. Can you look at it?
thank you for your good work
GDB
[jan@ example]$ hbmk2 -b demo.prg example.hbp
Harbour 3.4.0dev (3eae9a6254) (2017-03-31 08:48)
Copyright (c) 1999-2017, https://github.com/vszakats/harbour-core/
Compiling 'demo.prg'...
Lines 541, Functions/Procedures 1
Generating C source output to '/tmp/hbmk_dqua5f.dir/demo.c'... Done.
[jan@ example]$ gdb demo
GNU gdb (GDB) 7.12.1
Copyright (C) 2017 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later http://gnu.org/licenses/gpl.html
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law. Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-pc-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
http://www.gnu.org/software/gdb/bugs/.
Find the GDB manual and other documentation resources online at:
http://www.gnu.org/software/gdb/documentation/.
For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from demo...done.
(gdb) r
Starting program: /usr/local/src/hbvs/hblibxlsxwriter/example/demo
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/usr/lib/libthread_db.so.1".
Program received signal SIGSEGV, Segmentation fault.
lxw_format_get_xf_index (self=0x4034000000000000) at format.c:265
265 if (self->xf_index != LXW_PROPERTY_UNSET) {
(gdb)
VALGRIND
[jan@ example]$ valgrind ./demo
==18860== Memcheck, a memory error detector
==18860== Copyright (C) 2002-2015, and GNU GPL'd, by Julian Seward et al.
==18860== Using Valgrind-3.12.0 and LibVEX; rerun with -h for copyright info
==18860== Command: ./demo
==18860==
==18860== Invalid read of size 4
==18860== at 0x9D55DDA: lxw_format_get_xf_index (format.c:265)
==18860== by 0x9D69953: _worksheet_write_col_info (worksheet.c:2717)
==18860== by 0x9D69953: _worksheet_write_cols (worksheet.c:2785)
==18860== by 0x9D69953: lxw_worksheet_assemble_xml_file (worksheet.c:3340)
==18860== by 0x9D798F7: _write_worksheet_files (packager.c:178)
==18860== by 0x9D798F7: lxw_create_package (packager.c:894)
==18860== by 0x9D75056: workbook_close (workbook.c:1557)
==18860== by 0x57DDC11: hb_dynCall (hbdyn.c:956)
==18860== by 0x57D27E1: HB_FUN_HB_DYNCALL (hbdynhb.c:113)
==18860== by 0x5915B80: hb_vmProc (hvm.c:5956)
==18860== by 0x58DD8E8: hb_vmMacroFunc (hvm.c:5704)
==18860== by 0x58DD8E8: hb_vmExecute (hvm.c:2640)
==18860== by 0x5915B80: hb_vmProc (hvm.c:5956)
==18860== by 0x58DDF70: hb_vmExecute (hvm.c:1756)
==18860== by 0x5915B80: hb_vmProc (hvm.c:5956)
==18860== by 0x58DC2B9: hb_vmExecute (hvm.c:1769)
==18860== Address 0x4034000000000018 is not stack'd, malloc'd or (recently) free'd
==18860==
==18860==
==18860== Process terminating with default action of signal 11 (SIGSEGV): dumping core
==18860== General Protection Fault
==18860== at 0x9D55DDA: lxw_format_get_xf_index (format.c:265)
==18860== by 0x9D69953: _worksheet_write_col_info (worksheet.c:2717)
==18860== by 0x9D69953: _worksheet_write_cols (worksheet.c:2785)
==18860== by 0x9D69953: lxw_worksheet_assemble_xml_file (worksheet.c:3340)
==18860== by 0x9D798F7: _write_worksheet_files (packager.c:178)
==18860== by 0x9D798F7: lxw_create_package (packager.c:894)
==18860== by 0x9D75056: workbook_close (workbook.c:1557)
==18860== by 0x57DDC11: hb_dynCall (hbdyn.c:956)
==18860== by 0x57D27E1: HB_FUN_HB_DYNCALL (hbdynhb.c:113)
==18860== by 0x5915B80: hb_vmProc (hvm.c:5956)
==18860== by 0x58DD8E8: hb_vmMacroFunc (hvm.c:5704)
==18860== by 0x58DD8E8: hb_vmExecute (hvm.c:2640)
==18860== by 0x5915B80: hb_vmProc (hvm.c:5956)
==18860== by 0x58DDF70: hb_vmExecute (hvm.c:1756)
==18860== by 0x5915B80: hb_vmProc (hvm.c:5956)
==18860== by 0x58DC2B9: hb_vmExecute (hvm.c:1769)
==18860==
==18860== HEAP SUMMARY:
==18860== in use at exit: 892,526 bytes in 6,471 blocks
==18860== total heap usage: 12,546 allocs, 6,075 frees, 44,445,681 bytes allocated
==18860==
==18860== LEAK SUMMARY:
==18860== definitely lost: 0 bytes in 0 blocks
==18860== indirectly lost: 0 bytes in 0 blocks
==18860== possibly lost: 186,696 bytes in 947 blocks
==18860== still reachable: 705,830 bytes in 5,524 blocks
==18860== of which reachable via heuristic:
==18860== length64 : 1,053 bytes in 117 blocks
==18860== newarray : 770,830 bytes in 5,908 blocks
==18860== suppressed: 0 bytes in 0 blocks
==18860== Rerun with --leak-check=full to see details of leaked memory
==18860==
==18860== For counts of detected and suppressed errors, rerun with: -v
==18860== ERROR SUMMARY: 1 errors from 1 contexts (suppressed: 0 from 0)
Segmentation fault (core dumped)
[jan@ example]$

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant