sudhir katta
11/15/2011 3:10 PM
post90105
|
This is my first posting on this forum and I'm newbie to QNX development. I'm developing drivers and application for QNX
6.4.1 target system and using QNX6.5 IDE.
I'm able to complie, link and run a simple program on the target. I can compile my code to get the object files IP330.o
,IP480.o, IPTest.o, apc8620.o but I'm getting linking problem during building the project.
common.mk :
# This is an automatically generated record.
# The area between QNX Internal Start and QNX Internal End is controlled by
# the QNX IDE properties.
ifndef QCONFIG
QCONFIG=qconfig.mk
endif
include $(QCONFIG)
#===== USEFILE - the file containing the usage message for the application.
USEFILE=
# Next lines are for C++ projects only
EXTRA_SUFFIXES+=cxx cpp
#===== LDFLAGS - add the flags to the linker command line.
LDFLAGS+=-lang-c++ -l
VFLAG_g=-gstabs+
#===== EXTRA_LIBVPATH - a space-separated list of directories to search for library files.
EXTRA_LIBVPATH+=$(PROJECT_ROOT_apc8620_lib)/$(CPU)/$(patsubst o%,a%,$(notdir $(CURDIR))) \
$(PROJECT_ROOT_apc8620_lib)/$(CPU)/$(patsubst o%,so%,$(notdir $(CURDIR)))
#===== CCFLAGS - add the flags to the C compiler command line.
CCFLAGS+=-w
include $(MKFILES_ROOT)/qmacros.mk
ifndef QNX_INTERNAL
QNX_INTERNAL=$(PROJECT_ROOT)/.qnx_internal.mk
endif
include $(QNX_INTERNAL)
include $(MKFILES_ROOT)/qtargets.mk
OPTIMIZE_TYPE_g=none
OPTIMIZE_TYPE=$(OPTIMIZE_TYPE_$(filter g, $(VARIANTS)))
Console Output:
/opt/qnx650/host/linux/x86/usr/bin/make -k CPULIST=x86 all --file=/tmp/QMakefile132138304544122139.tmp
/opt/qnx650/host/linux/x86/usr/bin/make -j 1 -Cx86 -fMakefile all
make[1]: Entering directory `/usr0/home/skatta/QNX_Workspace/ide-4.7-workspace/courier/x86'
/opt/qnx650/host/linux/x86/usr/bin/make -j 1 -Co -fMakefile all
make[2]: Entering directory `/usr0/home/skatta/QNX_Workspace/ide-4.7-workspace/courier/x86/o'
/bin/rm -f /usr0/home/skatta/QNX_Workspace/ide-4.7-workspace/courier/x86/o/courier
/opt/qnx650/host/linux/x86/usr/bin/qcc -Vgcc_ntox86 -lang-c++ -l -o/usr0/home/skatta/QNX_Workspace/ide-4.7-workspace
/courier/x86/o/courier IP330.o IP480.o IPTest.o apc8620.o -L . -L /x86/a -L /x86/so -L /opt/qnx650/target/
qnx6/x86/lib -L /opt/qnx650/target/qnx6/x86/usr/lib -Wl,--rpath-link . -Wl,--rpath-link /x86/a -Wl,--rpath-link /x86/so
-Wl,--rpath-link /opt/qnx650/target/qnx6/x86/lib -Wl,--rpath-link /opt/qnx650/target/qnx6/x86/usr/lib
make[2]: Leaving directory `/usr0/home/skatta/QNX_Workspace/ide-4.7-workspace/courier/x86/o'
/opt/qnx650/host/linux/x86/usr/bin/make -j 1 -Co-g -fMakefile all
make[2]: Entering directory `/usr0/home/skatta/QNX_Workspace/ide-4.7-workspace/courier/x86/o-g'
/bin/rm -f /usr0/home/skatta/QNX_Workspace/ide-4.7-workspace/courier/x86/o-g/courier_g
/opt/qnx650/host/linux/x86/usr/bin/qcc -Vgcc_ntox86 -lang-c++ -l -o/usr0/home/skatta/QNX_Workspace/ide-4.7-workspace
/courier/x86/o-g/courier_g IP330.o IP480.o IPTest.o apc8620.o -L . -L /x86/a-g -L /x86/so-g -L /opt/qnx650
/target/qnx6/x86/lib -L /opt/qnx650/target/qnx6/x86/usr/lib -Wl,--rpath-link . -Wl,--rpath-link /x86/a-g -Wl,--rpath-
link /x86/so-g -Wl,--rpath-link /opt/qnx650/target/qnx6/x86/lib -Wl,--rpath-link /opt/qnx650/target/qnx6/x86/usr/lib
-g
/opt/qnx650/host/linux/x86/usr/bin/ntox86-ld: cannot find -l-o/usr0/home/skatta/QNX_Workspace/ide-4.7-workspace/courier/
x86/o/courier
cc: /opt/qnx650/host/linux/x86/usr/bin/ntox86-ld error 1
make[2]: *** [/usr0/home/skatta/QNX_Workspace/ide-4.7-workspace/courier/x86/o/courier] Error 1
make[2]: Target `all' not remade because of errors.
make[1]: [all] Error 2 (ignored)
/opt/qnx650/host/linux/x86/usr/bin/ntox86-ld: cannot find -l-o/usr0/home/skatta/QNX_Workspace/ide-4.7-workspace/courier/
x86/o-g/courier_g
cc: /opt/qnx650/host/linux/x86/usr/bin/ntox86-ld error 1
make[2]: *** [/usr0/home/skatta/QNX_Workspace/ide-4.7-workspace/courier/x86/o-g/courier_g] Error 1
make[2]:...
View Full Message
|
|
|
Ryan Mansfield(deleted)
11/15/2011 3:15 PM
post90106
|
On 11-11-15 03:10 PM, sudhir katta wrote:
> This is my first posting on this forum and I'm newbie to QNX development. I'm developing drivers and application for
QNX 6.4.1 target system and using QNX6.5 IDE.
> I'm able to complie, link and run a simple program on the target. I can compile my code to get the object files IP330
.o,IP480.o, IPTest.o, apc8620.o but I'm getting linking problem during building the project.
> #===== LDFLAGS - add the flags to the linker command line.
> LDFLAGS+=-lang-c++ -l
-l takes an arg, and since there's no arg, the final link is being
parsed as -l
"-o/usr0/home/skatta/QNX_Workspace/ide-4.7-workspace/courier/x86/o/courier"
Remove the -l or add whatever the missing library name is.
Regards,
Ryan Mansfield
|
|
|
sudhir katta
11/15/2011 3:56 PM
post90110
|
Rayan, Thank you very much for quick reply.
I have removed -l but still I have linking errors. Here is my console output.
apc8620.h has all the references and it is included in IP330.c. I think IP330.o is not able to find references to `
apc8620_write_8' that are in apc8620.h.
/opt/qnx650/host/linux/x86/usr/bin/make -k CPULIST=x86 all --file=/tmp/QMakefile132138946534222147.tmp
/opt/qnx650/host/linux/x86/usr/bin/make -j 1 -Cx86 -fMakefile all
make[1]: Entering directory `/usr0/home/skatta/QNX_Workspace/ide-4.7-workspace/courier/x86'
/opt/qnx650/host/linux/x86/usr/bin/make -j 1 -Co -fMakefile all
make[2]: Entering directory `/usr0/home/skatta/QNX_Workspace/ide-4.7-workspace/courier/x86/o'
/opt/qnx650/host/linux/x86/usr/bin/qcc -Vgcc_ntox86 -c -Wc,-Wall -O -w -DNDEBUG -I. -I/usr0/home/skatta/
QNX_Workspace/ide-4.7-workspace/courier/x86/o -I/usr0/home/skatta/QNX_Workspace/ide-4.7-workspace/courier/x86 -I/usr0/
home/skatta/QNX_Workspace/ide-4.7-workspace/courier -I/opt/qnx650/target/qnx6/usr/include -DBUILDENV_qss /usr0/home
/skatta/QNX_Workspace/ide-4.7-workspace/courier/IP330.c
/opt/qnx650/host/linux/x86/usr/bin/qcc -Vgcc_ntox86 -c -Wc,-Wall -O -w -DNDEBUG -I. -I/usr0/home/skatta/
QNX_Workspace/ide-4.7-workspace/courier/x86/o -I/usr0/home/skatta/QNX_Workspace/ide-4.7-workspace/courier/x86 -I/usr0/
home/skatta/QNX_Workspace/ide-4.7-workspace/courier -I/opt/qnx650/target/qnx6/usr/include -DBUILDENV_qss /usr0/home
/skatta/QNX_Workspace/ide-4.7-workspace/courier/IP480.c
/opt/qnx650/host/linux/x86/usr/bin/qcc -Vgcc_ntox86 -c -Wc,-Wall -O -w -DNDEBUG -I. -I/usr0/home/skatta/
QNX_Workspace/ide-4.7-workspace/courier/x86/o -I/usr0/home/skatta/QNX_Workspace/ide-4.7-workspace/courier/x86 -I/usr0/
home/skatta/QNX_Workspace/ide-4.7-workspace/courier -I/opt/qnx650/target/qnx6/usr/include -DBUILDENV_qss /usr0/home
/skatta/QNX_Workspace/ide-4.7-workspace/courier/IPTest.c
/opt/qnx650/host/linux/x86/usr/bin/qcc -Vgcc_ntox86 -c -Wc,-Wall -O -w -DNDEBUG -I. -I/usr0/home/skatta/
QNX_Workspace/ide-4.7-workspace/courier/x86/o -I/usr0/home/skatta/QNX_Workspace/ide-4.7-workspace/courier/x86 -I/usr0/
home/skatta/QNX_Workspace/ide-4.7-workspace/courier -I/opt/qnx650/target/qnx6/usr/include -DBUILDENV_qss /usr0/home
/skatta/QNX_Workspace/ide-4.7-workspace/courier/apc8620.c
/bin/rm -f /usr0/home/skatta/QNX_Workspace/ide-4.7-workspace/courier/x86/o/courier
/opt/qnx650/host/linux/x86/usr/bin/qcc -Vgcc_ntox86 -lang-c++ -o/usr0/home/skatta/QNX_Workspace/ide-4.7-workspace/
courier/x86/o/courier IP330.o IP480.o IPTest.o apc8620.o -L . -L /x86/a -L /x86/so -L /opt/qnx650/target/
qnx6/x86/lib -L /opt/qnx650/target/qnx6/x86/usr/lib -Wl,--rpath-link . -Wl,--rpath-link /x86/a -Wl,--rpath-link /x86/so
-Wl,--rpath-link /opt/qnx650/target/qnx6/x86/lib -Wl,--rpath-link /opt/qnx650/target/qnx6/x86/usr/lib
make[2]: Leaving directory `/usr0/home/skatta/QNX_Workspace/ide-4.7-workspace/courier/x86/o'
/opt/qnx650/host/linux/x86/usr/bin/make -j 1 -Co-g -fMakefile all
make[2]: Entering directory `/usr0/home/skatta/QNX_Workspace/ide-4.7-workspace/courier/x86/o-g'
/opt/qnx650/host/linux/x86/usr/bin/qcc -Vgcc_ntox86 -c -Wc,-Wall -w -I. -I/usr0/home/skatta/QNX_Workspace/
ide-4.7-workspace/courier/x86/o -I/usr0/home/skatta/QNX_Workspace/ide-4.7-workspace/courier/x86/o-g -I/usr0/home/skatta/
QNX_Workspace/ide-4.7-workspace/courier/x86 -I/usr0/home/skatta/QNX_Workspace/ide-4.7-workspace/courier -I/opt/qnx650/
target/qnx6/usr/include -g -DVARIANT_g -DBUILDENV_qss /usr0/home/skatta/QNX_Workspace/ide-4.7-workspace/courier/
IP330.c
/opt/qnx650/host/linux/x86/usr/bin/qcc -Vgcc_ntox86 -c -Wc,-Wall -w -I. -I/usr0/home/skatta/QNX_Workspace/
ide-4.7-workspace/courier/x86/o -I/usr0/home/skatta/QNX_Workspace/ide-4.7-workspace/courier/x86/o-g -I/usr0/home/skatta/
QNX_Workspace/ide-4.7-workspace/courier/x86...
View Full Message
|
|
|
Ryan Mansfield(deleted)
11/15/2011 4:17 PM
post90112
|
On 11-11-15 03:56 PM, sudhir katta wrote:
> Rayan, Thank you very much for quick reply.
> I have removed -l but still I have linking errors. Here is my console output.
>
> apc8620.h has all the references and it is included in IP330.c. I think IP330.o is not able to find references to `
apc8620_write_8' that are in apc8620.h.
> /usr0/home/skatta/QNX_Workspace/ide-4.7-workspace/courier/IP330.c:98: undefined reference to `apc8620_write_8'
> /usr0/home/skatta/QNX_Workspace/ide-4.7-workspace/courier/IP330.c:99: undefined reference to `apc8620_write_8'
The problem is that you're not linking in the library that provides
these definitions. Normally headers provide declarations but not
definitions so including the header is insufficient. I can't tell you
the library name that contains these symbols because they're don't come
from system libraries. When you find the library, you link it in with
-l<library name>. e.g. -lapc8620 or something.
Regards,
Ryan Mansfield
|
|
|
sudhir katta
11/16/2011 12:38 PM
post90134
|
Ryan,
1) I don't have external libraries. I have all the source code for the definition and it compiles to object files. I
have screenshot of my projects for your reference.
2) I tried to include "-I/usr0/home/skatta/QNX_Workspace/ide-4.7-workspace/courier/" but it didn't work.
/opt/qnx650/host/linux/x86/usr/bin/qcc -Vgcc_ntox86 -lang-c++ -o/usr0/home/skatta/QNX_Workspace/ide-4.7-workspace/
courier/x86/o-g/courier_g apc8620.o IP330.o IP480.o IPTest.o -L . -L /x86/a-g -L /x86/so-g -L /opt/qnx650/target/qnx6/
x86/lib -L /opt/qnx650/target/qnx6/x86/usr/lib -Wl,--rpath-link . -Wl,--rpath-link /x86/a-g -Wl,--rpath-link /x86/so-g
-Wl,--rpath-link /opt/qnx650/target/qnx6/x86/lib -Wl,--rpath-link /opt/qnx650/target/qnx6/x86/usr/lib, -I/usr0/home/
skatta/QNX_Workspace/ide-4.7-workspace/courier/ -wl, -g
3) I could not find this in documentation. What does --rpath-link does?
4) without IP modules apc8620 project builds and works fine. In courier project I have add new modules that uses apc8620
functions. IPTest calls IP330 and IP480. These IP modules call the apc8620 functions to write and read to memory.
Thanks,
Sudhir
|
Attachment: |
QNX
260.74 KB
|
|
|
sudhir katta
11/16/2011 12:39 PM
post90135
|
|
|
|
Ryan Mansfield(deleted)
11/16/2011 12:55 PM
post90136
|
On 11-11-16 12:38 PM, sudhir katta wrote:
> Ryan,
>
> 1) I don't have external libraries. I have all the source code for the definition and it compiles to object files. I
have screenshot of my projects for your reference.
Which object file these symbols then? Do an ntox86-nm on whatever object
you think provides them and make sure they're global symbols.
> 2) I tried to include "-I/usr0/home/skatta/QNX_Workspace/ide-4.7-workspace/courier/" but it didn't work.
-I is a compiler option to add to the compilers include search path so
add it when you're linking doesn't make sense.
> 3) I could not find this in documentation. What does --rpath-link does?
It set link time shared library search path but if you have all of your
symbols in objects then you shouldn't have to concern yourself with this
option.
> 4) without IP modules apc8620 project builds and works fine. In courier project I have add new modules that uses
apc8620 functions. IPTest calls IP330 and IP480. These IP modules call the apc8620 functions to write and read to
memory.
OK, again, if you're making use of these apc8620 functions, then you
either need to link them into your 'courier' project as object files, or
linking against a library that has them.
No one knwos where your symbols are defined except for you so you need
to find out where they are and link the code in. If you can tell us
where they come from, we can help you construct the appropriate way of
linking them in.
Regards,
Ryan Mansfield
|
|
|
|