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

guidogetpagemap or guidogetpagecount (core dumped) #148

Open
motniemtin opened this issue Mar 28, 2022 · 8 comments
Open

guidogetpagemap or guidogetpagecount (core dumped) #148

motniemtin opened this issue Mar 28, 2022 · 8 comments

Comments

@motniemtin
Copy link

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

I meet this error, can not run guidogetpagemap or guidogetpagecount

@dfober
Copy link
Member

dfober commented Mar 28, 2022

Please, post the corresponding guido code.

@motniemtin
Copy link
Author

(*
  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 ]
  }

@dfober
Copy link
Member

dfober commented Mar 29, 2022

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

@motniemtin
Copy link
Author

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

version 1.7.4
centos 8

@dfober
Copy link
Member

dfober commented Mar 30, 2022

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)

@motniemtin
Copy link
Author

Error happen in
guidogetpagecount
guidogetpagemap
guidogetsystemcount
guidogetsystemmap

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

@dfober
Copy link
Member

dfober commented Mar 31, 2022

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

@motniemtin
Copy link
Author

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;
}



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

2 participants