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

Faile to compile fontforge. #3902

Closed
hongyi-zhao opened this issue Aug 28, 2019 · 12 comments
Closed

Faile to compile fontforge. #3902

hongyi-zhao opened this issue Aug 28, 2019 · 12 comments

Comments

@hongyi-zhao
Copy link

Hi,

I try to compile fontforge as follows:

cd fontforge
mkdir build
cd build
cmake -GNinja ..
ninja

This step, I meet the following error:

/usr/bin/ld: /usr/local/lib/libpython3.7m.a(bytesobject.o): relocation R_X86_64_PC32 against symbol `_Py_NoneStruct' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: final link failed: Bad value
collect2: error: ld returned 1 exit status
ninja: build stopped: subcommand failed.

How to resolve it?
Regards

@jtanx
Copy link
Contributor

jtanx commented Aug 28, 2019

This is the same as #3897, did you compile python yourself? Otherwise why is it under /usr/local. Either use your system provided python development package, or recompile with fPIC enabled

@hongyi-zhao
Copy link
Author

hongyi-zhao commented Aug 28, 2019 via email

@jtanx
Copy link
Contributor

jtanx commented Aug 28, 2019

  • What's your Debian version
  • What exactly did you do to get /usr/local/lib/libpython3.7*
  • What version is system python
  • Have you installed python3-dev?

@jtanx
Copy link
Contributor

jtanx commented Aug 28, 2019

Try also using #3906

@hongyi-zhao
Copy link
Author

hongyi-zhao commented Aug 28, 2019 via email

@jtanx
Copy link
Contributor

jtanx commented Aug 28, 2019

Try applying the change from here: #3906

Basically if you want to statically link to Python (which you probably don't), then that Python library itself needs to be compiled with -fPIC passed to gcc. Also we currently only support Python 3 or later.

@hongyi-zhao
Copy link
Author

hongyi-zhao commented Aug 28, 2019 via email

@ctrlcctrlv
Copy link
Member

ctrlcctrlv commented Aug 28, 2019

Sorry if this is obvious (I mostly write it for Googlers trying to compile the 20190801 release), but Python isn't really a hard requirement. If you don't need it, you can pass -DENABLE_PYTHON_SCRIPTING=0 to cmake per the wiki. Most of the time your users will want it, but non-technical graphic designers won't mind not having it (in theory).

@ctrlcctrlv
Copy link
Member

ctrlcctrlv commented Aug 28, 2019

@hongyi-zhao You need git fetch origin; git checkout pyr before ninja.

(順便說說,你好,來自菲律賓!)

@hongyi-zhao
Copy link
Author

hongyi-zhao commented Aug 28, 2019 via email

@jtanx
Copy link
Contributor

jtanx commented Aug 28, 2019

That's working as intended then. It's saying it can't find a suitable shared library to link to.

Follow these steps: https://github.com/pyenv/pyenv/wiki#how-to-build-cpython-with---enable-shared

You need to build/install Python as a shared library when you install via pyenv.

Although my suggestion is to not use pyenv and use system python instead.

@hongyi-zhao
Copy link
Author

hongyi-zhao commented Aug 28, 2019 via email

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