PKG_CHECK_MODULES USB unexpected token #83

Closed
zansibar opened this Issue May 24, 2012 · 17 comments

Projects

None yet
@zansibar

I installed this a month ago on OSX and it went fine, I had to reinstall osx and now I am running into problems.

./configure: line 4781: syntax error near unexpected token USB,' ./configure: line 4781:PKG_CHECK_MODULES(USB, libusb-1.0 >= 1.0.0,,'

I already installed libusb:

$ pkg-config --libs libusb
-L/usr/local/lib -lusb

$ pkg-config --libs libusb-1.0
-L/usr/local/lib -lusb-1.0

if I comment out the line 4781 from configure which causes the problem then it creates the make file but the makefile doesn't Include or link correctly.

I can compile it by adding -lusb-1.0 to the gcc command (also added -I/usr/local/include/libusb to the makefile)

gcc -g -O2 -o st-util gdbserver/st_util-gdb-remote.o gdbserver/st_util-gdb-server.o mingw/st_util-mingw.o libstlink.a -lusb-1.0

Any ideas why I don't have this USB token?
What should it be?

@karlp
Contributor
karlp commented May 25, 2012

can we remove autotools now? It's causing more problems.

@sasai
sasai commented May 29, 2012

It seems the same trouble I had on OSX using homebrew.
In my case, it works well after adding a line "/usr/local/share/aclocal" in /usr/share/aclocal/dirlist file.

See: http://stackoverflow.com/questions/3522248/how-do-i-compile-jzmq-for-zeromq-on-osx

@lestofante

same problem here on Arch linux x86_64, gcc4.7 and autoconf 2.69...
How can i solve?
tomorrow i'll try fall back to autoconf 2.13.

@kevincook

I'm having this issue today. I've read that this issue can occur when your pkg.m4 file isn't in some sane directory. It will cause the aclocal.m4 file to not contain the PKG_CHECK_MODULES macro. This is true for me. by modifying the autogen.sh file to execute

aclocal --force -I /opt/local/share/aclocal

after the autoreconf line, i find the PKG_CHECK_MODULES macro in the generated aclocal.m4 file. Unfortunate it does not resolve my issue.

@kevincook

resolved my issue by adding:

ACLOCAL_AMFLAGS = -I /opt/local/share/aclocal

to Makefile.am

@mkv123
mkv123 commented Aug 24, 2012

I can confirm that adding

ACLOCAL_AMFLAGS = -I /opt/local/share/aclocal

to Makefile.am made ./configure run successfully on osx Lion, whereas before it would fail with the same PCK_CHECK_MODULES error.

@gregoryfenton

(ubuntu linux)
Anyone still experiencing this I did
sudo apt-get install pkg-config
and it worked. Thanks to https://twitter.com/KenichiHidai for pointing me in the right direction.

@Juzujka
Juzujka commented Jan 28, 2013

installing libusb-1.0-0-dev helps me on Ubuntu 12

@marvin-yorke

executing

aclocal --force -I /opt/local/share/aclocal

once was enough for me.
My config is

  • Mac OS X Mountain Lion 10.8.2
  • automake 1.13.1, autoconf 2.69 from MacPorts
@JoesCat JoesCat referenced this issue in fontforge/fontforge Mar 6, 2013
Closed

Configure broken on python check #384

@mfaini
mfaini commented Aug 6, 2013

Hi,

here is what worked on my MacAir (10.7.5).

  1. Add ACLOCAL_AMFLAGS = -I /opt/local/share/aclocal to Makefile.am
  2. sudo port install libftdi0
  3. sudo port install libusb
  4. ./autogen.sh
  5. ./configure
  6. make

Tested with st-flash and all worked smoothly.

PS: On my MacPro (10.7.5) step #2 was not necessary.

@zhuyjgh
zhuyjgh commented Aug 10, 2013

ACLOCAL_FLAGS="-I /usr/share/aclocal" ./autogen.sh works for me!
I find my pkg.m4 here /usr/share/aclocal.

