Skip to content
This repository has been archived by the owner on Jul 27, 2020. It is now read-only.

Error using MEX #11

Open
MiguelVSantos opened this issue Oct 26, 2018 · 4 comments
Open

Error using MEX #11

MiguelVSantos opened this issue Oct 26, 2018 · 4 comments

Comments

@MiguelVSantos
Copy link

Hi,
I've tried to compile but afeter i added the empty libhackrf.lib file i get this error:

C:\hackrf_one\simulink-hackrf-1.0\simulink-hackrf-1.0\deps\bin\libhackrf.lib: file not recognized: File truncated
collect2.exe: error: ld returned 1 exit status

Error in make (line 66)
mex(options{:}, 'src/hackrf_find_devices.c')

btw i'm using MATLAB R2018a
any idea?
regards

@mpozzo
Copy link

mpozzo commented Nov 13, 2018

Hi, could you solve it?
Regards

@shanpriyan
Copy link

i got the same error in MATLAB 2017b ,if you find the solution please let me know .
Thanks.

@AustrianCodeWriter
Copy link

Hey,
I had the same issue with MATLAB R2017B.
The file libhackrf.lib cannot be empty, since MATLAB use it for compiling with MEX.
I found a way to easily create a valid libhackrf.lib file using Microsoft Visual C++ ("MSVC"):

  1. Call a new MSVC console (e.g. for "Visual Studio 2019":
    Start a new command line window and call the batch-script from
    "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community
    \VC\Auxiliary\Build\vcvars64.bat")
  2. Change directory to "deps\bin" and run:
    dumpbin /EXPORTS libhackrf.dll > libhackrf.exports
  3. Create a new file called "libhackrf.def" and insert the following lines:
   LIBRARY "libhackrf.dll"
   EXPORTS
   hackrf_board_id_name
   hackrf_xxx
... for _hackrf_xxx_ insert each "**hackrf_**" element from your previously created
   "libhackrf.exports" file
  1. In your MSVC console type the command:
    lib /def:libhackrf.def /machine:x64 /out:libhackrf.lib

  2. If you now run make in MATLAB it should compile without any problems

Regards

@shanpriyan
Copy link

shanpriyan commented Aug 6, 2019 via email

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

No branches or pull requests

4 participants