Opened 16 months ago

Closed 14 months ago

Last modified 14 months ago

#66389 closed defect (fixed)

gr-osmosdr @20210117-cffef690_3 Build error

Reported by: dwyerk (Kevin Dwyer) Owned by: michaelld (Michael Dickens)
Priority: Normal Milestone:
Component: ports Version:
Keywords: Cc: sck-nogas (Scott C. Kennedy), Patater (Jaeden Amero)
Port: gr-osmosdr

Description

gr-osmosdr fails to build with SWIG errors.

I'm running: sudo port install gr-osmosdr

Which results in:

--->  Building gr-osmosdr
Error: Failed to build gr-osmosdr: command execution failed
Error: See /opt/local/var/macports/logs/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_science_gr-osmosdr/gr-osmosdr/main.log for details.
Error: Follow https://guide.macports.org/#project.tickets if you believe there is a bug.
Error: Processing of port gr-osmosdr failed

Build environment:

:debug:sysinfo macOS 13.0.1 (darwin/22.1.0) arch i386
:debug:sysinfo MacPorts 2.8.0
:debug:sysinfo Xcode 14.1, CLT 14.1.0.0.1.1666437224

First of the errors from the logs:

gr-osmosdr/work/build/swig/CMakeFiles/osmosdr_swig.dir/osmosdr_swigPYTHON_wrap.cxx:5077:152: error: unknown type name 'SWIGPY_SLICEOBJECT'

Attachments (1)

main.log (1.4 MB) - added by dwyerk (Kevin Dwyer) 16 months ago.

Download all attachments as: .zip

Change History (8)

Changed 16 months ago by dwyerk (Kevin Dwyer)

Attachment: main.log added

comment:1 Changed 16 months ago by jmroot (Joshua Root)

Owner: set to michaelld
Status: newassigned

comment:2 Changed 16 months ago by dwyerk (Kevin Dwyer)

Digging around in the osmosdr code I found this really suspicious bit of code:

// Workaround for a SWIG 2.0.4 bug with templates. Probably needs to be looked in to.
%{
#if PY_VERSION_HEX >= 0x03020000
# define SWIGPY_SLICE_ARG(obj) ((PyObject*) (obj))
#else
# define SWIGPY_SLICE_ARG(obj) ((PySliceObject*) (obj))
#endif
%}

This patch at least lets it build. I copied the newer syntax that swig uses into this section. Presumably this is because macports is on to SWIG-4.1.0?

diff --git a/swig/osmosdr_swig.i b/swig/osmosdr_swig.i
index 550008b..cd44507 100644
--- a/swig/osmosdr_swig.i
+++ b/swig/osmosdr_swig.i
@@ -18,13 +18,16 @@

 // Workaround for a SWIG 2.0.4 bug with templates. Probably needs to be looked in to.
 %{
+#include <iostream>
+
 #if PY_VERSION_HEX >= 0x03020000
-# define SWIGPY_SLICE_ARG(obj) ((PyObject*) (obj))
+# define SWIGPY_SLICEOBJECT PyObject
 #else
-# define SWIGPY_SLICE_ARG(obj) ((PySliceObject*) (obj))
+# define SWIGPY_SLICEOBJECT PySliceObject
 #endif
 %}

+
 %template(string_vector_t) std::vector<std::string>;

 //%template(size_vector_t) std::vector<size_t>;

comment:3 Changed 16 months ago by dwyerk (Kevin Dwyer)

Also not entirely clear but SWIG-4.1.0 deprecated the -py3 argument, which osmosdr passes, so we might have to also add

%feature("python:annotations", "c");

comment:4 Changed 15 months ago by sck-nogas (Scott C. Kennedy)

Cc: sck-nogas added

comment:5 Changed 14 months ago by michaelld (Michael Dickens)

@dwyerk : Thank you for this work!

1) Your SWIGPY_SLICEOBJECT tweak does indeed do the trick. I will add a patch to fix that. I'm -so- glad someone tracked this down for us!

2) Reviewing the current state of SWIG 4.1, I agree that we should add the %feature as you note. The -py3 removal is safe & has to be done in gnuradio (3.8.5) port and it's simple to add in the %feature there as well to the top level gnuradio.i SWIG file. I'm fixing that gnuradio first & then I'll fix gr-osmosdr.

comment:6 Changed 14 months ago by michaelld (Michael Dickens)

Resolution: fixed
Status: assignedclosed

In 61430a0e891f7884a7cb90316938a7cce240d3b0/macports-ports (master):

gr-osmosdr (3.8): add patch to fix Python3.6+ usage with SWIG41

Closes: #66389

comment:7 Changed 14 months ago by Patater (Jaeden Amero)

Cc: Patater added
Note: See TracTickets for help on using tickets.