@homer-j
homer-j commented Aug 14, 2013

Had the same issue - finally solved it the following way - from comments I figured out that configure script cannot find pkg.mp4 pkg-config file.
Couldn't find it either in /opt/local/share/aclocal nor in /usr/share/aclocal but used the following command:
brew list pkg-config
which outputted - /usr/local/Cellar/pkg-config/0.28/share/aclocal/pkg.m4
added
ACLOCAL_AMFLAGS = -I /usr/local/Cellar/pkg-config/0.28/share/aclocal/
to Makefile.am and it worked fine.

OS: Mac OSX 10.7.5 + homebrew

Thanks everyone for the tips!

@supersynthesis

howdy all,

I'm unfortunately having similar problems to all above, but none of the options have solved it. I've tried with macports and with homebrew. I get this error after ./configure:
./configure: line 4422: syntax error near unexpected token USB,' ./configure: line 4422:PKG_CHECK_MODULES(USB, libusb-1.0 >= 1.0.0,,'

I tried:

"by modifying the autogen.sh file to execute
aclocal --force -I /opt/local/share/aclocal
...
resolved my issue by adding:
ACLOCAL_AMFLAGS = -I /opt/local/share/aclocal
to Makefile.am"

with no change.

"executing
aclocal --force -I /opt/local/share/aclocal
once was enough for me. "

no change.

"Had the same issue - finally solved it the following way - from comments I figured out that configure script cannot find pkg.mp4 pkg-config file.
Couldn't find it either in /opt/local/share/aclocal nor in /usr/share/aclocal but used the following command:
brew list pkg-config
which outputted - /usr/local/Cellar/pkg-config/0.28/share/aclocal/pkg.m4
added
ACLOCAL_AMFLAGS = -I /usr/local/Cellar/pkg-config/0.28/share/aclocal/
to Makefile.am and it worked fine."

brew list pkg-config gives me "Error: No such keg: /usr/local/Cellar/pkg-config"

and this one
"here is what worked on my MacAir (10.7.5).

Add ACLOCAL_AMFLAGS = -I /opt/local/share/aclocal to Makefile.am
sudo port install libftdi0
sudo port install libusb
./autogen.sh
./configure
make
Tested with st-flash and all worked smoothly."

with no change. does anyone have any idea what's going on here? Thanks in advance!

@homer-j
homer-j commented Mar 22, 2014

Hi, supersynthesis,
I think if you got:

brew list pkg-config gives me "Error: No such keg: /usr/local/Cellar/pkg-config"

it means you need to install it first.
try the following:

  1. brew update
  2. brew install pkg-config
  3. brew list pkg-config

I also heard that macports and homebrew doesn't work well together, may be this mix can cause issues.

@xor-gate xor-gate added the os-mac-osx label May 3, 2016
@xor-gate
Collaborator
xor-gate commented May 3, 2016

Closing this issue as the roots date back into 2012. Now things have been working as expected using autoconf or cmake. Reopen when issue still remains.

@xor-gate xor-gate closed this May 3, 2016
@sguillia

Hello,

I've still got the same problem. None of the above answers got it to work for me.

Running on Debian 8.5

checking for doxygen... /usr/bin/doxygen
./configure: line 13518: syntax error near unexpected token `libusb,'
./configure: line 13518: `        PKG_CHECK_MODULES(libusb, libusb, HAVE_LIBUSB=1, HAVE_LIBUSB=0)'

Has any solution been found since 2012 ?
Thank you

@xor-gate
Collaborator
xor-gate commented Jul 13, 2016 edited

@sguillia please do not recycle this old issue for new problems (this is labeled as original reported on os/macosx). Autoconf is going to be deprecated in the upcoming time. So only CMake build system is supported. See pull request #434 and issue #431.

If there are any problems with cmake, just let us now.

@xor-gate xor-gate locked and limited conversation to collaborators Jul 13, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.