This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Problems with Libs GTK

Errors:

**** Build of configuration Default for project hello ****

make all
arm-none-linux-gnueabi-gcc hello.o -o hello
hello.o: In function 'main':
/home/Gabriel/DS-5-Workspace/hello/hello.c:22: undefined reference to 'gtk_init'
/home/Gabriel/DS-5-Workspace/hello/hello.c:23: undefined reference to 'gtk_window_new'
/home/Gabriel/DS-5-Workspace/hello/hello.c:24: undefined reference to 'gtk_window_get_type'
/home/Gabriel/DS-5-Workspace/hello/hello.c:24: undefined reference to 'g_type_check_instance_cast'
/home/Gabriel/DS-5-Workspace/hello/hello.c:24: undefined reference to 'gtk_window_set_title'
/home/Gabriel/DS-5-Workspace/hello/hello.c:25: undefined reference to 'gtk_widget_show'
/home/Gabriel/DS-5-Workspace/hello/hello.c:26: undefined reference to 'gtk_main'
collect2: ld returned 1 exit status
make: *** [hello] Error 1

My makefile (original project Hello):

# C Application Example for ARM Linux
# # Copyright (C) ARM Limited, 2007-2010. All rights reserved.

# This makefile is intended for use with GNU make
# # This project can be built with either armcc or gcc by setting:
# TOOLCHAIN = armcc
# or
# TOOLCHAIN = gcc

TOOLCHAIN = gcc

TARGET = hello
CPU = -march=armv5te
CC_OPTS = -c -O1 -g \
-I /home/Gabriel/DS-5-Workspace/distribution/filesystem/armv5t_mtx/usr/include/gtk-2.0 \
-I /home/Gabriel/DS-5-Workspace/distribution/filesystem/armv5t_mtx/usr/include/glib-2.0 \
-I /home/Gabriel/DS-5-Workspace/distribution/filesystem/armv5t_mtx/usr/lib/glib-2.0/include \
-I /home/Gabriel/DS-5-Workspace/distribution/filesystem/armv5t_mtx/usr/include/cairo \
-I /home/Gabriel/DS-5-Workspace/distribution/filesystem/armv5t_mtx/usr/include/pango-1.0 \
-I /home/Gabriel/DS-5-Workspace/distribution/filesystem/armv5t_mtx/usr/lib/gtk-2.0/include \
-I /home/Gabriel/DS-5-Workspace/distribution/filesystem/armv5t_mtx/usr/include/atk-1.0 \
-L /home/Gabriel/DS-5-Workspace/distribution/filesystem/armv5t_mtx/usr/lib \
-L /home/Gabriel/DS-5-Workspace/distribution/filesystem/armv5t_mtx/usr/lib/glib-2.0/include \
-L /home/Gabriel/DS-5-Workspace/distribution/filesystem/armv5t_mtx/usr/lib/gtk-2.0/include

OBJS = hello.o
STRIPPED_DIR = stripped

##########################################################################

ifeq ($(strip $(TOOLCHAIN)),armcc)
CONFIG_FILE = arm_linux_config.xml
CPP = armcc --cpp --arm_linux_paths --arm_linux_config_file=$(CONFIG_FILE) --translate_g++
CC = armcc --arm_linux_paths --arm_linux_config_file=$(CONFIG_FILE) --translate_gcc
AR = armar
STRIP_APP = fromelf --strip debug,comment,symbols --elf
STRIP_LIB = fromelf --strip debug,comment,symbols --elf
else
CONFIG_FILE =
CPP = arm-none-linux-gnueabi-c++
CC = arm-none-linux-gnueabi-gcc
AR = arm-none-linux-gnueabi-ar
STRIP_APP = arm-none-linux-gnueabi-strip -R .comment --strip-all
STRIP_LIB = arm-none-linux-gnueabi-strip -R .comment --strip-unneeded
endif

# Select build rules based on Windows or Linux
ifdef WINDIR
WINPATH=$(subst /,\,$(1))
DONE=@if exist $(call WINPATH,$(1)) echo Build completed.
define REAL_RM
if exist $(call WINPATH,$(1)) del /q $(call WINPATH,$(1))

endef
RM=$(foreach file,$(1),$(call REAL_RM,$(file)))
SHELL=$(windir)\system32\cmd.exe
MD=if not exist $(1) mkdir $(1)
CP=copy
else
ifdef windir
WINPATH=$(subst /,\,$(1))
DONE=@if exist $(call WINPATH,$(1)) echo Build completed.
define REAL_RM
if exist $(call WINPATH,$(1)) del /q $(call WINPATH,$(1))

endef
RM=$(foreach file,$(1),$(call REAL_RM,$(file)))
SHELL=$(windir)\system32\cmd.exe
MD=if not exist $(1) mkdir $(1)
CP=copy

else
DONE=@if [ -f $(1) ]; then echo Build completed.; fi
RM=rm -f $(1)
MD=@if [ ! -d $(1) ]; then mkdir $(1); fi
CP=cp
endif
endif

##########################################################################

all: $(TARGET) $(call DONE,$(TARGET))

rebuild: clean all

clean: $(call RM,$(CONFIG_FILE)) $(call RM,$(OBJS)) $(call RM,$(TARGET)) $(call RM,$(STRIPPED_DIR)/$(TARGET))

# Create the configuration file so that the ARM compiler can find the GCC headers and libraries
$(CONFIG_FILE): armcc --arm_linux_configure --arm_linux_config_file=$(CONFIG_FILE)

# Compile the sources
$(OBJS): %.o: %.c $(CONFIG_FILE) $(CC) $(CPU) $(CC_OPTS) $< -o $@

# Link the objects together to create an executable
# Strip the host/debug version to create a stripped/nodebug version for downloading to the target
$(TARGET): $(OBJS) $(CONFIG_FILE) $(call MD,$(STRIPPED_DIR)) $(CC) $(OBJS) -o $(TARGET) $(STRIP_APP) $(TARGET) -o $(STRIPPED_DIR)/$(TARGET)

My small program:

#include <stdio.h>
#include <gtk/gtk.h>

//int main(int argc, char** argv)
//{
// printf("Hello world\n");
//}
int main(int argc, char **argv)
{

GtkWidget *janela;
gtk_init(&argc, &argv);
janela = gtk_window_new(GTK_WINDOW_TOPLEVEL);
gtk_window_set_title(GTK_WINDOW (janela), "Alo Mundo");
gtk_widget_show(janela);
gtk_main();
return 0;

}

Can anyone help?

  • "make all
    arm-none-linux-gnueabi-gcc hello.o -o hello
    hello.o: In function 'main':
    /home/Gabriel/DS-5-Workspace/hello/hello.c:22: undefined reference to 'gtk_init'
    /home/Gabriel/DS-5-Workspace/hello/hello.c:23: undefined reference to 'gtk_window_new'
    /home/Gabriel/DS-5-Workspace/hello/hello.c:24: undefined reference to 'gtk_window_get_type'
    /home/Gabriel/DS-5-Workspace/hello/hello.c:24: undefined reference to 'g_type_check_instance_cast'
    /home/Gabriel/DS-5-Workspace/hello/hello.c:24: undefined reference to 'gtk_window_set_title'
    /home/Gabriel/DS-5-Workspace/hello/hello.c:25: undefined reference to 'gtk_widget_show'
    /home/Gabriel/DS-5-Workspace/hello/hello.c:26: undefined reference to 'gtk_main'
    collect2: ld returned 1 exit status
    make: *** [hello] Error 1"

    Those are linker errors. I don't see where you're linking in the GTK library.

  • I think this is enough here (I'm beginner...):

    -L / home/Gabriel/DS-5-Workspace/distribution/filesystem/armv5t_mtx/usr/lib \
    -L / home/Gabriel/DS-5-Workspace/distribution/filesystem/armv5t_mtx/usr/lib/glib-2.0/include \
    -L / home/Gabriel/DS-5-Workspace/distribution/filesystem/armv5t_mtx/usr/lib/gtk-2.0/include

  • "I think this is enough here "

    OK, if you say so.

  • "???"

    Well, I was thinking that you'd want to specify what library to link to, not just where to look for unnamed libraries.

    You wrote that you thought the where was enough, so I have nothing more to add.

  • I think there was a misunderstanding, I put the following lines in the makefile:

    C_OPTS = -c -O1 -g \
    -I /home/Gabriel/DS-5-Workspace/distribution/filesystem/armv5t_mtx/usr/include/gtk-2.0 \
    -I /home/Gabriel/DS-5-Workspace/distribution/filesystem/armv5t_mtx/usr/include/glib-2.0 \
    -I /home/Gabriel/DS-5-Workspace/distribution/filesystem/armv5t_mtx/usr/lib/glib-2.0/include \
    -I /home/Gabriel/DS-5-Workspace/distribution/filesystem/armv5t_mtx/usr/include/cairo \
    -I /home/Gabriel/DS-5-Workspace/distribution/filesystem/armv5t_mtx/usr/include/pango-1.0 \
    -I /home/Gabriel/DS-5-Workspace/distribution/filesystem/armv5t_mtx/usr/lib/gtk-2.0/include \
    -I /home/Gabriel/DS-5-Workspace/distribution/filesystem/armv5t_mtx/usr/include/atk-1.0 \
    -L /home/Gabriel/DS-5-Workspace/distribution/filesystem/armv5t_mtx/usr/lib/libgtk-x11-2.0.so \
    -L /home/Gabriel/DS-5-Workspace/distribution/filesystem/armv5t_mtx/usr/lib/libgdk-x11-2.0.so \
    -L /home/Gabriel/DS-5-Workspace/distribution/filesystem/armv5t_mtx/usr/lib/libgio-2.0.so \
    -L /home/Gabriel/DS-5-Workspace/distribution/filesystem/armv5t_mtx/usr/lib/libglib-2.0.so \
    -L /home/Gabriel/DS-5-Workspace/distribution/filesystem/armv5t_mtx/usr/lib/libatk-1.0.so \
    -L /home/Gabriel/DS-5-Workspace/distribution/filesystem/armv5t_mtx/usr/lib/libcairo.so \
    -L /home/Gabriel/DS-5-Workspace/distribution/filesystem/armv5t_mtx/usr/lib/libexpat.so \
    -L /home/Gabriel/DS-5-Workspace/distribution/filesystem/armv5t_mtx/usr/lib/libfontconfig.so \
    -L /home/Gabriel/DS-5-Workspace/distribution/filesystem/armv5t_mtx/usr/lib/libfreetype.so \
    -L /home/Gabriel/DS-5-Workspace/distribution/filesystem/armv5t_mtx/usr/lib/libgdk_pixbuf-2.0.so \
    -L /home/Gabriel/DS-5-Workspace/distribution/filesystem/armv5t_mtx/usr/lib/libgmodule-2.0.so \
    -L /home/Gabriel/DS-5-Workspace/distribution/filesystem/armv5t_mtx/usr/lib/libgobject-2.0.so \
    -L /home/Gabriel/DS-5-Workspace/distribution/filesystem/armv5t_mtx/usr/lib/libpangocairo-1.0.so \
    -L /home/Gabriel/DS-5-Workspace/distribution/filesystem/armv5t_mtx/usr/lib/libpangoft2.so \
    -L /home/Gabriel/DS-5-Workspace/distribution/filesystem/armv5t_mtx/usr/lib/libpixman-1.so \
    -L /home/Gabriel/DS-5-Workspace/distribution/filesystem/armv5t_mtx/usr/lib/libpng12.so \
    -L /home/Gabriel/DS-5-Workspace/distribution/filesystem/armv5t_mtx/usr/lib/libx11.so \
    -L /home/Gabriel/DS-5-Workspace/distribution/filesystem/armv5t_mtx/usr/lib/libXau.so \
    -L /home/Gabriel/DS-5-Workspace/distribution/filesystem/armv5t_mtx/usr/lib/libXcursor.so \
    -L /home/Gabriel/DS-5-Workspace/distribution/filesystem/armv5t_mtx/usr/lib/libXdmcp.so \
    -L /home/Gabriel/DS-5-Workspace/distribution/filesystem/armv5t_mtx/usr/lib/libXext.so \
    -L /home/Gabriel/DS-5-Workspace/distribution/filesystem/armv5t_mtx/usr/lib/libXfixes.so \
    -L /home/Gabriel/DS-5-Workspace/distribution/filesystem/armv5t_mtx/usr/lib/libXrandr.so \
    -L /home/Gabriel/DS-5-Workspace/distribution/filesystem/armv5t_mtx/usr/lib/libXrender.so \
    -L /home/Gabriel/DS-5-Workspace/distribution/filesystem/armv5t_mtx/usr/lib/libz.so \
    -L /home/Gabriel/DS-5-Workspace/gnometris/libgames-support.so \
    -L /home/Gabriel/DS-5-Workspace/example_library/libsorts.so
    OBJS = hello.o
    STRIPPED_DIR = stripped

    It continues:

    **** Build of configuration Default for project hello ****

    make all
    arm-none-linux-gnueabi-gcc hello.o -o hello
    hello.o: In function 'main':
    /home/Gabriel/DS-5-Workspace/hello/hello.c:22: undefined reference to 'gtk_init'
    /home/Gabriel/DS-5-Workspace/hello/hello.c:23: undefined reference to 'gtk_window_new'
    /home/Gabriel/DS-5-Workspace/hello/hello.c:24: undefined reference to 'gtk_window_get_type'
    /home/Gabriel/DS-5-Workspace/hello/hello.c:24: undefined reference to 'g_type_check_instance_cast'
    /home/Gabriel/DS-5-Workspace/hello/hello.c:24: undefined reference to 'gtk_window_set_title'
    /home/Gabriel/DS-5-Workspace/hello/hello.c:25: undefined reference to 'gtk_widget_show'
    /home/Gabriel/DS-5-Workspace/hello/hello.c:26: undefined reference to 'gtk_main'
    collect2: ld returned 1 exit status
    make: *** [hello] Error 1

    My doubt is whether the procedure was correct, if so, does anyone know what the libs that I put in patches? If not, what the correct procedure?

  • "My doubt is whether the procedure was correct ..."

    I also was doubting whether your procedure is correct because I could only see your "-L" specifications for where the linker should look for libraries and could not find the "-l" specification for which libraries to link.

    sourceware.org/.../Options.html

  • Your Makefile is not using the -L options in the link step. Maybe you want to have

    \t$(CC) $(OBJS) $(CC_OPTS) -o $(TARGET)
    

    ["\t" should be a TAB]

    Or maybe split the -L options in CC_OPTS off into LD_OPTS and use that in the link step instead.

  • Scott, thanks for trying to help, I did as you suggested, see below for the makefile and exit.
    Did you not have done as an example makefile?

    TOOLCHAIN = gcc

    TARGET = hello
    CPU = -march=armv5te
    CC_OPTS = -c -O1 -g \
    -I /home/Gabriel/DS-5-Workspace/distribution/filesystem/armv5t_mtx/usr/include/gtk-2.0 \
    -I /home/Gabriel/DS-5-Workspace/distribution/filesystem/armv5t_mtx/usr/include/glib-2.0 \
    -I /home/Gabriel/DS-5-Workspace/distribution/filesystem/armv5t_mtx/usr/lib/glib-2.0/include \
    -I /home/Gabriel/DS-5-Workspace/distribution/filesystem/armv5t_mtx/usr/include/cairo \
    -I /home/Gabriel/DS-5-Workspace/distribution/filesystem/armv5t_mtx/usr/include/pango-1.0 \
    -I /home/Gabriel/DS-5-Workspace/distribution/filesystem/armv5t_mtx/usr/lib/gtk-2.0/include \
    -I /home/Gabriel/DS-5-Workspace/distribution/filesystem/armv5t_mtx/usr/include/atk-1.0
    LD_OPTS = \
    -L /home/Gabriel/DS-5-Workspace/distribution/filesystem/armv5t_mtx/usr/lib/libgtk-x11-2.0.so \
    -L /home/Gabriel/DS-5-Workspace/distribution/filesystem/armv5t_mtx/usr/lib/libgdk-x11-2.0.so \
    -L /home/Gabriel/DS-5-Workspace/distribution/filesystem/armv5t_mtx/usr/lib/libgio-2.0.so \
    -L /home/Gabriel/DS-5-Workspace/distribution/filesystem/armv5t_mtx/usr/lib/libglib-2.0.so \
    -L /home/Gabriel/DS-5-Workspace/distribution/filesystem/armv5t_mtx/usr/lib/libatk-1.0.so \
    -L /home/Gabriel/DS-5-Workspace/distribution/filesystem/armv5t_mtx/usr/lib/libcairo.so \
    -L /home/Gabriel/DS-5-Workspace/distribution/filesystem/armv5t_mtx/usr/lib/libexpat.so \
    -L /home/Gabriel/DS-5-Workspace/distribution/filesystem/armv5t_mtx/usr/lib/libfontconfig.so \
    -L /home/Gabriel/DS-5-Workspace/distribution/filesystem/armv5t_mtx/usr/lib/libfreetype.so \
    -L /home/Gabriel/DS-5-Workspace/distribution/filesystem/armv5t_mtx/usr/lib/libgdk_pixbuf-2.0.so \
    -L /home/Gabriel/DS-5-Workspace/distribution/filesystem/armv5t_mtx/usr/lib/libgmodule-2.0.so \
    -L /home/Gabriel/DS-5-Workspace/distribution/filesystem/armv5t_mtx/usr/lib/libgobject-2.0.so \
    -L /home/Gabriel/DS-5-Workspace/distribution/filesystem/armv5t_mtx/usr/lib/libpangocairo-1.0.so \
    -L /home/Gabriel/DS-5-Workspace/distribution/filesystem/armv5t_mtx/usr/lib/libpangoft2.so \
    -L /home/Gabriel/DS-5-Workspace/distribution/filesystem/armv5t_mtx/usr/lib/libpixman-1.so \
    -L /home/Gabriel/DS-5-Workspace/distribution/filesystem/armv5t_mtx/usr/lib/libpng12.so \
    -L /home/Gabriel/DS-5-Workspace/distribution/filesystem/armv5t_mtx/usr/lib/libx11.so \
    -L /home/Gabriel/DS-5-Workspace/distribution/filesystem/armv5t_mtx/usr/lib/libXau.so \
    -L /home/Gabriel/DS-5-Workspace/distribution/filesystem/armv5t_mtx/usr/lib/libXcursor.so \
    -L /home/Gabriel/DS-5-Workspace/distribution/filesystem/armv5t_mtx/usr/lib/libXdmcp.so \
    -L /home/Gabriel/DS-5-Workspace/distribution/filesystem/armv5t_mtx/usr/lib/libXext.so \
    -L /home/Gabriel/DS-5-Workspace/distribution/filesystem/armv5t_mtx/usr/lib/libXfixes.so \
    -L /home/Gabriel/DS-5-Workspace/distribution/filesystem/armv5t_mtx/usr/lib/libXrandr.so \
    -L /home/Gabriel/DS-5-Workspace/distribution/filesystem/armv5t_mtx/usr/lib/libXrender.so \
    -L /home/Gabriel/DS-5-Workspace/distribution/filesystem/armv5t_mtx/usr/lib/libz.so \
    -L /home/Gabriel/DS-5-Workspace/gnometris/libgames-support.so \
    -L /home/Gabriel/DS-5-Workspace/example_library/libsorts.so
    OBJS = hello.o
    STRIPPED_DIR = stripped

    .......

    all: $(TARGET) $(call DONE,$(TARGET))

    rebuild: clean all

    clean: $(call RM,$(CONFIG_FILE)) $(call RM,$(OBJS)) $(call RM,$(TARGET)) $(call RM,$(STRIPPED_DIR)/$(TARGET))

    # Create the configuration file so that the ARM compiler can find the GCC headers and libraries
    $(CONFIG_FILE): armcc --arm_linux_configure --arm_linux_config_file=$(CONFIG_FILE)

    # Compile the sources
    $(OBJS): %.o: %.c $(CONFIG_FILE) $(CC) $(CPU) $(CC_OPTS) $< -o $@

    # Link the objects together to create an executable
    # Strip the host/debug version to create a stripped/nodebug version for downloading to the target
    $(TARGET): $(OBJS) $(CONFIG_FILE) $(call MD,$(STRIPPED_DIR)) $(CC) $(OBJS) $(LD_OPTS) -o $(TARGET) $(STRIP_APP) $(TARGET) -o $(STRIPPED_DIR)/$(TARGET)

    **** Build of configuration Default for project hello ****
    .....

    /example_library/libsorts.so -o hello
    hello.o: In function 'main':
    /home/Gabriel/DS-5-Workspace/hello/hello.c:22: undefined reference to 'gtk_init'
    /home/Gabriel/DS-5-Workspace/hello/hello.c:23: undefined reference to 'gtk_window_new'
    /home/Gabriel/DS-5-Workspace/hello/hello.c:24: undefined reference to 'gtk_window_get_type'
    /home/Gabriel/DS-5-Workspace/hello/hello.c:24: undefined reference to 'g_type_check_instance_cast'
    /home/Gabriel/DS-5-Workspace/hello/hello.c:24: undefined reference to 'gtk_window_set_title'
    /home/Gabriel/DS-5-Workspace/hello/hello.c:25: undefined reference to 'gtk_widget_show'
    /home/Gabriel/DS-5-Workspace/hello/hello.c:26: undefined reference to 'gtk_main'
    collect2: ld returned 1 exit status
    make: *** [hello] Error 1

  • You're still specifying library files instead of pathnames for -L arguments.

  • I tried this also, but he complained that it did not find the way..

    LD2_OPTS = \
    -l /home/Gabriel/DS-5-Workspace/distribution/filesystem/armv5t_mtx/usr/lib/libgtk-x11-2.0 \
    -l /home/Gabriel/DS-5-Workspace/distribution/filesystem/armv5t_mtx/usr/lib/libgdk-x11-2.0 \
    -l /home/Gabriel/DS-5-Workspace/distribution/filesystem/armv5t_mtx/usr/lib/libgio-2.0 \
    -l /home/Gabriel/DS-5-Workspace/distribution/filesystem/armv5t_mtx/usr/lib/libglib-2.0 \
    -l /home/Gabriel/DS-5-Workspace/distribution/filesystem/armv5t_mtx/usr/lib/libatk-1.0 \
    -l /home/Gabriel/DS-5-Workspace/distribution/filesystem/armv5t_mtx/usr/lib/libcairo \
    -l /home/Gabriel/DS-5-Workspace/distribution/filesystem/armv5t_mtx/usr/lib/libexpat \
    -l /home/Gabriel/DS-5-Workspace/distribution/filesystem/armv5t_mtx/usr/lib/libfontconfig \
    -l /home/Gabriel/DS-5-Workspace/distribution/filesystem/armv5t_mtx/usr/lib/libfreetype \
    -l /home/Gabriel/DS-5-Workspace/distribution/filesystem/armv5t_mtx/usr/lib/libgdk_pixbuf-2.0 \
    -l /home/Gabriel/DS-5-Workspace/distribution/filesystem/armv5t_mtx/usr/lib/libgmodule-2.0 \
    -l /home/Gabriel/DS-5-Workspace/distribution/filesystem/armv5t_mtx/usr/lib/libgobject-2.0 \
    -l /home/Gabriel/DS-5-Workspace/distribution/filesystem/armv5t_mtx/usr/lib/libpangocairo-1.0 \
    -l /home/Gabriel/DS-5-Workspace/distribution/filesystem/armv5t_mtx/usr/lib/libpangoft2 \
    -l /home/Gabriel/DS-5-Workspace/distribution/filesystem/armv5t_mtx/usr/lib/libpixman-1 \
    -l /home/Gabriel/DS-5-Workspace/distribution/filesystem/armv5t_mtx/usr/lib/libpng12 \
    -l /home/Gabriel/DS-5-Workspace/distribution/filesystem/armv5t_mtx/usr/lib/libx11 \
    -l /home/Gabriel/DS-5-Workspace/distribution/filesystem/armv5t_mtx/usr/lib/libXau \
    -l /home/Gabriel/DS-5-Workspace/distribution/filesystem/armv5t_mtx/usr/lib/libXcursor \
    -l /home/Gabriel/DS-5-Workspace/distribution/filesystem/armv5t_mtx/usr/lib/libXdmcp \
    -l /home/Gabriel/DS-5-Workspace/distribution/filesystem/armv5t_mtx/usr/lib/libXext \
    -l /home/Gabriel/DS-5-Workspace/distribution/filesystem/armv5t_mtx/usr/lib/libXfixes \
    -l /home/Gabriel/DS-5-Workspace/distribution/filesystem/armv5t_mtx/usr/lib/libXrandr \
    -l /home/Gabriel/DS-5-Workspace/distribution/filesystem/armv5t_mtx/usr/lib/libXrender \
    -l /home/Gabriel/DS-5-Workspace/distribution/filesystem/armv5t_mtx/usr/lib/libz \

  • You are mixing randomly. -L is for path (not full file name). -l is for base name (skip lib prefix and extension) or full name.

    In your most recent attempt, you used a full path with -l but didn't give full name with extension.

    But why not just use:

    -L /home/Gabriel/DS-5-Workspace/distribution/filesystem/armv5t_mtx/usr/lib \ 
    -l gtk-x11-2.0 \ 
    -l gdk-x11-2.0 \ 
    -l gio-2.0 \ 
    -l glib-2.0 \ 
    ...
    

  • So also tested:

    LD2_OPTS = \
    -l /home/Gabriel/DS-5-Workspace/distribution/filesystem/armv5t_mtx/usr/lib/libgtk-x11-2.0.so \
    -l /home/Gabriel/DS-5-Workspace/distribution/filesystem/armv5t_mtx/usr/lib/libgdk-x11-2.0.so \
    -l /home/Gabriel/DS-5-Workspace/distribution/filesystem/armv5t_mtx/usr/lib/libgio-2.0.so \
    ....

    *** Build of configuration Default for project hello ****

    make all
    arm-none-linux-gnueabi-gcc hello.o -l /home/Gabriel/DS-5-Workspace/distribution/filesystem/armv5t_mtx/usr/lib/libgtk-x11-2.0.so -l /home/Gabriel/DS-5-Workspace/distribution/filesystem/armv5t_mtx/usr/lib/libgdk-x11-2.0.so -l /home/Gabriel/DS-5-Workspace/distribution/filesystem/armv5t_mtx/usr/lib/libgio-2.0.so -l /home/Gabriel/DS-5-Workspace/distribution/filesystem/armv5t_mtx/usr/lib/libglib-2.0 -l /home/Gabriel/DS-5-Workspace/distribution/filesystem/armv5t_mtx/usr/lib/libatk-1.0 -l /home/Gabriel/DS-5-Workspace/distribution/filesystem/armv5t_mtx/usr/lib/libcairo -l /home/Gabriel/DS-5-Workspace/distribution/filesystem/armv5t_mtx/usr/lib/libexpat -l /home/Gabriel/DS-5-Workspace/distribution/filesystem/armv5t_mtx/usr/lib/libfontconfig -l /home/Gabriel/DS-5-Workspace/distribution/filesystem/armv5t_mtx/usr/lib/libfreetype -l /home/Gabriel/DS-5-Workspace/distribution/filesystem/armv5t_mtx/usr/lib/libgdk_pixbuf-2.0 -l /home/Gabriel/DS-5-Workspace/distribution/filesystem/armv5t_mtx/usr/lib/libgmodule-2.0 -l /home/Gabriel/DS-5-Workspace/distribution/filesystem/armv5t_mtx/usr/lib/libgobject-2.0 -l /home/Gabriel/DS-5-Workspace/distribution/filesystem/armv5t_mtx/usr/lib/libpangocairo-1.0 -l /home/Gabriel/DS-5-Workspace/distribution/filesystem/armv5t_mtx/usr/lib/libpangoft2 -l /home/Gabriel/DS-5-Workspace/distribution/filesystem/armv5t_mtx/usr/lib/libpixman-1 -l /home/Gabriel/DS-5-Workspace/distribution/filesystem/armv5t_mtx/usr/lib/libpng12 -l /home/Gabriel/DS-5-Workspace/distribution/filesystem/armv5t_mtx/usr/lib/libx11 -l /home/Gabriel/DS-5-Workspace/distribution/filesystem/armv5t_mtx/usr/lib/libXau -l /home/Gabriel/DS-5-Workspace/distribution/filesystem/armv5t_mtx/usr/lib/libXcursor -l /home/Gabriel/DS-5-Workspace/distribution/filesystem/armv5t_mtx/usr/lib/libXdmcp -l /home/Gabriel/DS-5-Workspace/distribution/filesystem/armv5t_mtx/usr/lib/libXext -l /home/Gabriel/DS-5-Workspace/distribution/filesystem/armv5t_mtx/usr/lib/libXfixes -l /home/Gabriel/DS-5-Workspace/distribution/filesystem/armv5t_mtx/usr/lib/libXrandr -l /home/Gabriel/DS-5-Workspace/distribution/filesystem/armv5t_mtx/usr/lib/libXrender -l /home/Gabriel/DS-5-Workspace/distribution/filesystem/armv5t_mtx/usr/lib/libz -o hello
    /usr/local/DS-5/sw/gcc/bin/../lib/gcc/arm-none-linux-gnueabi/4.4.1/../../../../arm-none-linux-gnueabi/bin/ld: cannot find -l/home/Gabriel/DS-5-Workspace/distribution/filesystem/armv5t_mtx/usr/lib/libgtk-x11-2.0.so
    collect2: ld returned 1 exit status
    make: *** [hello] Error 1

  • i am a beginner.. now i am facing the same problem but little different as

    i want to create application in ARM board.. so i used the tool gtk for creating application..

    my source file is base.c
    root@habesh-laptop:~# cd habesh/gtk/
    root@habesh-laptop:~/habesh/gtk# ls
    base.c

    i compiled it for ubuntu using
    root@habesh-laptop:~/habesh/gtk#gcc -o base base.c 'pkg-config --cflags --libs gtk+-2.0'

    i can compile it for ubuntu and it works... this is where the toolchain is available...
    root@habesh-laptop:/opt/ARTOS_toolchain_1.3/bin# ls
    arm-linux-addr2line arm-linux-c++filt arm-linux-gcc-3.4.4 arm-linux-nm arm-linux-readelf ld pam_tally
    arm-linux-ar arm-linux-cpp arm-linux-gccbug arm-linux-objcopy arm-linux-size libpng12-config unix_chkpwd
    arm-linux-as arm-linux-g++ arm-linux-gcov arm-linux-objdump arm-linux-strings libpng-config
    arm-linux-c++ arm-linux-gcc arm-linux-ld arm-linux-ranlib arm-linux-strip mkimage

    so i cross compiled for target using
    root@habesh-laptop:~/habesh/gtk# /opt/ARTOS_toolchain_1.3/bin/arm-linux-gcc -o trail base.c 'pkg-config --cflags --libs gtk+-2.0'
    /opt/ARTOS_toolchain_1.3/bin/../lib/gcc/arm-linux/3.4.4/../../../../arm-linux/bin/ld: cannot find -lgtk-x11-2.0
    collect2: ld returned 1 exit status

    what is the problem.. please help me...