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

Error in using pkg-config with gcc in fish #1947

Closed
bigpotato920 opened this issue Feb 13, 2015 · 6 comments
Closed

Error in using pkg-config with gcc in fish #1947

bigpotato920 opened this issue Feb 13, 2015 · 6 comments

Comments

@bigpotato920
Copy link

I use fish shell on Arch Linux. I was trying to compile a c program using gtk library.But When I try to compile it using the following command in fish:

sudo gcc -shared -o libsublime_imfix.so sublime_imfix.c (pkg-config --libs --cflags gtk+-2.0) -fPIC

it shows the following errors:
gcc: error: unrecognized command line option ‘-pthread -I/usr/include/gtk-2.0 -I/usr/lib/gtk-2.0/include -I/usr/include/pango-1.0 -I/usr/include/atk-1.0 -I/usr/include/cairo -I/usr/include/pixman-1 -I/usr/include/libdrm -I/usr/include/gdk-pixbuf-2.0 -I/usr/include/libpng16 -I/usr/include/pango-1.0 -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -I/usr/include/freetype2 -I/usr/include/libpng16 -I/usr/include/harfbuzz -I/usr/include/freetype2 -I/usr/include/libpng16 -I/usr/include/harfbuzz -lgtk-x11-2.0 -lgdk-x11-2.0 -lpangocairo-1.0 -latk-1.0 -lcairo -lgdk_pixbuf-2.0 -lgio-2.0 -lpangoft2-1.0 -lpango-1.0 -lgobject-2.0 -lglib-2.0 -lfontconfig -lfreetype ’
but when I switch to bash and run :

sudo gcc -shared -o libsublime_imfix.so sublime_imfix.c `pkg-config --libs --cflags gtk+-2.0 `-fPIC

it works fine, could you help me with that?

@zanchey
Copy link
Member

zanchey commented Feb 13, 2015

See #982 - you need to add | tr ' ' '\n' or similar to the end of the pkg-config command substitution.

@bigpotato920
Copy link
Author

When I use a normal user I try:

sudo eval gcc -shared -o libsublime_imfix.so sublime_imfix.c (pkg-config --libs --cflags gtk+-2.0) -fPIC

The output is : sudo: eval: command not found
But When I switch to root it works fine.

@zanchey
Copy link
Member

zanchey commented Feb 13, 2015

If you want to do it that way, use eval sudo, not sudo eval.

@ridiculousfish
Copy link
Member

What's mystifying to me is why the sudo eval ... works. Did you perhaps not run the command with sudo as root?

@bigpotato920
Copy link
Author

yeah , the source code is located at /opt/xxx, so I have to have root priveledge

@ridiculousfish
Copy link
Member

I think there's nothing for fish to do here. The issues with pkg-config are well known. Please comment if you think there's more to do.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Apr 18, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants