guidolib icon indicating copy to clipboard operation
guidolib copied to clipboard

guidogetpagemap or guidogetpagecount (core dumped)

Open motniemtin opened this issue 2 years ago • 8 comments

guidogetpagemap ./test.gmn
# get page mapping for ./test.gmn
Segmentation fault (core dumped)

I meet this error, can not run guidogetpagemap or guidogetpagecount

motniemtin avatar Mar 28 '22 09:03 motniemtin

Please, post the corresponding guido code.

dfober avatar Mar 28 '22 16:03 dfober

(*
  gmn code converted from 
  using libmusicxml v.3.21
  and the embedded xml2guido converter v.3.2
*)
{[ \staff<1> \set<autoHideTiedAccidentals="on"> \barFormat<style= "system", range="1"> 
   (* meas. 1 *)  \clef<"g2"> \key<0> \meter<"3/4", autoBarlines="off", autoMeasuresNum="system"> \stemsDown \beamsOff e2/4 \text<"rit.",fattrib="i", dy=19hs>( \stemsDown \beamBegin:1 d2/8)
 \stemsDown c2/8 \beamEnd:1 \stemsUp \beamBegin:1 a1/8 \stemsUp b1/8 \beamEnd:1 \bar<measNum=2> 
   (* meas. 2 *)  \tempo<"[1/4] = 60", dy=4hs> \stemsDown \beamsOff c2/4 \stemsDown \beamsOff \tieBegin:1 f2/4 \stemsDown \beamBegin:1 f2/16 \tieEnd:1 \stemsDown e2/16 \stemsDown d2/16 \stemsDown c2/16 \beamEnd:1 ]
  }

motniemtin avatar Mar 29 '22 07:03 motniemtin

Can't reproduce the problem. Could you send more information: guido engine version, your platform, etc.

dfober avatar Mar 29 '22 08:03 dfober

I do command guidogetpagecount $guidofile but get Segmentation fault (core dumped)

version 1.7.4 centos 8

motniemtin avatar Mar 29 '22 08:03 motniemtin

Sorry, I don't have any computer running centos. I guess you're using a fresh build of the project and that it has been properly installed. Can you get more information regarding the seg fault? Do you have a similar problem with the other tools ? (e.g. guido2svg)

dfober avatar Mar 30 '22 07:03 dfober

Error happen in guidogetpagecount guidogetpagemap guidogetsystemcount guidogetsystemmap

I found that problem is SVGSystem sys; or CairoSystem sys; Error fix with SVGSystem

motniemtin avatar Mar 31 '22 09:03 motniemtin

GUIDO Graphic device is still based on the old cairo system. It might be due to that. Did you fixed it ?

dfober avatar Mar 31 '22 12:03 dfober

I has fixed for guidogetpagecount.cpp change CairoSystem to SVGSystem


#ifndef WIN32
#include <libgen.h>
#endif
#include <iostream>
#include <fstream>
#include <sstream>
#include <stdlib.h>

#ifdef WIN32
#include "GSystemWin32.h"
GSystemWin32 gSys(0,0);
#elif __APPLE__
#include "GSystemOSX.h"
GSystemOSX gSys (0,0);
#else
#include "CairoSystem.h"
CairoSystem gSys(0);
#endif

#include "GUIDOParse.h"
#include "GUIDOEngine.h"
#include "VGDevice.h"
#include "SVGSystem.h"

using namespace std;

#define kSize	5000

static void error (GuidoErrCode err)
{
	cerr << "error #" << err << ": " << GuidoGetErrorString (err) << endl;
	exit (err);
}


int main(int argc, char **argv)
{
    SVGSystem sys;
	VGDevice *dev = sys.CreateDisplayDevice();
    GuidoInitDesc gd = { dev, 0, 0, 0 };
    GuidoInit (&gd);

	for (int i = 1; i < argc; i++)
    {
        const char* file = argv[i];

    	GuidoErrCode err;
    
    	GuidoParser *parser = GuidoOpenParser();
    	ARHandler arh = GuidoFile2AR (parser, file);
    	
		if (arh)
        {
			GRHandler grh;
			err = GuidoAR2GR (arh, 0, &grh);
			if (err != guidoNoErr)
                error(err);
			else
            {
				int n = GuidoGetPageCount (grh);
				cout << argv[i] << " : " << n << endl;
				GuidoFreeGR (grh);
			}
			GuidoFreeAR (arh);
		}
		else {
			int line, col;
			err = GuidoParserGetErrorCode (parser, line, col, 0);
			error (err);
		}

        GuidoCloseParser(parser);
	}

	delete dev;

	return 0;
}



motniemtin avatar Apr 01 '22 03:04 motniemtin