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

Mac python binding not compiling with python 3.8/3.9 #642

Closed
mdblack98 opened this issue Apr 1, 2021 · 1 comment
Closed

Mac python binding not compiling with python 3.8/3.9 #642

mdblack98 opened this issue Apr 1, 2021 · 1 comment

Comments

@mdblack98
Copy link
Contributor

The Macports team has been working hard to add variants to its existing Hamlib port to add support for Python bindings for users on the Mac.

Please see:

https://trac.macports.org/ticket/62580

Here is the status of the new python bindings related variants of the Hamlib port on the Mac:
hamlib WORKS!
hamlib+python2.7 Bindings WORKS!
hamlib+python3.7 Bindings WORKS!
hamlib+python3.8 Bindings FAILS TO BUILD :-(
hamlib+python3.9 Bindings FAILS to BUILD :-(

The problem with the building hamlib with either Python 3.8 or Python 3.9 bindings
appear to stem with a problem with the Hamlib configuration (configure.ac).

In particular, the problem appears to lie in the check at line ​

AM_PYTHON_CHECK_VERSION([${PYTHON}], [3.8], [pyver_3_8="yes"], [pyver_3_8="no"])

As a result, the compile fails:

CCLD _Hamlib.la
clang: warning: argument unused during compilation: '-pthread'
Undefined symbols for architecture x86_64:
"_PyArg_UnpackTuple", referenced from:
_SwigPyObject_own in hamlibpy_wrap.o
__wrap_rig_debug in hamlibpy_wrap.o
.....
.....
"__Py_NotImplementedStruct", referenced from:
_SwigPyObject_richcompare in hamlibpy_wrap.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[2]: *** [_Hamlib.la] Error 1
make[2]: Leaving directory /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_science_hamlib/hamlib/work/hamlib-4.1/bindings' make[1]: *** [all] Error 2 make[1]: Leaving directory /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_science_hamlib/hamlib/work/hamlib-4.1/bindings'
make: *** [all-recursive] Error 1
make: Leaving directory `/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_science_hamlib/hamlib/work/hamlib-4.1'
Command failed: cd "/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_science_hamlib/hamlib/work/Hamlib-4.1" && /usr/bin/make -j4 -w all
Exit code: 2
Error: Failed to build hamlib: command execution failed
Error: See /opt/local/var/macports/logs/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_science_hamlib/hamlib/main.log for details.
Error: Follow https://guide.macports.org/#project.tickets to report a bug.
Error: Processing of port hamlib failed
I do hope one of the Hamlib developers can fix this problem so Macports can offer Hamlib for all the variants of the python bindings for Mac users.

73s

Rob
VA2FB

@mdblack98
Copy link
Contributor Author

After more testing, I can confirm that Hamlib with python 3.9 bindings will compile manually on the Mac if the following lines are removed (or commented out) in configure.ac:

dnl Determine whether to link libpython as it is unneeded for Python >= 3.8

AM_PYTHON_CHECK_VERSION([${PYTHON}], [3.8], [pyver_3_8="yes"], [pyver_3_8="no"])

AS_IF([test x"${pyver_3_8}" = "xyes"],[

PYTHON_LIBS=""

])

py3test.py also runs fine! So it works!

P.S. If one manually changes configure.ac with a text editor, the following commands are needed to compile Hamlib with python3.9 bindings:

autoreconf --install
./configure --with-python-binding --prefix=/usr/local
make
sudo make install

Then run:
PYTHONPATH=/usr/local/lib/python3.9/site-packages:$PYTHONPATH python bindings/py3test.py

I did not test building Hamlib with Python3.8 bindings using the updated configure.ac. But given the changes to configure.ac, I am sure it will also build fine.

Please consider deleting the lines above in configure.ac so Mac users can use Macports to install Hamlib with python 3.8 or 3.9 bindings!

mdblack98 added a commit that referenced this issue Apr 1, 2021
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

1 participant