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

[makeotfexe] 4.0.2 fails on Linux #1761

Open
takaakifuji opened this issue Nov 15, 2024 · 15 comments
Open

[makeotfexe] 4.0.2 fails on Linux #1761

takaakifuji opened this issue Nov 15, 2024 · 15 comments

Comments

@takaakifuji
Copy link

MakeOTF causes the following error on the GitHub Actions runner, which runs Ubuntu 20.04.6 LTS and CPython 3.12.7:

$ git clone 'https://github.com/adobe-fonts/adobe-blank.git' && cd adobe-blank && source COMMANDS.txt
makeotf [Warning] Did not recognize the ordering 'Identity'. The Mac cmap script id will be set to Roman (0).
makeotf [Warning] the feature file does not contain a 'vert' feature features.
makeotf [Warning] Could not find an Adobe CMAP Mac encoding mapping file. If you want a Mac cmap subtable, please specify the Mac CMAP encoding file with the '-cm' option.
makeotf [Warning] Could not find a Unicode Variation Sequence file in the expected '/home/ubuntu/.pyenv/versions/orcatools-3.12.7/lib/python3.12/site-packages/afdko/resources' subdirectory.
makeotf [Note] setting the USE_TYPO_METRICS OS/2 fsSelection bit 7 from fontinfo keyword.
makeotf [Note] setting the WEIGHT_WIDTH_SLOPE_ONLY OS/2 fsSelection bit 8 from fontinfo keyword.
makeotf [Note] setting the OBLIQUE OS/2 fsSelection bit 9 from fontinfo keyword.
makeotfexe processing font <AdobeBlank>
WARNING: cmap{plat=3,script=1,lang=0}: cmap format 4 subtable was truncated to 2 segments, due to overflow with non-truncated version
WARNING: cmap{plat=1,script=0,lang=0}: empty encoding
WARNING: Macintosh Adobe CMap not seen
WARNING: Unicode variation Selector File not seen
terminate called after throwing an instance of 'std::system_error'
  what():  Unknown error -1
Error executing command 'makeotfexe -f /tmp/tmpfb7gpzv7 -o /home/ubuntu/adobe-blank/AdobeBlank.otf -omitMacNames -ff /home/ubuntu/adobe-blank/features -mf /home/ubuntu/adobe-blank/FontMenuNameDB -r -stubCmap4 -ch /home/ubuntu/adobe-blank/UnicodeAll-UTF32-H -lic ADOBE'
makeotf [Error] Failed to build output font file '/home/ubuntu/adobe-blank/AdobeBlank.otf'.
sfntedit [FATAL]: file error <No such file or directory> [AdobeBlank.otf]
sfntedit [FATAL]: file error <No such file or directory> [AdobeBlank.otf]
sfntedit [FATAL]: file error <No such file or directory> [AdobeBlank.otf]

After a bit of googling, I put the following line in the middle of CMakeLists.txt to link libpthread to each C/C++ executable:

...

set(CMAKE_CXX_STANDARD 11)

link_libraries(pthread)

# scikit-build

...

Then I built and installed AFDKO from the source and tried building Adobe Blank again:

$ cd adobe-blank && source COMMANDS.txt
makeotf [Warning] Did not recognize the ordering 'Identity'. The Mac cmap script id will be set to Roman (0).
makeotf [Warning] the feature file does not contain a 'vert' feature features.
makeotf [Warning] Could not find an Adobe CMAP Mac encoding mapping file. If you want a Mac cmap subtable, please specify the Mac CMAP encoding file with the '-cm' option.
makeotf [Warning] Could not find a Unicode Variation Sequence file in the expected '/home/ubuntu/.pyenv/versions/orcatools-3.12.7/lib/python3.12/site-packages/afdko/resources' subdirectory.
makeotf [Note] setting the USE_TYPO_METRICS OS/2 fsSelection bit 7 from fontinfo keyword.
makeotf [Note] setting the WEIGHT_WIDTH_SLOPE_ONLY OS/2 fsSelection bit 8 from fontinfo keyword.
makeotf [Note] setting the OBLIQUE OS/2 fsSelection bit 9 from fontinfo keyword.
makeotfexe processing font <AdobeBlank>
WARNING: cmap{plat=3,script=1,lang=0}: cmap format 4 subtable was truncated to 2 segments, due to overflow with non-truncated version
WARNING: cmap{plat=1,script=0,lang=0}: empty encoding
WARNING: Macintosh Adobe CMap not seen
WARNING: Unicode variation Selector File not seen
Built release mode font '/home/ubuntu/adobe-blank/AdobeBlank.otf' Revision 1.045

This time it worked. Downgrading AFDKO to 4.0.1 did work for me as well.

Looks to me 4.0.2 needs some fix for Linux but I would be happy if you could reproduce this.

@takaakifuji takaakifuji changed the title [makeoffexe] 4.0.2 fails on Linux [makeotfexe] 4.0.2 fails on Linux Nov 15, 2024
@skef
Copy link
Collaborator

skef commented Nov 15, 2024

I can reproduce the error when installing our "manylinux" wheel on Arch Linux. When I build and install from source makeotfexe works fine without any cmake configuration changes.

Did you first try building from source without any changes? And can you verify whether when you installed the first time and hit the problem that our manylinux wheel was what was used?

@skef
Copy link
Collaborator

skef commented Nov 15, 2024

I suspect we may be having these problems: https://stackoverflow.com/questions/65335620/terminate-called-after-throwing-an-instance-of-stdsystem-error , with the issue being that the manylinux wheel is statically linking and the "normal" build is dynamically linking.

@takaakifuji
Copy link
Author

Thank you for your response!

Did you first try building from source without any changes? And can you verify whether when you installed the first time and hit the problem that our manylinux wheel was what was used?

Yes. Running pip install afdko on the GitHub Actions runner did download afdko-4.0.2-py3-none-manylinux_2_28_x86_64.whl from the PyPI server and that did caused the issue on Ubuntu 20.04.6 LTS. I don't have an x86_64 device at hand so instead I launched the arm64 version of Ubuntu 20.04.6 and run pip install afdko, which causes the AFDKO build from the source and the font compilation ended up with the same error.

I'm not familiar with the C++ portion of the AFDKO codebase but I've read that libstdc++ includes weak symbols for pthread functions and -pthread or -lpthread should be passed to make it run.

@skef
Copy link
Collaborator

skef commented Nov 15, 2024

I don't have an x86_64 device at hand so instead I launched the arm64 version of Ubuntu 20.04.6 and run pip install afdko, which causes the AFDKO build from the source and the font compilation ended up with the same error.

OK, but did you build using the copy of the repository you downloaded on arm64 but without the change you made?

We build, use, and test AFDKO routinely on Linux so I'm skeptical that we have a "generic" build problem there. It's much more plausible that there's a problem with the particular way we build the manylinux wheel.

I'm not familiar with the C++ portion of the AFDKO codebase but I've read that libstdc++ includes weak symbols for pthread functions and -pthread or -lpthread should be passed to make it run.

From the link above:

Note that in the modern world using -lpthread is neither necessary nor sufficient.

And I'm reluctant to add -pthread because makeotfexe is (probably?) not thread safe. None of our C programs are written to be thread safe.

What's probably going on here is that the ANTLR4 runtime is trying to check if it can use threads and finding the interfaces because it's statically linked and the pthread symbols are only used as a side-effect, so they aren't included in the linking.

@takaakifuji
Copy link
Author

https://github.com/takaakifuji/test-blank/actions/runs/11859864502/job/33053812247

For reference, here's the log that illustrates how it fails on the x86_64 runner.

OK, but did you build using the copy of the repository you downloaded on arm64 but without the change you made?

Yep, on the arm64 environment at first I just run pip install afdko to set up the latest AFDKO and it didn't compile the font. Then I cloned the AFDKO repository and run pip install -U . but it didn't work either.

I assumed too it's somehow related to the recent ANTLR change because 4.0.1 seemed to work just fine, but again I'm not familiar with how the native binaries in AFDKO are configured and compiled, so I just wanted to let you know it didn't work for me on the GitHub Actions runner.

@skef
Copy link
Collaborator

skef commented Nov 15, 2024

Yep, on the arm64 environment at first I just run pip install afdko to set up the latest AFDKO and it didn't compile the font. Then I cloned the AFDKO repository and run pip install -U . but it didn't work either.

And it didn't work with the exact same error messages?

@skef
Copy link
Collaborator

skef commented Nov 15, 2024

I'm just trying to piece this together. You're saying you built the repo for Linux on ARM and it didn't work, and then you added some pthread-related stuff to the cmake config and it worked. We build for Linux on x86 without the pthread stuff and test routinely. This is the ci build for the current repo + some test code for buildwheels that isn't activated:

https://github.com/adobe-type-tools/afdko/actions/runs/11859993613

Before I pushed those changes I built the current repo on Arch Linux this morning and confirmed that I could build adobe-clean with the result. I use Linux more than any other system for my own work. There's definitely a problem with the wheel -- I confirmed it -- but you're basically saying makeotfexe doesn't currently work on Linux at all without cmake changes and that's just entirely against our own experience.

@takaakifuji
Copy link
Author

And it didn't work with the exact same error messages?

True. The following is the raw log I got when I tried to build the font on the arm64/aarch64 Ubuntu:

(afdko-3.12.7) ubuntu@agreeable-tunny:~/test-blank$ pip install afdko
Collecting afdko
  Downloading afdko-4.0.2.tar.gz (17.8 MB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 17.8/17.8 MB 8.0 MB/s eta 0:00:00
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
  Preparing metadata (pyproject.toml) ... done
Collecting lxml>=4.9.3 (from afdko)
  Downloading lxml-5.3.0-cp312-cp312-manylinux_2_28_aarch64.whl.metadata (3.8 kB)
Collecting booleanOperations>=0.9.0 (from afdko)
  Downloading booleanOperations-0.9.0-py3-none-any.whl.metadata (5.8 kB)
Collecting defcon>=0.10.3 (from defcon[lxml,pens]>=0.10.3->afdko)
  Downloading defcon-0.10.3-py3-none-any.whl.metadata (3.5 kB)
Collecting fontMath>=0.9.3 (from afdko)
  Downloading fontMath-0.9.4-py2.py3-none-any.whl.metadata (789 bytes)
Collecting fontTools>=4.43.0 (from fontTools[lxml,ufo,unicode,woff]>=4.43.0->afdko)
  Downloading fonttools-4.55.0-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.metadata (164 kB)
Collecting tqdm>=4.66.1 (from afdko)
  Downloading tqdm-4.67.0-py3-none-any.whl.metadata (57 kB)
Collecting ufonormalizer>=0.6.1 (from afdko)
  Downloading ufonormalizer-0.6.2-py3-none-any.whl.metadata (954 bytes)
Collecting ufoProcessor>=1.9.0 (from afdko)
  Downloading ufoProcessor-1.13.2-py2.py3-none-any.whl.metadata (5.5 kB)
Collecting pyclipper>=1.1.0.post1 (from booleanOperations>=0.9.0->afdko)
  Downloading pyclipper-1.3.0.post6-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.metadata (9.0 kB)
Collecting fontPens>=0.1.0 (from defcon[lxml,pens]>=0.10.3->afdko)
  Downloading fontPens-0.2.4-py2.py3-none-any.whl.metadata (1.6 kB)
Collecting fs<3,>=2.2.0 (from fontTools[lxml,ufo,unicode,woff]>=4.43.0->afdko)
  Downloading fs-2.4.16-py2.py3-none-any.whl.metadata (6.3 kB)
Collecting unicodedata2>=15.1.0 (from fontTools[lxml,ufo,unicode,woff]>=4.43.0->afdko)
  Downloading unicodedata2-15.1.0.tar.gz (592 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 592.9/592.9 kB 6.4 MB/s eta 0:00:00
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
  Preparing metadata (pyproject.toml) ... done
Collecting zopfli>=0.1.4 (from fontTools[lxml,ufo,unicode,woff]>=4.43.0->afdko)
  Downloading zopfli-0.2.3.post1-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.metadata (2.9 kB)
Collecting brotli>=1.0.1 (from fontTools[lxml,ufo,unicode,woff]>=4.43.0->afdko)
  Downloading Brotli-1.1.0-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.metadata (5.5 kB)
Collecting fontParts>=0.8.2 (from ufoProcessor>=1.9.0->afdko)
  Downloading fontParts-0.12.3-py3-none-any.whl.metadata (5.6 kB)
Collecting mutatorMath>=2.1.2 (from ufoProcessor>=1.9.0->afdko)
  Downloading MutatorMath-3.0.1-py2.py3-none-any.whl.metadata (10 kB)
Collecting appdirs~=1.4.3 (from fs<3,>=2.2.0->fontTools[lxml,ufo,unicode,woff]>=4.43.0->afdko)
  Downloading appdirs-1.4.4-py2.py3-none-any.whl.metadata (9.0 kB)
Collecting setuptools (from fs<3,>=2.2.0->fontTools[lxml,ufo,unicode,woff]>=4.43.0->afdko)
  Using cached setuptools-75.5.0-py3-none-any.whl.metadata (6.8 kB)
Collecting six~=1.10 (from fs<3,>=2.2.0->fontTools[lxml,ufo,unicode,woff]>=4.43.0->afdko)
  Downloading six-1.16.0-py2.py3-none-any.whl.metadata (1.8 kB)
Downloading booleanOperations-0.9.0-py3-none-any.whl (18 kB)
Downloading defcon-0.10.3-py3-none-any.whl (231 kB)
Downloading fontMath-0.9.4-py2.py3-none-any.whl (32 kB)
Downloading fonttools-4.55.0-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (4.8 MB)
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 4.8/4.8 MB 4.9 MB/s eta 0:00:00
Downloading lxml-5.3.0-cp312-cp312-manylinux_2_28_aarch64.whl (4.7 MB)
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 4.7/4.7 MB 7.6 MB/s eta 0:00:00
Downloading tqdm-4.67.0-py3-none-any.whl (78 kB)
Downloading ufonormalizer-0.6.2-py3-none-any.whl (16 kB)
Downloading ufoProcessor-1.13.2-py2.py3-none-any.whl (36 kB)
Downloading Brotli-1.1.0-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (2.9 MB)
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 2.9/2.9 MB 5.9 MB/s eta 0:00:00
Downloading fontParts-0.12.3-py3-none-any.whl (165 kB)
Downloading fontPens-0.2.4-py2.py3-none-any.whl (19 kB)
Downloading fs-2.4.16-py2.py3-none-any.whl (135 kB)
Downloading MutatorMath-3.0.1-py2.py3-none-any.whl (31 kB)
Downloading pyclipper-1.3.0.post6-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (944 kB)
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 944.2/944.2 kB 6.3 MB/s eta 0:00:00
Downloading zopfli-0.2.3.post1-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (826 kB)
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 826.6/826.6 kB 8.0 MB/s eta 0:00:00
Downloading appdirs-1.4.4-py2.py3-none-any.whl (9.6 kB)
Downloading six-1.16.0-py2.py3-none-any.whl (11 kB)
Using cached setuptools-75.5.0-py3-none-any.whl (1.2 MB)
Building wheels for collected packages: afdko, unicodedata2
  Building wheel for afdko (pyproject.toml) ... done
  Created wheel for afdko: filename=afdko-4.0.2-py3-none-linux_aarch64.whl size=3421102 sha256=0adefc012f9c0f90c25f3166cb0b7f3a8450a7059b1890737ebb27f5002961b9
  Stored in directory: /home/ubuntu/.cache/pip/wheels/a0/53/79/ea617dd8b4553531cab27e2d83e6d01f49779d544cef4e2466
  Building wheel for unicodedata2 (pyproject.toml) ... done
  Created wheel for unicodedata2: filename=unicodedata2-15.1.0-cp312-cp312-linux_aarch64.whl size=480876 sha256=176773b353aed14c3bf38fea348c068cee421e85ca317f91d63f14cf10b3ca1a
  Stored in directory: /home/ubuntu/.cache/pip/wheels/e3/a6/8a/a78508763f2860e35f4c90b45a3707234f964a5d9779a5722c
Successfully built afdko unicodedata2
Installing collected packages: unicodedata2, pyclipper, brotli, appdirs, zopfli, ufonormalizer, tqdm, six, setuptools, lxml, fontTools, fs, fontPens, fontMath, booleanOperations, defcon, mutatorMath, fontParts, ufoProcessor, afdko
Successfully installed afdko-4.0.2 appdirs-1.4.4 booleanOperations-0.9.0 brotli-1.1.0 defcon-0.10.3 fontMath-0.9.4 fontParts-0.12.3 fontPens-0.2.4 fontTools-4.55.0 fs-2.4.16 lxml-5.3.0 mutatorMath-3.0.1 pyclipper-1.3.0.post6 setuptools-75.5.0 six-1.16.0 tqdm-4.67.0 ufoProcessor-1.13.2 ufonormalizer-0.6.2 unicodedata2-15.1.0 zopfli-0.2.3.post1

[notice] A new release of pip is available: 24.2 -> 24.3.1
[notice] To update, run: python -m pip install --upgrade pip
(afdko-3.12.7) ubuntu@agreeable-tunny:~/test-blank$ ls
AdobeBlank.b64.txt  AdobeBlank.otf       AdobeBlank.ttf       COMMANDS.txt  FontMenuNameDB  Makefile   UnicodeAll-UTF32-H  cidfont.ps   features
AdobeBlank.eot      AdobeBlank.otf.woff  AdobeBlank.ttf.woff  DSIG.bin      LICENSE.txt     README.md  adobe-blank.css     cidfontinfo  requirements.txt
(afdko-3.12.7) ubuntu@agreeable-tunny:~/test-blank$ make
/bin/sh COMMANDS.txt
makeotf [Warning] Did not recognize the ordering 'Identity'. The Mac cmap script id will be set to Roman (0).
makeotf [Warning] the feature file does not contain a 'vert' feature features.
makeotf [Warning] Could not find an Adobe CMAP Mac encoding mapping file. If you want a Mac cmap subtable, please specify the Mac CMAP encoding file with the '-cm' option.
makeotf [Warning] Could not find a Unicode Variation Sequence file in the expected '/home/ubuntu/.pyenv/versions/3.12.7/envs/afdko-3.12.7/lib/python3.12/site-packages/afdko/resources' subdirectory.
makeotf [Note] setting the USE_TYPO_METRICS OS/2 fsSelection bit 7 from fontinfo keyword.
makeotf [Note] setting the WEIGHT_WIDTH_SLOPE_ONLY OS/2 fsSelection bit 8 from fontinfo keyword.
makeotf [Note] setting the OBLIQUE OS/2 fsSelection bit 9 from fontinfo keyword.
makeotfexe processing font <AdobeBlank>
WARNING: cmap{plat=3,script=1,lang=0}: cmap format 4 subtable was truncated to 2 segments, due to overflow with non-truncated version
WARNING: cmap{plat=1,script=0,lang=0}: empty encoding
WARNING: Macintosh Adobe CMap not seen
WARNING: Unicode variation Selector File not seen
terminate called after throwing an instance of 'std::system_error'
  what():  Unknown error -1
Error executing command 'makeotfexe -f /tmp/tmpjw9h1o14 -o /home/ubuntu/test-blank/AdobeBlank.otf -omitMacNames -ff /home/ubuntu/test-blank/features -mf /home/ubuntu/test-blank/FontMenuNameDB -r -stubCmap4 -ch /home/ubuntu/test-blank/UnicodeAll-UTF32-H -lic ADOBE'
makeotf [Error] Failed to build output font file '/home/ubuntu/test-blank/AdobeBlank.otf'.
sfntedit [FATAL]: file error <No such file or directory> [AdobeBlank.otf]
sfntedit [FATAL]: file error <No such file or directory> [AdobeBlank.otf]
sfntedit [FATAL]: file error <No such file or directory> [AdobeBlank.otf]
make: *** [Makefile:3: all] Error 1
(afdko-3.12.7) ubuntu@agreeable-tunny:~/test-blank$ python --version
Python 3.12.7
(afdko-3.12.7) ubuntu@agreeable-tunny:~/test-blank$ uname -a
Linux agreeable-tunny 5.4.0-200-generic #220-Ubuntu SMP Fri Sep 27 13:21:29 UTC 2024 aarch64 aarch64 aarch64 GNU/Linux

Here's what I experienced so far:

a. The manylinux x86_64 wheel doesn't build the font on the GitHub Actions runner
b. 4.0.2 installed with pip on arm64/aarch64 Ubuntu doesn't build the font either

I mainly use GitHub Actions for building fonts so b. is not that important for me. I'll test later if 4.0.2 built from the source works fine on the GitHub Actions runner.

@takaakifuji
Copy link
Author

I made sure to install 4.0.2 from the source on the x86_64 runner but it didn't work somehow while 4.0.1 worked. Am I doing it wrong? It's getting very puzzling.

@skef
Copy link
Collaborator

skef commented Nov 15, 2024

Ah, OK, that's helpful! When I pip-install on Arch x86 it looks like this:

[skef@didactic afdko2]$ PYTHONPATH=/home/skef/py/lib/python3.12/site-packages:$PYTHONPATH PATH=~/py/bin:$PATH pip install .
Processing /home/skef/src/afdko2
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
  Preparing metadata (pyproject.toml) ... done
Requirement already satisfied: lxml>=4.9.3 in /home/skef/py/lib/python3.12/site-packages (from afdko==4.0.3.dev1+g7b1212b9) (4.9.4)
Requirement already satisfied: booleanOperations>=0.9.0 in /home/skef/py/lib/python3.12/site-packages (from afdko==4.0.3.dev1+g7b1212b9) (0.9.0)
Requirement already satisfied: defcon>=0.10.3 in /home/skef/py/lib/python3.12/site-packages (from defcon[lxml,pens]>=0.10.3->afdko==4.0.3.dev1+g7b1212b9) (0.10.3)
Requirement already satisfied: fontMath>=0.9.3 in /home/skef/py/lib/python3.12/site-packages (from afdko==4.0.3.dev1+g7b1212b9) (0.9.3)
Requirement already satisfied: fontTools>=4.43.0 in /home/skef/py/lib/python3.12/site-packages (from fontTools[lxml,ufo,unicode,woff]>=4.43.0->afdko==4.0.3.dev1+g7b1212b9) (4.51.0)
Requirement already satisfied: tqdm>=4.66.1 in /home/skef/py/lib/python3.12/site-packages (from afdko==4.0.3.dev1+g7b1212b9) (4.66.4)
Requirement already satisfied: ufonormalizer>=0.6.1 in /home/skef/py/lib/python3.12/site-packages (from afdko==4.0.3.dev1+g7b1212b9) (0.6.1)
Requirement already satisfied: ufoProcessor>=1.9.0 in /home/skef/py/lib/python3.12/site-packages (from afdko==4.0.3.dev1+g7b1212b9) (1.9.0)
Requirement already satisfied: pyclipper>=1.1.0.post1 in /home/skef/py/lib/python3.12/site-packages (from booleanOperations>=0.9.0->afdko==4.0.3.dev1+g7b1212b9) (1.3.0.post5)
Requirement already satisfied: fontPens>=0.1.0 in /home/skef/py/lib/python3.12/site-packages (from defcon[lxml,pens]>=0.10.3->afdko==4.0.3.dev1+g7b1212b9) (0.2.4)
Requirement already satisfied: fs<3,>=2.2.0 in /home/skef/py/lib/python3.12/site-packages (from fontTools[lxml,ufo,unicode,woff]>=4.43.0->afdko==4.0.3.dev1+g7b1212b9) (2.4.16)
Requirement already satisfied: unicodedata2>=15.1.0 in /home/skef/py/lib/python3.12/site-packages (from fontTools[lxml,ufo,unicode,woff]>=4.43.0->afdko==4.0.3.dev1+g7b1212b9) (15.1.0)
Requirement already satisfied: zopfli>=0.1.4 in /home/skef/py/lib/python3.12/site-packages (from fontTools[lxml,ufo,unicode,woff]>=4.43.0->afdko==4.0.3.dev1+g7b1212b9) (0.2.3)
Requirement already satisfied: brotli>=1.0.1 in /home/skef/py/lib/python3.12/site-packages (from fontTools[lxml,ufo,unicode,woff]>=4.43.0->afdko==4.0.3.dev1+g7b1212b9) (1.1.0)
Requirement already satisfied: fontParts>=0.8.2 in /home/skef/py/lib/python3.12/site-packages (from ufoProcessor>=1.9.0->afdko==4.0.3.dev1+g7b1212b9) (0.12.1)
Requirement already satisfied: mutatorMath>=2.1.2 in /home/skef/py/lib/python3.12/site-packages (from ufoProcessor>=1.9.0->afdko==4.0.3.dev1+g7b1212b9) (3.0.1)
Requirement already satisfied: appdirs~=1.4.3 in /home/skef/py/lib/python3.12/site-packages (from fs<3,>=2.2.0->fontTools[lxml,ufo,unicode,woff]>=4.43.0->afdko==4.0.3.dev1+g7b1212b9) (1.4.4)
Requirement already satisfied: setuptools in /home/skef/py/lib/python3.12/site-packages (from fs<3,>=2.2.0->fontTools[lxml,ufo,unicode,woff]>=4.43.0->afdko==4.0.3.dev1+g7b1212b9) (69.5.1)
Requirement already satisfied: six~=1.10 in /home/skef/py/lib/python3.12/site-packages (from fs<3,>=2.2.0->fontTools[lxml,ufo,unicode,woff]>=4.43.0->afdko==4.0.3.dev1+g7b1212b9) (1.16.0)
Building wheels for collected packages: afdko
  Building wheel for afdko (pyproject.toml) ... done
  Created wheel for afdko: filename=afdko-4.0.3.dev1+g7b1212b9-py3-none-linux_x86_64.whl size=3587184 sha256=6f291ddba61c74e4608ade33a15692de595a597f6978c1299706fc213bdb21f4
  Stored in directory: /tmp/pip-ephem-wheel-cache-9n2ba511/wheels/a1/4c/9b/1d3322150e7f801f80f029c1726dd641caa83ba3951bf43db0
Successfully built afdko
Installing collected packages: afdko
  Attempting uninstall: afdko
    Found existing installation: afdko 4.0.3.dev1+g7b1212b9
    Not uninstalling afdko at /home/skef/src/afdko2, outside environment /home/skef/py
    Can't uninstall 'afdko'. No files were found to uninstall.
Successfully installed afdko-4.0.3.dev1+g7b1212b9

Notice no "manylinux" stuff. In effect it looks like (for whatever reason) your environment is trying to build a "generic" wheel with the manylinux infrastructure when using pip.

If you get a chance, I'd like to confirm by seeing the ldd output on makeotfexe. (Basically, find the binary directory where makeotfexe is being installed and run ldd makeotfexe on it.

@takaakifuji
Copy link
Author

Thank you for your assistance.

(afdko-3.12.7) ubuntu@agreeable-tunny:~$ ldd ~/.pyenv/versions/afdko-3.12.7/bin/makeotfexe
linux-vdso.so.1 (0x0000ffff9a573000)
libstdc++.so.6 => /lib/aarch64-linux-gnu/libstdc++.so.6 (0x0000ffff9a14d000)
libm.so.6 => /lib/aarch64-linux-gnu/libm.so.6 (0x0000ffff9a0a2000)
libgcc_s.so.1 => /lib/aarch64-linux-gnu/libgcc_s.so.1 (0x0000ffff9a07e000)
libc.so.6 => /lib/aarch64-linux-gnu/libc.so.6 (0x0000ffff99f0b000)
/lib/ld-linux-aarch64.so.1 (0x0000ffff9a543000)

(afdko-3.12.7) ubuntu@agreeable-tunny:~$ lddtree ~/.pyenv/versions/afdko-3.12.7/bin/makeotfexe
makeotfexe => /home/ubuntu/.pyenv/versions/afdko-3.12.7/bin/makeotfexe (interpreter => /lib/ld-linux-aarch64.so.1)
    libstdc++.so.6 => /lib/aarch64-linux-gnu/libstdc++.so.6
    libm.so.6 => /lib/aarch64-linux-gnu/libm.so.6
    libgcc_s.so.1 => /lib/aarch64-linux-gnu/libgcc_s.so.1
    libc.so.6 => /lib/aarch64-linux-gnu/libc.so.6
    ld-linux-aarch64.so.1 => /lib/ld-linux-aarch64.so.1

I realized I set up and build Python with pyenv. Maybe that's the difference?

@skef
Copy link
Collaborator

skef commented Nov 15, 2024

pyenv on its own shouldn't affect this. It could be an amd64 thing or it could be something to do with pip configuration.

For reference, this is what ldd looks like from the wheel installation on my box:

[notice] To update, run: pip install --upgrade pip
[skef@didactic afdko2]$ ldd ~/py/bin/makeotfexe
        linux-vdso.so.1 (0x00007b707c97d000)
        libstdc++.so.6 => /usr/lib/libstdc++.so.6 (0x00007b707c600000)
        libm.so.6 => /usr/lib/libm.so.6 (0x00007b707c511000)
        libgcc_s.so.1 => /usr/lib/libgcc_s.so.1 (0x00007b707c8f0000)
        libc.so.6 => /usr/lib/libc.so.6 (0x00007b707c320000)
        /lib64/ld-linux-x86-64.so.2 => /usr/lib64/ld-linux-x86-64.so.2 (0x00007b707c97f000)

And this is what it looks like when I pip-install from the sources:

[skef@didactic afdko2]$ ldd ~/py/bin/makeotfexe
        linux-vdso.so.1 (0x00007f6c18c1e000)
        libxml2.so.2 => /usr/lib/libxml2.so.2 (0x00007f6c18a72000)
        libstdc++.so.6 => /usr/lib/libstdc++.so.6 (0x00007f6c18400000)
        libm.so.6 => /usr/lib/libm.so.6 (0x00007f6c18711000)
        libgcc_s.so.1 => /usr/lib/libgcc_s.so.1 (0x00007f6c18a44000)
        libc.so.6 => /usr/lib/libc.so.6 (0x00007f6c1820f000)
        libz.so.1 => /usr/lib/libz.so.1 (0x00007f6c186f8000)
        liblzma.so.5 => /usr/lib/liblzma.so.5 (0x00007f6c186c5000)
        libicuuc.so.75 => /usr/lib/libicuuc.so.75 (0x00007f6c18015000)
        /lib64/ld-linux-x86-64.so.2 => /usr/lib64/ld-linux-x86-64.so.2 (0x00007f6c18c20000)
        libicudata.so.75 => /usr/lib/libicudata.so.75 (0x00007f6c16200000)

Basically, a lot more is dynamically linked in the second case, which probably explains the difference we're seeing.

I'll work on how to address this problem with static linking in a way that doesn't negatively affect our other builds.

@takaakifuji
Copy link
Author

I'm not 100% sure but I think the issue comes from the different libstdc++ versions we're using. I've found makeotfexe compiles the font without errors if I switch to 22.04 LTS (jammy) from 20.04 LTS (focal).

20.04 LTS (focal) comes with GCC 10 and 22.04 LTS (jammy) comes with GCC 12. The former has been released around 2020-04-11. ANTLR 4.13.1 calls std::call_once but according to the commit in a fork the older version of libstdc++ depends on pthread_once for its std::call_once implementation. The pthread dependency has been eliminated with the patch around 2020-11-03. So the pthread linkage matters depending on the libstdc++ version installed on the system, and I assume that's why it doesn't work on the ubuntu-20.04 runner and my aarch64/arm64 environment.

@skef
Copy link
Collaborator

skef commented Nov 15, 2024

Are you in a position to try version 4.0.3a1 in your github ci? I just released that alpha as a test for this problem.

@takaakifuji
Copy link
Author

Thank you for the fix!

4.0.3a1 worked both on the runner and my arm64/aarch64 environment.

The following is the log from my local arm64/aarch64 Ubuntu 20.04:

(afdko-3.12.7) ubuntu@agreeable-tunny:~$ pip install -U afdko==4.0.3a1
Collecting afdko==4.0.3a1
  Using cached afdko-4.0.3a1.tar.gz (17.8 MB)
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
  Preparing metadata (pyproject.toml) ... done
Requirement already satisfied: lxml>=4.9.3 in ./.pyenv/versions/3.12.7/envs/afdko-3.12.7/lib/python3.12/site-packages (from afdko==4.0.3a1) (5.3.0)
Requirement already satisfied: booleanOperations>=0.9.0 in ./.pyenv/versions/3.12.7/envs/afdko-3.12.7/lib/python3.12/site-packages (from afdko==4.0.3a1) (0.9.0)
Requirement already satisfied: defcon>=0.10.3 in ./.pyenv/versions/3.12.7/envs/afdko-3.12.7/lib/python3.12/site-packages (from defcon[lxml,pens]>=0.10.3->afdko==4.0.3a1) (0.10.3)
Requirement already satisfied: fontMath>=0.9.3 in ./.pyenv/versions/3.12.7/envs/afdko-3.12.7/lib/python3.12/site-packages (from afdko==4.0.3a1) (0.9.4)
Requirement already satisfied: fontTools>=4.43.0 in ./.pyenv/versions/3.12.7/envs/afdko-3.12.7/lib/python3.12/site-packages (from fontTools[lxml,ufo,unicode,woff]>=4.43.0->afdko==4.0.3a1) (4.55.0)
Requirement already satisfied: tqdm>=4.66.1 in ./.pyenv/versions/3.12.7/envs/afdko-3.12.7/lib/python3.12/site-packages (from afdko==4.0.3a1) (4.67.0)
Requirement already satisfied: ufonormalizer>=0.6.1 in ./.pyenv/versions/3.12.7/envs/afdko-3.12.7/lib/python3.12/site-packages (from afdko==4.0.3a1) (0.6.2)
Requirement already satisfied: ufoProcessor>=1.9.0 in ./.pyenv/versions/3.12.7/envs/afdko-3.12.7/lib/python3.12/site-packages (from afdko==4.0.3a1) (1.13.2)
Requirement already satisfied: pyclipper>=1.1.0.post1 in ./.pyenv/versions/3.12.7/envs/afdko-3.12.7/lib/python3.12/site-packages (from booleanOperations>=0.9.0->afdko==4.0.3a1) (1.3.0.post6)
Requirement already satisfied: fontPens>=0.1.0 in ./.pyenv/versions/3.12.7/envs/afdko-3.12.7/lib/python3.12/site-packages (from defcon[lxml,pens]>=0.10.3->afdko==4.0.3a1) (0.2.4)
Requirement already satisfied: fs<3,>=2.2.0 in ./.pyenv/versions/3.12.7/envs/afdko-3.12.7/lib/python3.12/site-packages (from fontTools[lxml,ufo,unicode,woff]>=4.43.0->afdko==4.0.3a1) (2.4.16)
Requirement already satisfied: unicodedata2>=15.1.0 in ./.pyenv/versions/3.12.7/envs/afdko-3.12.7/lib/python3.12/site-packages (from fontTools[lxml,ufo,unicode,woff]>=4.43.0->afdko==4.0.3a1) (15.1.0)
Requirement already satisfied: zopfli>=0.1.4 in ./.pyenv/versions/3.12.7/envs/afdko-3.12.7/lib/python3.12/site-packages (from fontTools[lxml,ufo,unicode,woff]>=4.43.0->afdko==4.0.3a1) (0.2.3.post1)
Requirement already satisfied: brotli>=1.0.1 in ./.pyenv/versions/3.12.7/envs/afdko-3.12.7/lib/python3.12/site-packages (from fontTools[lxml,ufo,unicode,woff]>=4.43.0->afdko==4.0.3a1) (1.1.0)
Requirement already satisfied: fontParts>=0.8.2 in ./.pyenv/versions/3.12.7/envs/afdko-3.12.7/lib/python3.12/site-packages (from ufoProcessor>=1.9.0->afdko==4.0.3a1) (0.12.3)
Requirement already satisfied: mutatorMath>=2.1.2 in ./.pyenv/versions/3.12.7/envs/afdko-3.12.7/lib/python3.12/site-packages (from ufoProcessor>=1.9.0->afdko==4.0.3a1) (3.0.1)
Requirement already satisfied: appdirs~=1.4.3 in ./.pyenv/versions/3.12.7/envs/afdko-3.12.7/lib/python3.12/site-packages (from fs<3,>=2.2.0->fontTools[lxml,ufo,unicode,woff]>=4.43.0->afdko==4.0.3a1) (1.4.4)
Requirement already satisfied: setuptools in ./.pyenv/versions/3.12.7/envs/afdko-3.12.7/lib/python3.12/site-packages (from fs<3,>=2.2.0->fontTools[lxml,ufo,unicode,woff]>=4.43.0->afdko==4.0.3a1) (75.5.0)
Requirement already satisfied: six~=1.10 in ./.pyenv/versions/3.12.7/envs/afdko-3.12.7/lib/python3.12/site-packages (from fs<3,>=2.2.0->fontTools[lxml,ufo,unicode,woff]>=4.43.0->afdko==4.0.3a1) (1.16.0)
Building wheels for collected packages: afdko
  Building wheel for afdko (pyproject.toml) ... done
  Created wheel for afdko: filename=afdko-4.0.3a1-py3-none-linux_aarch64.whl size=3421694 sha256=7a93251655a95c7c9ac09883a558d357c65560250bd02ec1b8ecef8bfd7d826b
  Stored in directory: /home/ubuntu/.cache/pip/wheels/3a/6e/c4/3701a0c82727f30743733cbedf05ac54cde8997f9a03e721cc
Successfully built afdko
Installing collected packages: afdko
  Attempting uninstall: afdko
    Found existing installation: afdko 4.0.2
    Uninstalling afdko-4.0.2:
      Successfully uninstalled afdko-4.0.2
Successfully installed afdko-4.0.3a1

[notice] A new release of pip is available: 24.2 -> 24.3.1
[notice] To update, run: python -m pip install --upgrade pip
(afdko-3.12.7) ubuntu@agreeable-tunny:~$ cd test-blank/
(afdko-3.12.7) ubuntu@agreeable-tunny:~/test-blank$ make
/bin/sh COMMANDS.txt
makeotf [Warning] Did not recognize the ordering 'Identity'. The Mac cmap script id will be set to Roman (0).
makeotf [Warning] the feature file does not contain a 'vert' feature features.
makeotf [Warning] Could not find an Adobe CMAP Mac encoding mapping file. If you want a Mac cmap subtable, please specify the Mac CMAP encoding file with the '-cm' option.
makeotf [Warning] Could not find a Unicode Variation Sequence file in the expected '/home/ubuntu/.pyenv/versions/3.12.7/envs/afdko-3.12.7/lib/python3.12/site-packages/afdko/resources' subdirectory.
makeotf [Note] setting the USE_TYPO_METRICS OS/2 fsSelection bit 7 from fontinfo keyword.
makeotf [Note] setting the WEIGHT_WIDTH_SLOPE_ONLY OS/2 fsSelection bit 8 from fontinfo keyword.
makeotf [Note] setting the OBLIQUE OS/2 fsSelection bit 9 from fontinfo keyword.
makeotfexe processing font <AdobeBlank>
WARNING: cmap{plat=3,script=1,lang=0}: cmap format 4 subtable was truncated to 2 segments, due to overflow with non-truncated version
WARNING: cmap{plat=1,script=0,lang=0}: empty encoding
WARNING: Macintosh Adobe CMap not seen
WARNING: Unicode variation Selector File not seen
Built release mode font '/home/ubuntu/test-blank/AdobeBlank.otf' Revision 1.045
(afdko-3.12.7) ubuntu@agreeable-tunny:~/test-blank$ uname -a
Linux agreeable-tunny 5.4.0-200-generic #220-Ubuntu SMP Fri Sep 27 13:21:29 UTC 2024 aarch64 aarch64 aarch64 GNU/Linux

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