gcodeview
gcodeview copied to clipboard
OsX: FTGL createFont failed: No such file or directory
It compiles fine, then when I run gcodeview with a file, I get:
File is 52081 long Indexing lines... found layer 0 FTGL createFont failed: No such file or directory
hm, somehow your fontconfig is returning a nonexistent file when asked for a monospace font.. can you add liberal printf between main.c#L1029 and L1044 and see what's happening?
the error appear after the call to scanLines() on L1011, but before FcPattern declaration on L1029.
It's odd, it's actually happening within scanLines() and seems to come from L716:printf("found layer %d\n", currentLayer);
If I put a printf("font error") before it, the msg FTGL createFont failed: No such file or directory
would appear after my printf, and if I put a printf("font error") after L716, then my printf msg appears before the FTGL createFont failed.
It doesn't sound of any help, but I get 3 warnings during the make:
cc -O2 -std=c99 -Wall
pkg-config --cflags sdl ftgl fontconfig freetype2-std=c99 -c main.c -o main.o main.c:228:27: warning: format specifies type 'int' but the argument has type 'long' [-Wformat] printf("\tstart: %d\n", Zstack[i].start - gcodefile); ~~ ^~~~~~~~~~~~~~~~~~~~~~~~~~~ %ld main.c:687:40: warning: format specifies type 'int' but the argument has type 'long' [-Wformat] printf("Layer %d at %d+%d=%d\n", i, layer[i].index - gcodefile, layer[i].size, layer[i].index - gcodefile + layer[i].size); ~~ ^~~~~~~~~~~~~~~~~~~~~~~~~~ %ld main.c:687:83: warning: format specifies type 'int' but the argument has type 'long' [-Wformat] printf("Layer %d at %d+%d=%d\n", i, layer[i].index - gcodefile, layer[i].size, layer[i].index - gcodefile + layer[i].size); ~~ ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ %ld 3 warnings generated. cc main.o
pkg-config --libs sdl ftgl fontconfig freetype2-lm -framework OpenGL -o gcodeview Building for [Darwin].
Also, probably of help this time, the dependencies come from Macports and not from Brew. They're supposed to the same, but there could be some version discrepancies. Here's are the lib's version in use on my platform:
ftgl @2.1.3-rc5 libsdl @1.2.15 fontconfig @2.10.2 freetype @2.4.10
does your mac have strace? it sounds like gcc's instruction reordering may be making debugging difficult. change the optimisation in the Makefile to O0 and let me know what you find
optimisation level to 0 doesn't make any difference unfortunately.
I've used dtruss, the equivalent of strace on latest OsX. The result is a pretty undigest, 3000 odd lines I've pasted on gist: https://gist.github.com/nodje/5386344
with found layer 0
apprearing on line 1153 and FTGL createFont failed
on line 3179.
In between lies an endless list of font and Apple related plist loading. Nothing that speaks to me. It seems to suggest that the error is either OsX related or more probably due to my config.
54308/0x1a94be: open("/opt/local/var/cache/fontconfig/5af544f59fb8b0c2b645abc88891fd31-le64.cache-3\0", 0x0, 0x0) = 6 0
54308/0x1a94be: fstat64(0x6, 0x7FFF57BA8FD0, 0x0) = 0 0
54308/0x1a94be: fstatfs64(0x6, 0x7FFF57BA84E0, 0x7FFF57BA8F40) = 0 0
54308/0x1a94be: read(0x6, "\004\374\002\374\003\0", 0x78) = 120 0
54308/0x1a94be: close(0x6) = 0 0
54308/0x1a94be: open("\004\0", 0x0, 0x200) = -1 Err#2
54308/0x1a94be: write_nocancel(0x2, "FTGL createFont failed: No such file or directory\n\0", 0x32) = 50 0
looks like it runs through the fontconfig cache, then decides to open "\004\0" which of course doesn't exist.. what happens if you temporarily rename /opt/local/var/cache/fontconfig ?
In this case, it'd recreate the fontconfig dir in .cache for the local user, ending in the same error.
7262/0x1a73d: open("/opt/local/var/cache/fontconfig/5af544f59fb8b0c2b645abc88891fd31-le64.cache-3\0", 0x0, 0x0) = -1 Err#2 7262/0x1a73d: open("/Users/sa/.cache/fontconfig/5af544f59fb8b0c2b645abc88891fd31-le64.cache-3\0", 0x0, 0x0) = 5 0 7262/0x1a73d: fstat64(0x5, 0x7FFF5AC51550, 0x0) = 0 0 7262/0x1a73d: fstatfs64(0x5, 0x7FFF5AC50A60, 0x7FFF5AC514C0) = 0 0 7262/0x1a73d: read(0x5, "\004\374\002\374\003\0", 0x78) = 120 0 7262/0x1a73d: close(0x5) = 0 0 7262/0x1a73d: open("03\017\005\001\0", 0x0, 0x80000) = -1 Err#2 7262/0x1a73d: write_nocancel(0x2, "FTGL createFont failed: No such file or directory\n\0", 0x32) = 50 0
5af544f59fb8b0c2b645abc88891fd31-le64.cache-3
is an hexa files. opening it with an editor, I can read a path: /opt/local/share/fonts/X11/encodings/large
.
But it's hard to tell how different it is from other files in the fontconfig dir.
I see a similar problem on Ubuntu, and even after emptying 3 different cache dirs I get the following on the end of my strace:
open("/var/cache/fontconfig/5e10083637a12ecd1bff191eb66bfa2f-le64.cache-3", O_RDONLY) = -1 ENOENT (No such file or directory) open("/home/anton/.cache/fontconfig/5e10083637a12ecd1bff191eb66bfa2f-le64.cache-3", O_RDONLY) = 6 fstat(6, {st_mode=S_IFREG|0644, st_size=15112, ...}) = 0 close(6) = 0 stat("/usr/share/fonts/X11/encodings/large", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0 open("/usr/share/fonts/X11/encodings/large", O_RDONLY) = 6 fstatfs(6, {f_type="EXT2_SUPER_MAGIC", f_bsize=4096, f_blocks=37389899, f_bfree=4331237, f_bavail=2431922, f_files=9502720, f_ffree=8716484, f_fsid={955066179, -27181392}, f_namelen=255, f_frsize=4096}) = 0 close(6) = 0 open("/var/cache/fontconfig/6333f38776742d18e214673cd2c24e34-le64.cache-3", O_RDONLY) = -1 ENOENT (No such file or directory) open("/home/anton/.cache/fontconfig/6333f38776742d18e214673cd2c24e34-le64.cache-3", O_RDONLY) = 6 fstat(6, {st_mode=S_IFREG|0644, st_size=112, ...}) = 0 fstatfs(6, {f_type="EXT2_SUPER_MAGIC", f_bsize=4096, f_blocks=37389899, f_bfree=4331237, f_bavail=2431922, f_files=9502720, f_ffree=8716484, f_fsid={955066179, -27181392}, f_namelen=255, f_frsize=4096}) = 0 read(6, "\4\374\2\374\3\0\0\0p\0\0\0\0\0\0\0008\0\0\0\0\0\0\0
\0\0\0\0\0\0\0"..., 112) = 112
close(6) = 0
open("0\v\204", O_RDONLY) = -1 ENOENT (No such file or directory)
write(2, "FTGL createFont failed: No such "..., 50FTGL createFont failed: No such file or directory
) = 50
exit_group(1)`
I have the same issue, on Debian jessie (testing). gcodeview used to work, but some recent update has broken it.
I managed to work around the issue by directly specifying the name of an existing TTF file:
--- main.c~ 2013-07-11 13:47:55.546686704 +0200
+++ main.c 2013-07-11 13:56:01.334669522 +0200
@@ -1043,3 +1043,3 @@
- font = ftglCreateExtrudeFont(file);
+ font = ftglCreateExtrudeFont("/usr/share/fonts/truetype/dejavu/DejaVuSansMono.ttf");
if (!font)
It's not pretty, but it works.