Link Errors in Libraries: Undefined Reference

New to XMOS and XCore? Get started here.
lslarry86
Junior Member
Posts: 7
Joined: Wed Apr 11, 2018 1:35 pm

Link Errors in Libraries: Undefined Reference

Postby lslarry86 » Wed Aug 08, 2018 7:02 pm

Hi, I'm sure this has been answered before, but I can't pick it out in Search.

I'm building my first XMOS application. I want to end up with a control application with about 10 I/Os and 7 UARTs, along with an embedded website. My target hardware is a new xCORE-200 eXplorer board until I get software running, then I will be designing an XMOS version of this board:
http://gluelogix.com/TCU.shtml

I started out with a Test.xc and filled that in from "lib_uart-[userguide]_3.1.0rc1.pdf," then Imported lib_uart and lib_gpio. After setting relative paths to uart.h and gpio.h, it compiles. But it does not link, claiming that none of the library objects exist.

Build All Ctl-B does a lot of stuff then shows this:

Code: Select all

13:55:58 **** Incremental Build of configuration Debug for project Test1 ****
xmake CONFIG=Debug all
Checking build modules
No build modules used.
Creating Test1_Debug.xe
../src/Test1.xc: Error: Undefined reference to '__i_uart_rx_if_wait_for_data_and_read' (possible inline definition without external definition)
../src/Test1.xc: Error: Undefined reference to '_i.input_gpio_if.input_gpio_with_events._c0.event_when_pins_eq'
../src/Test1.xc: Error: Undefined reference to '_i.input_gpio_if.input_gpio_with_events._c0.input'
../src/Test1.xc: Error: Undefined reference to '_i.input_gpio_if.input_gpio_with_events._c0.input_and_timestamp'
../src/Test1.xc: Error: Undefined reference to '_i.output_gpio_if.output_gpio.0.output'
../src/Test1.xc: Error: Undefined reference to '_i.output_gpio_if.output_gpio.0.output_and_timestamp'
../src/Test1.xc: Error: Undefined reference to '_i.uart_tx_if.uart_tx.0.write'
../src/Test1.xc: Error: Undefined reference to 'input_gpio_with_events'
../src/Test1.xc: Error: Undefined reference to 'input_gpio_with_events.dynalloc_maxchanends'
../src/Test1.xc: Error: Undefined reference to 'input_gpio_with_events.dynalloc_maxcores'
../src/Test1.xc: Error: Undefined reference to 'input_gpio_with_events.dynalloc_maxtimers'
../src/Test1.xc: Error: Undefined reference to 'input_gpio_with_events.fini'
../src/Test1.xc: Error: Undefined reference to 'input_gpio_with_events.init.0'
../src/Test1.xc: Error: Undefined reference to 'input_gpio_with_events.init.0.savedstate'
../src/Test1.xc: Error: Undefined reference to 'input_gpio_with_events.init.1'
../src/Test1.xc: Error: Undefined reference to 'input_gpio_with_events.select.enable'
../src/Test1.xc: Error: Undefined reference to 'output_gpio'
../src/Test1.xc: Error: Undefined reference to 'output_gpio.dynalloc_maxchanends'
../src/Test1.xc: Error: Undefined reference to 'output_gpio.dynalloc_maxcores'
../src/Test1.xc: Error: Undefined reference to 'output_gpio.dynalloc_maxtimers'
../src/Test1.xc: Error: Undefined reference to 'output_gpio.fini'
../src/Test1.xc: Error: Undefined reference to 'output_gpio.init.0'
../src/Test1.xc: Error: Undefined reference to 'output_gpio.init.0.savedstate'
../src/Test1.xc: Error: Undefined reference to 'output_gpio.init.1'
../src/Test1.xc: Error: Undefined reference to 'uart_rx'
../src/Test1.xc: Error: Undefined reference to 'uart_rx.dynalloc_maxchanends'
../src/Test1.xc: Error: Undefined reference to 'uart_rx.dynalloc_maxcores'
../src/Test1.xc: Error: Undefined reference to 'uart_rx.dynalloc_maxtimers'
../src/Test1.xc: Error: Undefined reference to 'uart_rx.fini'
../src/Test1.xc: Error: Undefined reference to 'uart_rx.init.0'
../src/Test1.xc: Error: Undefined reference to 'uart_rx.init.0.savedstate'
../src/Test1.xc: Error: Undefined reference to 'uart_rx.init.1'
../src/Test1.xc: Error: Undefined reference to 'uart_rx.select.enable'
../src/Test1.xc: Error: Undefined reference to 'uart_tx'
../src/Test1.xc: Error: Undefined reference to 'uart_tx.dynalloc_maxchanends'
../src/Test1.xc: Error: Undefined reference to 'uart_tx.dynalloc_maxcores'
../src/Test1.xc: Error: Undefined reference to 'uart_tx.dynalloc_maxtimers'
../src/Test1.xc: Error: Undefined reference to 'uart_tx.fini'
../src/Test1.xc: Error: Undefined reference to 'uart_tx.init.0'
../src/Test1.xc: Error: Undefined reference to 'uart_tx.init.0.savedstate'
../src/Test1.xc: Error: Undefined reference to 'uart_tx.init.1'
xmake[1]: *** [bin/Debug/Test1_Debug.xe] Error 1
xmake: *** [bin/Debug/Test1_Debug.xe] Error 2

13:56:00 Build Finished (took 2s.144ms)


A zip of my workspace is attached. I don't see any binaries anywhere. There must be something simple missing from my project. Help?
Attachments
Workspace.zip
(1.22 MiB) Downloaded 6 times
Workspace.zip
(1.22 MiB) Downloaded 6 times
User avatar
mon2
XCore Legend
Posts: 1166
Joined: Thu Jun 10, 2010 11:43 am
Contact:

Postby mon2 » Thu Aug 09, 2018 3:10 am

Hi. Was able to build your workspace. Goto your makefile and check the 2 lib checkboxes -> save all -> clean the project and build all again and post your results.

This process will then import some additional required dependencies to finish this compilation puzzle.

Copy of my workspace is also attached for your review.
Attachments
workspace_080818.zip
(2.65 MiB) Downloaded 6 times
workspace_080818.zip
(2.65 MiB) Downloaded 6 times
test1_compiled.png
test1_compiled.png (23.01 KiB) Viewed 835 times
test1_compiled.png
test1_compiled.png (23.01 KiB) Viewed 835 times
test1_makefile_options.png
(45.71 KiB) Not downloaded yet
test1_makefile_options.png
(45.71 KiB) Not downloaded yet
lslarry86
Junior Member
Posts: 7
Joined: Wed Apr 11, 2018 1:35 pm

Postby lslarry86 » Thu Aug 09, 2018 12:25 pm

Thank you. I would not have looked at the Makefile without being prompted.

Following your insruction brought in lib_logging and lib_xassert, and also broke the compile of lib_gpio and lib_uart. I'm in the prcess of going through lib_uart and changing all the includes from:

#include "uart.h"
#include "xassert.h"

to:

#include "../api/uart.h"
#include "../../lib_xassert/api/xassert.h"

as the compile errors come in. If that doesn't get me going I will start a new topic about includes.
lslarry86
Junior Member
Posts: 7
Joined: Wed Apr 11, 2018 1:35 pm

Postby lslarry86 » Thu Aug 09, 2018 12:51 pm

Yep, that worked. After pathing changes and Clean, I got the binary.
Thanks again!

Who is online

Users browsing this forum: No registered users and 6 guests