Can't compile anything

Discussions Regarding Software

Moderator: Moderators

Stupot
Sagely Hen
Posts: 1733
Joined: Wed Feb 14, 2007 3:44
Location: St. Louis, MO, USA

Re: Can't compile anything

Post by Stupot » Fri Feb 25, 2011 3:33

micia is correct. Using gcc, with the .cpp extension, your source file will be compiled as a C++
source file. But, by using the name gcc to call the compiler, you are effectively saying that you only need the C libraries. To get the C++ libraries, you should use the name g++: g++ -o test test.cpp

knightlain
Baby Hen
Posts: 18
Joined: Mon Feb 07, 2011 16:43

Re: Can't compile anything

Post by knightlain » Fri Feb 25, 2011 5:44

Is there a configuration file I should tweak so this error doesn't happens anymore? It happens to me with all muy portage packages

micia
Sagely Hen
Posts: 2718
Joined: Wed Nov 26, 2008 16:41
Contact:

Re: Can't compile anything

Post by micia » Fri Feb 25, 2011 12:13

Have you modified the /etc/make.conf or some other portage related file?
Since I am pretty sure that portage does not use gcc to link C++ sources and there is also C software out there...
can you post the command of emerge with the entire output you get?
If it is a really huge output, you can use the pastebin:
http://pastebin.sabayon.org/

Maybe it is just some library missing or some configuration with eselect/binutils that needs to be done.

knightlain
Baby Hen
Posts: 18
Joined: Mon Feb 07, 2011 16:43

Re: Can't compile anything

Post by knightlain » Fri Feb 25, 2011 23:53

Here is my log, hope it is useful.

http://pastebin.sabayon.org/pastie/5763

micia
Sagely Hen
Posts: 2718
Joined: Wed Nov 26, 2008 16:41
Contact:

Re: Can't compile anything

Post by micia » Sat Feb 26, 2011 0:14

Code: Select all

interface.c:15:28: support.c:15:21: error: gtk/gtk.h: File or directory doesn't exists
error: gdk/gdkkeysyms.h: File or directory doesn't exists
interface.c:16:21: error: gtk/gtk.h: File or directory doesn't exists
main.c:38:18: error: glib.h: File or directory doesn't exists
main.c:39:21: error: gtk/gtk.h: File or directory doesn't exists
interface.c:15:28: error: gdk/gdkkeysyms.h: File or directory doesn't exists
interface.c:16:21: error: gtk/gtk.h: File or directory doesn't exists
that is your problem, you are missing some include files and libraries.
Are you using portage as your main package manager, or is it the first time you are using it in your system?
Because I find very strange that portage didn't notice those dependencies.
Check that those packages are installed:

Code: Select all

equo query installed gtk+ glib --quiet
or, if you use portage as your main package manager:

Code: Select all

eix -I gtk glib

knightlain
Baby Hen
Posts: 18
Joined: Mon Feb 07, 2011 16:43

Re: Can't compile anything

Post by knightlain » Sat Feb 26, 2011 1:22

[email protected] ~ $ equo query installed gtk+ glib --quiet
app-text/poppler-glib-0.14.5
dev-cpp/glibmm-2.24.2-r1
dev-libs/dbus-glib-0.92
dev-libs/glib-1.2.10-r5
dev-libs/glib-2.26.1
dev-perl/glib-perl-1.223
sys-libs/glibc-2.11.2-r3
x11-libs/gtk+-1.2.10-r12
x11-libs/gtk+-2.22.1-r1
[email protected] ~ $ sudo equo query installed gtk+ glib --quiet
app-text/poppler-glib-0.14.5
dev-cpp/glibmm-2.24.2-r1
dev-libs/dbus-glib-0.92
dev-libs/glib-1.2.10-r5
dev-libs/glib-2.26.1
dev-perl/glib-perl-1.223
sys-libs/glibc-2.11.2-r3
x11-libs/gtk+-1.2.10-r12
x11-libs/gtk+-2.22.1-r1
[email protected] ~ $ eix -I gtk
app-emulation/emul-linux-x86-gtklibs
Available versions: 20100915!s 20110129!s {development}
Installed versions: 20100915!s(10:47:41 27/10/10)
Homepage: http://dev.gentoo.org/~pacho/emul.html
Description: Provides precompiled 32bit libraries

app-emulation/emul-linux-x86-gtkmmlibs
Available versions: (~)20110129!s {development}
Installed versions: 20100915!s(10:49:11 27/10/10)
Homepage: http://dev.gentoo.org/~pacho/emul.html
Description: Provides precompiled 32bit libraries

app-text/gtkspell
Available versions: 2.0.16 {doc}
Installed versions: 2.0.16(04:33:07 15/06/10)(-doc)
Homepage: http://gtkspell.sourceforge.net/
Description: Spell checking widget for GTK2

