Skip to content

Fixed ld trace-symbol formatting issue #34

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion build.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

from __future__ import print_function
import distutils.sysconfig
import distutils.version
import os
import numpy
import re
Expand Down Expand Up @@ -51,8 +52,16 @@ def build():
# to have. Also, it doesn't work on macOS.
if not libjpg:
try:
# Get ld's version number
output = subprocess.check_output(['ld', '-v'], stderr=subprocess.STDOUT)
ld_version = output.decode().split(' ')[-1]
# Due to ld changing --trace-symbol output format, we need to modify the index accordingly to get the correct field.
if distutils.version.StrictVersion(ld_version) > distutils.version.StrictVersion('2.30.51'):
symbol_idx = 1
else:
symbol_idx = 0
output = subprocess.check_output(['ld', '-ljpeg', '--trace-symbol', 'jpeg_CreateDecompress', '-e', '0'], stderr=subprocess.STDOUT)
libjpg = output.decode().split(':')[0]
libjpg = output.decode().split(':')[symbol_idx]
except (subprocess.CalledProcessError, OSError):
raise BuildException("Could not find libjpeg. HINT: try 'sudo apt-get install libjpeg-turbo8-dev' on Ubuntu or 'brew install libjpeg-turbo' on OSX")

Expand Down