This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

How to fix undefined reference to `SysLink_setup'

I try to get simple test programm to communicate with ARM and DSP cores of C6A8168. I succesfully build syslink.ko (2.10.03.20) and load my simple test program into DSP core. But I can't compile even simple program on ARM side with syslink API - I get such message:

arm-none-linux-gnueabi-g++ -D__LINUX__ -O2 -Wall -c -MD main.cpp
arm-none-linux-gnueabi-g++ -o dsphost main.o -Wl -ldl -lrt -lpthread -lm
main.o: In function `main':
main.cpp:(.text+0x4): undefined reference to `SysLink_setup'
collect2: ld returned 1 exit status

Source code of main.cpp:

/* cstdlib header files */
#include <stdio.h>
#include <stdlib.h>
/* package header files */
#include <ti/syslink/Std.h> /* must be first */
#include <ti/syslink/IpcHost.h>
#include <ti/syslink/SysLink.h>
#include <ti/ipc/MultiProc.h>

int main()
{
/* SysLink initialization */
SysLink_setup();
 return 0;
}
How it can be fixed?
  • try to build it against the syslink.o_release:

    arm-none-linux-gnueabi-g++ -o dsphost main.o -Wl -ldl -lrt -lpthread -lm  syslink.o_release
  • try to build it against the syslink.o_release:

    arm-none-linux-gnueabi-g++ -o dsphost main.o -Wl -ldl -lrt -lpthread -lm ${PATH_TO_SYSLINK_LIB}/syslink.o_release

  • Thank you, I succesfully build my simple program. The resulting Makefile is:

    .PHONY = clean
    TARGET_NAME := syslink_test

    all: $(TARGET_NAME)

    SYSLINK_PATH := /home/embedded/ti-sdk/component-sources/syslink_2_10_03_20/packages/ti/syslink

    LIBPATH := $(SYSLINK_PATH)/lib

    DIRS := $(SYSLINK_PATH)/inc/usr/Linux \
    $(SYSLINK_PATH)/inc \
    $(SYSLINK_PATH) \
    $(SYSLINK_PATH)/inc/usr \
    $(SYSLINK_PATH)/inc/usr/Linux

    INC := $(addprefix -I, $(DIRS))

    CC = $(CROSS_COMPILE)gcc
    LD = $(CROSS_COMPILE)gcc

    CFLAGS += -ffloat-store \
    -D_REENTRANT -O3 \
    -DSYSLINK_PLATFORM_TI81XX \
    -DTI81XX_VIDEOM3 \
    -DSYSLINK_BUILDOS_LINUX \
    -DSYSLINK_BUILD_DEBUG \
    -DSYSLINK_TRACE_ENABLE \
    -DSYSLINK_BUILD_HLOS \
    -ggdb -D DEBUG

    CFLAGS += -pg -Wall $(INC)

    CPPFLAGS += $(CFLAGS)

    LDFLAGS := -Wl -ldl -lrt -lpthread -lm -lc

    SYSLINK_LIB += $(LIBPATH)/syslink.a_debug

    $(TARGET_NAME): $(patsubst %.cpp,%.o, $(wildcard *.cpp))
    $(LD) -o $(TARGET_NAME) $(notdir $^) $(SYSLINK_LIB) $(LDFLAGS)
    rm -f *.o *~ core

    %.o: %.cpp
    $(CC) $(CFLAGS) -c -MD $<

    include $(wildcard *.d)

    clean:
    rm -f *.o *~ core
    rm -f *.d *~ core
    rm -f $(TARGET_NAME)

  • Alexey Vymyatnin said:
    arm-none-linux-gnueabi-g++ -o dsphost main.o -Wl -ldl -lrt -lpthread -lm
    main.o: In function `main':
    main.cpp:(.text+0x4): undefined reference to `SysLink_setup'
    collect2: ld returned 1 exit status

    It appears that you're not referencing the SysLink library that contains that function.  Can you add
        -L<syslink_install_dir>/packages/ti/syslink/lib -lsyslink.a_debug
    (or syslink.a_release if you want to use the "release" version)?

    You must have done something to allow the SysLink header files to be found by the compile, and the library needs something similar.

    Regards,

    - Rob