dev-cpp/gtkmm
Available versions:
(1.2) 1.2.9-r2
(2.4) 2.18.2 2.20.3 (~)2.22.0
{debug doc examples test}
Installed versions: 2.22.0(2.4)(02:33:51 04/01/11)(-doc -examples -test)
Homepage: http://www.gtkmm.org
Description: C++ interface for GTK+2

dev-perl/gtk2-perl
Available versions: 1.222
Installed versions: 1.222(10:14:30 24/10/10)
Homepage: http://search.cpan.org/dist/Gtk2/
Description: Perl bindings for GTK2

dev-python/pygtk
Available versions: (2) 2.17.0 (~)2.22.0 (~)2.22.0-r1
{doc examples test}
Installed versions: 2.22.0-r1(2)(09:45:01 07/02/11)(-doc -examples -test)
Homepage: http://www.pygtk.org/
Description: GTK+2 bindings for Python

x11-libs/gtk+
Available versions:
(1) 1.2.10-r12
(2) 2.20.1-r1 (~)2.22.1-r1 [M](~)2.24.0
{aqua cups debug doc examples +introspection jpeg jpeg2k linguas_az linguas_ca linguas_cs linguas_da linguas_de linguas_el linguas_es linguas_et linguas_eu linguas_fi linguas_fr linguas_ga linguas_gl linguas_hr linguas_hu linguas_it linguas_ja linguas_ko linguas_lt linguas_nl linguas_nn linguas_no linguas_pl linguas_pt linguas_pt_BR linguas_ro linguas_ru linguas_sk linguas_sl linguas_sr linguas_sv linguas_tr linguas_uk linguas_vi nls test tiff vim-syntax xinerama}
Installed versions: 1.2.10-r12(1)(23:53:51 03/02/11)(linguas_az linguas_ca linguas_cs linguas_da linguas_de linguas_el linguas_es linguas_et linguas_eu linguas_fi linguas_fr linguas_ga linguas_gl linguas_hr linguas_hu linguas_it linguas_ja linguas_ko linguas_lt linguas_nl linguas_nn linguas_pl linguas_pt linguas_pt_BR linguas_ro linguas_ru linguas_sk linguas_sl linguas_sr linguas_sv linguas_tr linguas_uk linguas_vi nls -debug -linguas_no) 2.22.1-r1(2)(08:16:31 07/02/11)(cups jpeg tiff xinerama -aqua -debug -doc -examples -introspection -jpeg2k -test -vim-syntax)
Homepage: http://www.gtk.org/
Description: Gimp ToolKit +

x11-libs/gtkglext
Available versions: 1.2.0 {debug}
Installed versions: 1.2.0(09:20:24 18/06/10)(-debug)
Homepage: http://gtkglext.sourceforge.net/
Description: GL extensions for Gtk+ 2.0

x11-libs/gtksourceview
Available versions:
(1.0) 1.8.5-r1
(2.0) 2.10.4 2.10.5-r1
{debug doc glade test}
Installed versions: 1.8.5-r1(1.0)(14:10:25 22/06/10)(-debug -doc)
Homepage: http://www.gnome.org/
Description: A text widget implementing syntax highlighting and other features

x11-libs/wxGTK
Available versions:
(2.6) 2.6.4.0-r6
(2.8) 2.8.10.1-r5 (~)2.8.11.0
(2.9) [M](~)2.9.1.1
{X debug doc gnome gstreamer odbc opengl pch sdl tiff unicode}
Installed versions: 2.8.11.0(2.8)(06:18:09 04/09/10)(X gnome opengl sdl tiff -debug -doc -gstreamer -odbc -pch)
Homepage: http://wxwidgets.org/
Description: GTK+ version of wxWidgets, a cross-platform C++ GUI toolkit.

x11-themes/gtk-engines
Available versions: (2) 2.18.5 2.20.1-r1 2.20.2
{accessibility lua}
Installed versions: 2.20.2(2)(09:14:27 14/10/10)(accessibility -lua)
Homepage: http://www.gtk.org/
Description: GTK+2 standard engines and themes

x11-themes/gtk-engines-xfce
Available versions: 2.8.0 {debug}
Installed versions: 2.8.0(03:15:54 17/01/11)(-debug)
Homepage: http://www.xfce.org/projects/
Description: Xfce's GTK+ engine and themes

Found 12 matches.
[email protected] ~ $ eix -I glib
dev-cpp/glibmm
Available versions: (2) 2.22.1 2.24.2-r1
{debug doc examples test}
Installed versions: 2.24.2-r1(2)(06:16:28 23/11/10)(-debug -doc -examples -test)
Homepage: http://www.gtkmm.org
Description: C++ interface for glib2

