Skip to content
This repository has been archived by the owner on Dec 11, 2022. It is now read-only.

openocd build error for macOS #10

Closed
mentalfl0w opened this issue May 19, 2021 · 10 comments
Closed

openocd build error for macOS #10

mentalfl0w opened this issue May 19, 2021 · 10 comments

Comments

@mentalfl0w
Copy link

I have referred to the #5, but it didn't work for me.
After used that commands, it shows the error: hidapi is required for the CMSIS-DAP Compliant Debugger as before.
image
image

@majbthrd
Copy link
Owner

Note that the first screenshot shows:

checking for hidapi... no

which implies the steps prescribed in #5 didn't happen properly. I have to wonder whether your "export" commands in the second screenshot may not have created the environmental variables. You can run "export" without arguments to see what HIDAPI_LIBS and PKG_CONFIG_PATH got set to.

@citizenfish, would you be able to provide any insight? I am not a Mac user. Thanks.

@citizenfish
Copy link

I have edited my instructions which may be causing this issue.

Run ./bootstrap then ./configure --enable-static --disable-shared

But as @majbthrd said we need to see the output of export after the two commands you should see something like this:-

declare -x PKG_CONFIG_PATH="/Users/daveb/dev/scratch/hidapi/pc"
declare -x HIDAPI_LIBS="-L/Users/daveb/dev/scratch/hidapi/mac/.libs -lhidapi"

And be able to list the two directories with ls

@mentalfl0w
Copy link
Author

I have edited my instructions which may be causing this issue.

Run ./bootstrap then ./configure --enable-static --disable-shared

But as @majbthrd said we need to see the output of export after the two commands you should see something like this:-

declare -x PKG_CONFIG_PATH="/Users/daveb/dev/scratch/hidapi/pc"
declare -x HIDAPI_LIBS="-L/Users/daveb/dev/scratch/hidapi/mac/.libs -lhidapi"

And be able to list the two directories with ls

image

I use echo and get this, but I didn't see like `declare ......`

@mentalfl0w
Copy link
Author

mentalfl0w commented May 19, 2021

After I use

declare -x PKG_CONFIG_PATH="/Users/mac/openocd/hidapi/pc"
declare -x HIDAPI_LIBS="-L/Users/mac/openocd/hidapi/mac/.libs -lhidapi"

It didn't work as well
image
image
Using ls could also list the two directories:
image

@majbthrd
Copy link
Owner

@Dracanrage, "declare" is not a shell command. If you scroll back, you will see that @citizenfish stated this what you should see output after the "export" command.

@Dracanrage, you have not showed a screenshot of following the #5 instructions for building hidapi where "./configure --enable-static --disable-shared" is used.

@mentalfl0w
Copy link
Author

mentalfl0w commented May 20, 2021

@Dracanrage, "declare" is not a shell command. If you scroll back, you will see that @citizenfish stated this what you should see output after the "export" command.

@Dracanrage, you have not showed a screenshot of following the #5 instructions for building hidapi where "./configure --enable-static --disable-shared" is used.

@majbthrd Sorry, I'm in the different time zone, I just read the response before.

  1. git clone https://github.com/signal11/hidapi.git

image

2. cd hidapi

image

3. ./bootstrap then I get this:

image

if I use the hidapi from libusb/hidapi, I get this:

image

image

image

It looks well now. 4. ./configure --enable-static --disable-shared

image

image

5. make

image

6. export HIDAPI_LIBS="-L`pwd`/mac/.libs -lhidapi" and export PKG_CONFIG_PATH="`pwd`/pc"

image

I know @citizenfish says will see some thing like this:
declare -x PKG_CONFIG_PATH="/Users/daveb/dev/scratch/hidapi/pc"
declare -x HIDAPI_LIBS="-L/Users/daveb/dev/scratch/hidapi/mac/.libs -lhidapi"

But I didn't see anything, so I tried them as shell commands to figure out whether it could be used.
7. ./configure --enable-cmsis-dap CFLAGS="-Wno-deprecated -Wno-strict-prototypes"
image
image
Then it crashed as I said.

@citizenfish
Copy link

It looks to me like you may be this stage wrong by pasting in both commands at once

Screenshot 2021-05-20 at 11 28 27

Follow these instructions:-

  1. enter the command below then press return
export HIDAPI_LIBS="-L`pwd`/mac/.libs -lhidapi"
  1. enter the command below then press return
export PKG_CONFIG_PATH="`pwd`/pc"
  1. enter this command then press return
ls $PKG_CONFIG_PATH

You should see a directory listing, if not enter this command then press return and show us the result

echo $PKG_CONFIG_PATH

@mentalfl0w
Copy link
Author

mentalfl0w commented May 20, 2021

It looks to me like you may be this stage wrong by pasting in both commands at once

Screenshot 2021-05-20 at 11 28 27

Follow these instructions:-

  1. enter the command below then press return
export HIDAPI_LIBS="-L`pwd`/mac/.libs -lhidapi"
  1. enter the command below then press return
export PKG_CONFIG_PATH="`pwd`/pc"
  1. enter this command then press return
ls $PKG_CONFIG_PATH

You should see a directory listing, if not enter this command then press return and show us the result

echo $PKG_CONFIG_PATH

@citizenfish
I have seen the directory as below:
image
But when I use

./configure --enable-cmsis-dap CFLAGS="-Wno-deprecated -Wno-strict-prototypes"

It still didn't work:
image
image

@majbthrd
Copy link
Owner

Doing a web search for “macos openocd cmsis-dap hid” yields this:

https://gist.github.com/technobly/f2c14eaa7334db80849d45614250bdf0

The author's instructions call for setting the paths in the same line as part of the configure call, and the author writes "Seems gross to copy the path directly, but trust me it doesn't work unless you do".

Please understand that I am NOT SUGGESTING that you copy and paste the instructions exactly as-is, but perhaps this might suggest a path for you to explore for the problem with your particular Mac.

@mentalfl0w
Copy link
Author

Doing a web search for “macos openocd cmsis-dap hid” yields this:

https://gist.github.com/technobly/f2c14eaa7334db80849d45614250bdf0

The author's instructions call for setting the paths in the same line as part of the configure call, and the author writes "Seems gross to copy the path directly, but trust me it doesn't work unless you do".

Please understand that I am NOT SUGGESTING that you copy and paste the instructions exactly as-is, but perhaps this might suggest a path for you to explore for the problem with your particular Mac.

Thanks! I finally find the problem:
The hombrew didn't really install the pkg-config package which openocd required.
Just try:

brew reinstall pkg-config

Then re-configure, all will be fine.

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

3 participants