From: Jonathan Wakely <jwakely.gcc@gmail.com>
To: HvW <hermanv@process-auto.com>
Cc: gcc-help@gcc.gnu.org
Subject: Re: Building library with extern data fails in GCC
Date: Sun, 02 Sep 2012 22:50:00 -0000 [thread overview]
Message-ID: <CAH6eHdS3DSrj2OPazf8J1Bo8xikYxHR4uzyASHNoagVF4C-xcA@mail.gmail.com> (raw)
In-Reply-To: <1346413874515-865274.post@n5.nabble.com>
On Aug 31, 2012 2:51 PM, "HvW" wrote:
>
> Hi,
>
> I am trying to create a library that handles the USART TX and RX data. The
> buffer used for the TX and RX data I declared as extern as this needs to be
> specified by the application using the library. This works fine in Keil
> ARM-MDK. Attempting to build this in the latest version of GCC shows the
> following errors:
>
> C:\yagarto_cortex_m3\bin\arm-none-eabi-gcc libhl_usart.o -mcpu=cortex-m3
> -mthumb -nostartfiles -Tstm32f103x_xl_flash.ld
> -Wl,-Map=lib_usart.map,--cref,--no-warn-mismatch -L./lib/ -lm -lgcc -lc
> ./lib/lib_stm3210x_xl_stdperiph.a -o lib_usart.elf
> libhl_usart.o: In function `Libhl_Usart_Lib_Init':
> libhl_usart.c:(.text+0x1a): undefined reference to `Libhl_Usart2_Tx_Buff'
> libhl_usart.c:(.text+0x1e): undefined reference to `Libhl_Usart2_Tx_Buff'
> libhl_usart.c:(.text+0x2c): undefined reference to `Libhl_Usart3_Tx_Buff'
> libhl_usart.c:(.text+0x30): undefined reference to `Libhl_Usart3_Tx_Buff'
> libhl_usart.c:(.text+0x3e): undefined reference to `Libhl_Uart4_Tx_Buff'
> libhl_usart.c:(.text+0x42): undefined reference to `Libhl_Uart4_Tx_Buff'
> libhl_usart.c:(.text+0x50): undefined reference to `Libhl_Uart5_Tx_Buff'
> libhl_usart.c:(.text+0x54): undefined reference to `Libhl_Uart5_Tx_Buff'
> libhl_usart.c:(.text+0x62): undefined reference to `Libhl_Usart1_Rx_Buff'
> libhl_usart.c:(.text+0x66): undefined reference to
>
>
> I am sure that I am just missing some compiler option that will allow it to
> assume that the data will be available when needed.
>
> I am attaching the code and makefile.
I haven't looked at the code or makefile, but the command above
doesn't tell gcc to build a library, it builds a final executable, or
tries to. To create a shared library use the gcc option -shared, or to
create a static library use ar instead of gcc.
prev parent reply other threads:[~2012-09-02 22:50 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-08-31 19:24 HvW
2012-09-02 22:50 ` Jonathan Wakely [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=CAH6eHdS3DSrj2OPazf8J1Bo8xikYxHR4uzyASHNoagVF4C-xcA@mail.gmail.com \
--to=jwakely.gcc@gmail.com \
--cc=gcc-help@gcc.gnu.org \
--cc=hermanv@process-auto.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).