public inbox for ecos-discuss@sourceware.org
 help / color / mirror / Atom feed
* [ECOS] Building and linking Static library with the eCos executable.
@ 2008-06-26 11:13 jawad rehman
  2008-06-26 21:37 ` Andrew Lunn
  2008-06-26 21:56 ` Alexander Neundorf
  0 siblings, 2 replies; 3+ messages in thread
From: jawad rehman @ 2008-06-26 11:13 UTC (permalink / raw)
  To: ecos-discuss

Hi there,

I have a problem in to add a static library with an application
executable for eCos. Actually I have two projects and have made three
cmake files for both the project. One is to include the sub folders
for the projects and second  is for the project to create a static
library by using cmake add_library statement and third cmake file is
for the other project to build the executable for the eCos where I am
link the the static library but I got the following errors;

Linking CXX executable helloDemo.elf
CMakeFiles/helloDemo.dir/demo.o: In function `main':
CMakeFiles/helloDemo.dir/demo.o(.text+0x19): undefined reference to
`Hello::Print()'
collect2: ld returned 1 exit status
make[2]: *** [Demo/helloDemo.elf] Error 1
make[1]: *** [Demo/CMakeFiles/helloDemo.dir/all] Error 2
make: *** [all] Error 2

I think the eCos "USEECOS" include does not support the add_library
statement. Is  there any way to create a static libray for the eCos
executable or some thing like add_library .

Following are the list files.

1)      CMakeList.txt in the root folder which include sub folders for the
build.

project (HELLO)
add_subdirectory (Hello)
add_subdirectory (Demo)

2). CMakeList.txt in the hello project to build a static library.
add_library (Hello hello.cxx)

3.  CMakeList.txt in the demo project to build an eCos executable .
 include(UseEcos)
include_directories (${HELLO_SOURCE_DIR}/Hello)
link_directories (${HELLO_BINARY_DIR}/Hello)
ECOS_ADJUST_DIRECTORY(target_SRCS ${SRC_LIST})
ECOS_ADD_INCLUDE_DIRECTORIES()
ECOS_USE_I386_ELF_TOOLS()
ECOS_ADD_EXECUTABLE(helloDemo demo.cxx demo_b.cxx)
target_link_libraries (helloDemo Hello)

Please provide some advise, it would really be appreciated.

Regards.
===========================
A cigarette shortens your life by 2 min..
A beer shortens your life by 4 min..
A working day shortens your life by 8 hours!!!!..

-- 
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [ECOS] Building and linking Static library with the eCos  executable.
  2008-06-26 11:13 [ECOS] Building and linking Static library with the eCos executable jawad rehman
@ 2008-06-26 21:37 ` Andrew Lunn
  2008-06-26 21:56 ` Alexander Neundorf
  1 sibling, 0 replies; 3+ messages in thread
From: Andrew Lunn @ 2008-06-26 21:37 UTC (permalink / raw)
  To: jawad rehman; +Cc: ecos-discuss

On Thu, Jun 26, 2008 at 03:07:45PM +0500, jawad rehman wrote:
> Hi there,
> 
> I have a problem in to add a static library with an application
> executable for eCos. Actually I have two projects and have made three
> cmake files for both the project. One is to include the sub folders
> for the projects and second  is for the project to create a static
> library by using cmake add_library statement and third cmake file is
> for the other project to build the executable for the eCos where I am
> link the the static library but I got the following errors;

eCos does not use cmake makefiles. This is not an eCos problem. I
suggest you try on the cmake mailing lists.

        Andrew

-- 
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [ECOS] Building and linking Static library with the eCos executable.
  2008-06-26 11:13 [ECOS] Building and linking Static library with the eCos executable jawad rehman
  2008-06-26 21:37 ` Andrew Lunn
@ 2008-06-26 21:56 ` Alexander Neundorf
  1 sibling, 0 replies; 3+ messages in thread
From: Alexander Neundorf @ 2008-06-26 21:56 UTC (permalink / raw)
  To: ecos-discuss

On Thursday 26 June 2008, jawad rehman wrote:
> Hi there,
>
> I have a problem in to add a static library with an application
> executable for eCos. Actually I have two projects and have made three
> cmake files for both the project. One is to include the sub folders
> for the projects and second  is for the project to create a static
> library by using cmake add_library statement and third cmake file is
> for the other project to build the executable for the eCos where I am
> link the the static library but I got the following errors;
>
> Linking CXX executable helloDemo.elf
> CMakeFiles/helloDemo.dir/demo.o: In function `main':
> CMakeFiles/helloDemo.dir/demo.o(.text+0x19): undefined reference to
> `Hello::Print()'
> collect2: ld returned 1 exit status
> make[2]: *** [Demo/helloDemo.elf] Error 1
> make[1]: *** [Demo/CMakeFiles/helloDemo.dir/all] Error 2
> make: *** [all] Error 2
>
> I think the eCos "USEECOS" include does not support the add_library
> statement. Is  there any way to create a static libray for the eCos
> executable or some thing like add_library .
>
> Following are the list files.
>
> 1)      CMakeList.txt in the root folder which include sub folders for the
> build.
>
> project (HELLO)
> add_subdirectory (Hello)
> add_subdirectory (Demo)
>
> 2). CMakeList.txt in the hello project to build a static library.
> add_library (Hello hello.cxx)
>
> 3.  CMakeList.txt in the demo project to build an eCos executable .

This CMakeLists.txt is basically correct. The problem is that you build only 
the executable for eCos, the library is built for the build host. 
So I would suggest to put the following three lines after the project() 
command in the top level CMakeLists.txt.

> include(UseEcos)
> ECOS_ADD_INCLUDE_DIRECTORIES()
> ECOS_USE_I386_ELF_TOOLS()

> include_directories (${HELLO_SOURCE_DIR}/Hello)
> link_directories (${HELLO_BINARY_DIR}/Hello)

You don't need this line, this is only when you use the "complex" directory 
layout as described in http://www.linuxdevices.com/articles/AT6762290643.html
> ECOS_ADJUST_DIRECTORY(target_SRCS ${SRC_LIST})

> ECOS_ADD_EXECUTABLE(helloDemo demo.cxx demo_b.cxx)
> target_link_libraries (helloDemo Hello)
>
> Please provide some advise, it would really be appreciated.

If these hints don't help, please let me know. 
In that case please do 
"make clean; make VERBOSE=1" and post the output, so I can see what's 
happening.

Alex

-- 
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2008-06-26 21:37 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-06-26 11:13 [ECOS] Building and linking Static library with the eCos executable jawad rehman
2008-06-26 21:37 ` Andrew Lunn
2008-06-26 21:56 ` Alexander Neundorf

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).