[I] dev-libs/dbus-glib
Available versions: 0.88 (~)0.92 {bash-completion debug doc static-libs test}
Installed versions: 0.92(09:00:26 08/12/10)(bash-completion -debug -doc -static-libs -test)
Homepage: http://dbus.freedesktop.org/
Description: D-Bus bindings for glib

dev-libs/glib
Available versions:
(1) 1.2.10-r5
(2) 2.22.5 2.24.1-r1 2.24.2 (~)2.26.1 (~)2.26.1-r1 [M](~)2.28.0 [M](~)2.28.1
{debug doc fam hardened +introspection selinux +static-libs test xattr}
Installed versions: 1.2.10-r5(1)(23:52:40 03/02/11)(-hardened) 2.26.1(2)(08:22:18 07/12/10)(fam static-libs -debug -doc -introspection -selinux -test -xattr)
Homepage: http://www.gtk.org/
Description: The GLib library of C routines

[I] dev-perl/glib-perl
Available versions: 1.223
Installed versions: 1.223(07:26:38 24/10/10)
Homepage: http://gtk2-perl.sf.net/
Description: Glib - Perl wrappers for the GLib utility and Object libraries

[I] sys-libs/glibc
Available versions: (2.2) [P]*2.2.5-r10!s 2.5-r4!s **2.5.1!s 2.6.1!s ~2.7-r2!s 2.8_p20080602-r1!s 2.9_p20081201-r2!s ~2.9_p20081201-r3!s 2.10.1-r1!s 2.11.2-r3!s ~2.11.3!s ~2.12.1-r3!s ~2.12.2!s ~2.13-r1!s
{build crosscompile_opts_headers-only debug gd glibc-compat20 glibc-omitfp hardened multilib nls nptl nptlonly profile selinux vanilla}
Installed versions: 2.11.2-r3(2.2)!s(10:18:43 23/11/10)(multilib nls -crosscompile_opts_headers-only -debug -gd -glibc-omitfp -hardened -profile -selinux -vanilla)
Homepage: http://www.gnu.org/software/libc/libc.html
Description: GNU libc6 (also called glibc2) C library

Found 5 matches.
[email protected] ~ $ eix -I gtk glib
No matches found.

This is my output :(

micia
Sagely Hen
Posts: 2718
Joined: Wed Nov 26, 2008 16:41
Contact:

Re: Can't compile anything

Post by micia » Sat Feb 26, 2011 1:39

uhmm, why do you have 2 versions of gtk+ installed?
You got:

Code: Select all

x11-libs/gtk+-1.2.10-r12
x11-libs/gtk+-2.22.1-r1
same goes for glib.

The 1.2.10 version of GTK+ is quite ugly, I don't know if it is related to your problem, though.
Is there any reason to keep it in your system?
Also, Are you using entropy or portage as your main package manager?

knightlain
Baby Hen
Posts: 18
Joined: Mon Feb 07, 2011 16:43

Re: Can't compile anything

Post by knightlain » Sat Feb 26, 2011 6:04

I deleted the duplicates, however, I still have the same error. Well, I started using entropy, but I want to use portage too to take advantage of both binary and installation from source.

micia
Sagely Hen
Posts: 2718
Joined: Wed Nov 26, 2008 16:41
Contact:

Re: Can't compile anything

Post by micia » Sat Feb 26, 2011 19:04

Mixing them without some knowledge is dangerous.

However can you check if you effectively got in your system the directories:
/usr/include/gtk-2.0/gtk/gtk.h
/usr/include/glib-2.0/glib.h
etc...
If they are not there, probably you need to reinstall those packages.
If they are there, you got the include paths of your compiler messed up.
In this case, if you used portage, ensure that portage and entropy are synced with:

Code: Select all

equo rescue spmsync
and post the output of:

Code: Select all

equo query installed --quiet gcc
gcc-config -l
binutils-config -l
Also, for this kind of output using the [ code ] tags helps to make it more readable :)

knightlain
Baby Hen
Posts: 18
Joined: Mon Feb 07, 2011 16:43

Re: Can't compile anything

Post by knightlain » Sun Feb 27, 2011 5:52

Yes they are there, so that makes me think my includes are messed up, where can I check them?

Code: Select all

[email protected] ~ $ equo query installed --quiet gcc
sys-devel/gcc-4.4.4-r2
sys-devel/gcc-config-1.4.1
[email protected] ~ $ binutils-config -l
 [1] x86_64-pc-linux-gnu-2.20.1 *
[email protected] ~ $ gcc-config -l
 [1] x86_64-pc-linux-gnu-4.4.4 *

Post Reply