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

How can I install afdko on Cygwin? #748

Closed
KazunariTsuboi opened this issue Mar 1, 2019 · 11 comments
Closed

How can I install afdko on Cygwin? #748

KazunariTsuboi opened this issue Mar 1, 2019 · 11 comments
Assignees

Comments

@KazunariTsuboi
Copy link

I am using cygwin. Attempting to install afdko using pip faced the following error. I hope to be able to use afdko on Cygwin. Is there anything I can do now?

$ pip install afdko
Collecting afdko
Downloading https://files.pythonhosted.org/packages/6e/03/8bef8634b242e311f347e5275355b565d912361629202a75abce58c4fd4f/afdko-2.8.5.ta
100% |████████████████████████████████| 13.2MB 225kB/s
Installing build dependencies ... done
Getting requirements to build wheel ... error
Complete output from command /home/Ktsuboi/psautohint_build/bin/python3 /home/Ktsuboi/psautohint_build/lib/python3.6/site-packages/pi
Traceback (most recent call last):
File "/home/Ktsuboi/psautohint_build/lib/python3.6/site-packages/pip/_vendor/pep517/_in_process.py", line 207, in
main()
File "/home/Ktsuboi/psautohint_build/lib/python3.6/site-packages/pip/_vendor/pep517/_in_process.py", line 197, in main
json_out['return_val'] = hook(**hook_input['kwargs'])
File "/home/Ktsuboi/psautohint_build/lib/python3.6/site-packages/pip/_vendor/pep517/_in_process.py", line 54, in get_requires_for_b
return hook(config_settings)
File "/tmp/pip-build-env-69yed0rn/overlay/lib/python3.6/site-packages/setuptools/build_meta.py", line 130, in get_requires_for_buil
return self._get_build_requires(config_settings, requirements=['wheel'])
File "/tmp/pip-build-env-69yed0rn/overlay/lib/python3.6/site-packages/setuptools/build_meta.py", line 112, in _get_build_requires
self.run_setup()
File "/tmp/pip-build-env-69yed0rn/overlay/lib/python3.6/site-packages/setuptools/build_meta.py", line 211, in run_setup
self).run_setup(setup_script=setup_script)
File "/tmp/pip-build-env-69yed0rn/overlay/lib/python3.6/site-packages/setuptools/build_meta.py", line 126, in run_setup
exec(compile(code, file, 'exec'), locals())
File "setup.py", line 274, in
main()
File "setup.py", line 212, in main
"afdko: Do not recognize target OS: {}".format(platform_system))
KeyError: 'afdko: Do not recognize target OS: CYGWIN_NT-10.0'


Command "/home/Ktsuboi/psautohint_build/bin/python3 /home/Ktsuboi/psautohint_build/lib/python3.6/site-packages/pip/_vendor/pep517/_in_pme6tqbxc/afdko

@KazunariTsuboi KazunariTsuboi changed the title How can I install afdko with cygwin? How can I install afdko on Cygwin? Mar 1, 2019
@miguelsousa
Copy link
Member

miguelsousa commented Mar 1, 2019

The process is getting caught here https://github.com/adobe-type-tools/afdko/blob/develop/setup.py#L212

I'll make some changes to setup.py.

Out of curiosity, what's the result of this Python snippet on your system?
Nevermind. I see it in the original post: CYGWIN_NT-10.0

import platform
print(platform.system())

miguelsousa added a commit that referenced this issue Mar 1, 2019
@miguelsousa
Copy link
Member

@dadasutasudadas I've issued a new pre-release build. Try again in 30 minutes using this command:

pip install -U afdko --pre

@KazunariTsuboi
Copy link
Author

@miguelsousa Thank you!
I just tried "pip install - U afdko -- pre" Unfortunately the following error appears.

(*fileNameList)[i] = (Byte8 *)memNew((entp->d_namlen + 1) * sizeof(Byte8));
^~~~~~~~
d_name
make: *** [Makefile:85: Dsys.o] エラー 1
afdko: Unknown OS: CYGWIN_NT-10.0
afdko: Error executing build command.


Failed building wheel for afdko
Running setup.py clean for afdko
Failed to build afdko
Could not build wheels for afdko which use PEP 517 and cannot be installed directly

@cjchapman
Copy link
Contributor

This is the block where the error is occurring:

#else
#ifdef __linux__
#define d_namlen d_reclen
#endif
int i;
DIR *thedir;
struct dirent *entp;
if ((dirName == NULL) || (dirName[0] == '\0')) return 0;
if ((thedir = opendir(dirName)) == NULL) {
printf("Cannot read contents of directory: %s.\n", dirName);
quit(2);
}
fileCnt = 0;
for (entp = readdir(thedir); entp != NULL; entp = readdir(thedir)) {
if (entp->d_name[0] == '.') continue;
fileCnt++;
}
*fileNameList = (Byte8 **)memNew((fileCnt + 1) * sizeof(Byte8 *));
rewinddir(thedir);
i = 0;
for (entp = readdir(thedir); entp != NULL; entp = readdir(thedir)) {
if (entp->d_name[0] == '.') continue;
(*fileNameList)[i] = (Byte8 *)memNew((entp->d_namlen + 1) * sizeof(Byte8));
strcpy((*fileNameList)[i], entp->d_name);
i++;
}
closedir(thedir);
#endif

The d_name part of the error message makes me think it's this line in particular (which is the line before the one shown in the error message):
if (entp->d_name[0] == '.') continue;

@miguelsousa
Copy link
Member

@dadasutasudadas I'll look into this next week. Need to install Cygwin first to check which afdko's C tools can be compiled on that platform, if any.

@KazunariTsuboi
Copy link
Author

KazunariTsuboi commented Mar 4, 2019

Thank you. I tried doing things that I can do in my environment so I will report it.
The C tool which could not be built seems to be sfntdiff only. Other detype1.exe, makeotfexe.exe, mergefonts.exe, rotatefont.exe, sfntedit.exe, spot.exe, tx.exe, type1.exe successfully compiled.
It seems to be related to "d_reclen" used in Dsys.c can not be used in Cygwin.

@miguelsousa
Copy link
Member

The error that happens when trying to compile sfntdiff is this:

../../../../source/Dsys.c: In function ‘sysReadInputDir’:
../../../../source/Dsys.c:245:53: error: ‘struct dirent’ has no member named ‘d_namlen’; did you mean ‘d_name’?
         (*fileNameList)[i] = (Byte8 *)memNew((entp->d_namlen + 1) * sizeof(Byte8));
                                                     ^~~~~~~~
                                                     d_name

Following the suggestion of renaming d_namlen to d_name leads to a different error.

@cjchapman
Copy link
Contributor

@miguelsousa A work-around for this problem is described in this issue: rakshasa/rtorrent#163

miguelsousa added a commit that referenced this issue Mar 4, 2019
miguelsousa added a commit that referenced this issue Mar 4, 2019
@miguelsousa
Copy link
Member

@dadasutasudadas I've pushed a fix for the sfntdiff problem and issued a new pre-release build.
Please give it another try using:

pip install -U afdko --pre

@KazunariTsuboi
Copy link
Author

@miguelsousa Installation was completed successfully. I'm really happy. Thank you so much!

@miguelsousa
Copy link
Member

Good to know. Thanks for your report.

miguelsousa added a commit that referenced this issue Mar 4, 2019
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

3 participants