Linux - SoftwareThis forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Distribution: Ubuntu & Mint LTS, Manjaro Rolling; Android
Posts: 242
Rep:
C++ and Grub Fonts
I have a need (well, ok, a desire) to edit a font in pf2 format used (I believe) only by GRUB and to use that font on the grub menu in the newest version 19 of Linux Mint. The only utility that purports to be able to do edit such fonts is a pair of C++ apps located at:
ffam-rip converts a pf2 font to an editable format, and ffam-build rebuilds the result into a new pf2 font. It sounds like just what I need, but these seem to only be available as source code at the referenced github locations. This is a fresh installation of Linux Mint 19, so I went ahead and installed g++ and the build-essential package and tried
Code:
g++ ffam-rip.cpp -o pfrip
This gave me the following error
Code:
ffam-rip.cpp:2:22: fatal error: SDL2/SDL.h: No such file or directory
compilation terminated.
Ok, I should have glanced at the source more carefully, but I was in a hurry. I looked in synaptic and found nothing resembling SDL. Trolling around the internet, I located the following:
To preclude being boring or embarassing myself, I'll stop short here; the bottom line is that I was unable to get either utility compiled. Can anyone tell me what I'm missing? ... and hopefully list the exact steps I would need to compile these; they are quite short (only about 500 generously spaced lines each). I've been away from this stuff for long enough that I don't think I have a lot of chance of unraveling this any time soon.
OR: if anyone knows of some other way to edit pf2 fonts (or even the more obscure .pcf.gz font format), I'm all ears.
I suspect that these programs were never meant to be installed as orphans. Probably you have to download the whole ffam package. That's how Linux programs almost always come to you: as a package.
There should be an opportunity to download the package as a tarball (a zipped archive). When you unpack it, there should be a README or INSTALL file that will tell you how to proceed. Nine times out of ten, it's just "./configure, make, sudo make install".
Distribution: Ubuntu & Mint LTS, Manjaro Rolling; Android
Posts: 242
Original Poster
Rep:
Thanks all for your replies, but I had already installed libsdl2-2.0-0 and libsdl2-dev packages; when running the command line you suggested:
Quote:
g++ ffam-rip.cpp -o ffam-rip -l SDL2
I got the following:
Quote:
ffam-rip.cpp:26:22: warning: non-static data member initializers only available with -std=c++11 or -std=gnu++11
std::string NAME="";
^
ffam-rip.cpp:30:17: warning: non-static data member initializers only available with -std=c++11 or -std=gnu++11
u16 PTSZ = ~0;
^
ffam-rip.cpp:31:17: warning: non-static data member initializers only available with -std=c++11 or -std=gnu++11
u16 MAXW = ~0;
^
ffam-rip.cpp:32:17: warning: non-static data member initializers only available with -std=c++11 or -std=gnu++11
u16 MAXH = ~0;
^
ffam-rip.cpp:33:17: warning: non-static data member initializers only available with -std=c++11 or -std=gnu++11
u16 ASCE = ~0;
^
ffam-rip.cpp:34:17: warning: non-static data member initializers only available with -std=c++11 or -std=gnu++11
u16 DESC = ~0;
^
ffam-rip.cpp: In function ‘int main(int, char**)’:
ffam-rip.cpp:252:10: error: ‘start’ does not name a type
auto start = ftell(f);
^
ffam-rip.cpp:275:23: error: ‘nullptr’ was not declared in this scope
char * data = nullptr;
^
ffam-rip.cpp:291:22: error: ‘j’ does not name a type
for(auto j=0;j<8;j++)
^
ffam-rip.cpp:291:26: error: expected ‘;’ before ‘j’
for(auto j=0;j<8;j++)
^
ffam-rip.cpp:291:26: error: ‘j’ was not declared in this scope
ffam-rip.cpp:295:22: error: ‘b’ does not name a type
auto b = 128>>j;
^
ffam-rip.cpp:296:39: error: ‘b’ was not declared in this scope
setpixels += (data[i]&b)!=0;
^
ffam-rip.cpp:312:21: error: ‘class std::map<unsigned int, chardef>’ has no member named ‘emplace’
definitions.emplace(addr,mydef);
^
ffam-rip.cpp:319:10: error: ‘test’ does not name a type
auto test = fopen(outtxt.data(), "w");
^
ffam-rip.cpp:321:13: error: ‘test’ was not declared in this scope
fprintf(test, "NAME=%s\n",myfont.NAME.data());
^
ffam-rip.cpp:333:14: error: ‘c’ does not name a type
for(auto c : myfont.CHIX)
^
ffam-rip.cpp:344:5: error: expected ‘;’ before ‘uint’
uint d_cols = display; // display columns
^
ffam-rip.cpp:346:9: error: expected primary-expression before ‘dwidth’
u32 dwidth = sumWidth;
^
ffam-rip.cpp:346:9: error: expected ‘)’ before ‘dwidth’
ffam-rip.cpp:346:9: error: ‘dwidth’ was not declared in this scope
ffam-rip.cpp:352:9: error: ‘dwidth’ was not declared in this scope
dwidth = (myfont.MAXW+s_boxpad+2)*d_cols+s_boxpad;
^
ffam-rip.cpp:352:43: error: ‘d_cols’ was not declared in this scope
dwidth = (myfont.MAXW+s_boxpad+2)*d_cols+s_boxpad;
^
ffam-rip.cpp:357:30: error: ‘dwidth’ was not declared in this scope
printf("%dx%d\n",dheight,dwidth);
^
ffam-rip.cpp:369:14: error: ‘c’ does not name a type
for(auto c : myfont.CHIX)
^
In file included from /usr/include/SDL2/SDL_video.h:34:0,
from /usr/include/SDL2/SDL_events.h:33,
from /usr/include/SDL2/SDL.h:41,
from ffam-rip.cpp:7:
ffam-rip.cpp:446:5: error: expected ‘;’ before ‘SDL_SaveBMP_RW’
SDL_SaveBMP(myimage, outbmp.data());
^
ffam-rip.cpp:447:29: error: expected ‘)’ before ‘;’ token
SDL_FreeSurface(myimage);
That led me to believe that there was something more fundamental that I was missing. I did notice just now while confirming the version number in Synaptic, however, that there are also some libsdl1.x packages installed as well. Might that be confusing things?
Distribution: Ubuntu & Mint LTS, Manjaro Rolling; Android
Posts: 242
Original Poster
Rep:
Hazel: Thanks much; adding that line did the trick. If it's not a whole lot of trouble, could you explain to me how you came up with that suggestion? I assume there were certain hints in the output I posted that suggested I was using an older/newer flavor of c++, but I'm curious...
pan64: I was dismayed to find that simply installing the gcc/g++ compiler from the command line didn't tell me that I had so many version choices available, so you are undoubtedly correct. A trip to Synaptic showed at least two other versions I could have chosen. That would have left me scratching my head as to what the correct choice might have been, but at least I could have asked a better question. Could I ask you as well, what prompted you to suggest that.
the error message you posted means the syntax of the source files were based on C++ version 11. This is relatively new, so either the compiler you use still did not understand it or the default is an earlier version. In your case -std=gnu++11 solved the issue, that means the latter.
Distribution: Ubuntu & Mint LTS, Manjaro Rolling; Android
Posts: 242
Original Poster
Rep:
Thanks much;
Now that you've explained it and I go back and read things like "only available with -std=c++11 or -std=gnu++11" that explanation makes perfect sense. It's almost embarrassing even. I looked in Synaptic and the installed/default versions are indeed not the most recent available; so I'm guessing that the compiler itself has internal defaults as to which source version it expects to be fed. If I get the time, I'll replace it with the newest G++ and see if it still needs the "-std=gnu++11" on the command line.
Again thanks to both of you. I've been retired for more than ten years now, and don't really keep up as well as I could.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.