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

Compile error: bladerf_get_frequency() parameter 3 type mismatch #936

Closed
nospam2000 opened this issue Feb 13, 2022 · 1 comment · Fixed by #953 or #955
Closed

Compile error: bladerf_get_frequency() parameter 3 type mismatch #936

nospam2000 opened this issue Feb 13, 2022 · 1 comment · Fixed by #953 or #955

Comments

@nospam2000
Copy link

nospam2000 commented Feb 13, 2022

Expected Behavior

Build and installation should work on MacOS.

Actual Behavior

The build fails because the datatypes of the parameter 3 for bladerf_get_frequency() doesn't match
the prototype in the header /opt/local/include/libbladeRF.h.

The type of bladerf_frequency should be unsigned long long * but it actually is unsigned int *

Probably the following lines (from here) do not work like intended and it chooses the ELSE path instead of the IF path:

IF BLADERF_API_VERSION >= 1.91:
  ctypedef uint64_t bladerf_frequency
ELSE:
  ctypedef unsigned int bladerf_frequency

In /opt/local/include/libbladeRF.h LIBBLADERF_API_VERSION is defined as int32:

* This value is defined as follows:
 *      `(major << 24) | (minor << 16) | (patch << 8) | (reserved << 0)`
 */
#define LIBBLADERF_API_VERSION (0x02040100)

The version 2.4.1 should be detected as newer than 1.9.1.
I haven't understood where that floating point number gets derived from the original integer number.
Maybe the problem is, that 1.91 is not the same as 1.9.1 or that the mechanism for creating the floating
point version number doesn't work correctly.

Steps To Reproduce
  1. install urh via pip3.9
  2. See compile error
Screenshots
      building 'urh.dev.native.lib.bladerf' extension
      src/urh/dev/native/lib/bladerf.cpp:4257:17: error: no matching function for call to 'bladerf_get_frequency'
        __pyx_v_err = bladerf_get_frequency(__pyx_v_3urh_3dev_6native_3lib_7bladerf__c_device, __pyx_f_3urh_3dev_6native_3lib_7bladerf_get_current_bladerf_channel(0), (&__pyx_v_result));
                      ^~~~~~~~~~~~~~~~~~~~~
      /opt/local/include/libbladeRF.h:1300:15: note: candidate function not viable: no known conversion from '__pyx_t_3urh_3dev_6native_3lib_8cbladerf_bladerf_frequency *' (aka 'unsigned int *') to 'bladerf_frequency *' (aka 'unsigned long long *') for 3rd argument
      int CALL_CONV bladerf_get_frequency(struct bladerf *dev,
                    ^
      src/urh/dev/native/lib/bladerf.cpp:4381:13: error: no matching function for call to 'bladerf_sync_config'
        __pyx_r = bladerf_sync_config(__pyx_v_3urh_3dev_6native_3lib_7bladerf__c_device, __pyx_f_3urh_3dev_6native_3lib_7bladerf_get_current_channel_layout(0), BLADERF_FORMAT_SC16_Q11, 32, 0x800, 16, 0x64);
                  ^~~~~~~~~~~~~~~~~~~
      /opt/local/include/libbladeRF.h:2624:15: note: candidate function not viable: no known conversion from 'bladerf_module' (aka 'int') to 'bladerf_channel_layout' for 2nd argument
      int CALL_CONV bladerf_sync_config(struct bladerf *dev,
                    ^
      2 errors generated.
      error: command '/usr/bin/clang' failed with exit code 1
Platform Specifications
  • OS: macOS 11.6.3 with macports
  • XCode: 13.2.1 (including CLI tools)
  • URH version: urh-2.9.2.tar.gz
  • Python version: 3.9 installed with macports
  • Installed via: sudo -H pip3.9 install urh
  • bladeRF @20211028-5a146b2a installed with macports
@nospam2000
Copy link
Author

nospam2000 commented Feb 14, 2022

using the following command, the installation succeeds:

sudo -H BLADERF_API_VERSION=2.41 SDRPLAY_API_VERSION=2.13 pip-3.10 install urh

For a user of pip is it not really intuitive to set the API versions of the components as environment variables, the versions should be automatically be detected from the installed header files.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants