Compiling examples on Linux (x86-64 and palin x86).

Voices aren't working properly?

Compiling examples on Linux (x86-64 and palin x86).

Postby » Fri Oct 24, 2008 2:29 pm

I'm trying to compile the examples that come with the voices and SDK (I have licensed the SDK). Regardless of what I do, or whether I try the compile on a 32 or 64 bit machine, I get the exact same results from GCC...

Code: Select all
# gcc -I../include list_voices.c
/tmp/cc8QDUJT.o: In function `main':
list_voices.c:(.text+0xeb): undefined reference to `swift_engine_open'
list_voices.c:(.text+0x121): undefined reference to `swift_port_open'
list_voices.c:(.text+0x17c): undefined reference to `swift_port_close'
list_voices.c:(.text+0x18c): undefined reference to `swift_engine_close'
/tmp/cc8QDUJT.o: In function `list_voices':
list_voices.c:(.text+0x1c2): undefined reference to `swift_port_find_first_voice'
list_voices.c:(.text+0x20a): undefined reference to `swift_voice_get_attribute'
list_voices.c:(.text+0x22f): undefined reference to `swift_voice_get_attribute'
list_voices.c:(.text+0x240): undefined reference to `swift_voice_get_attribute'
list_voices.c:(.text+0x251): undefined reference to `swift_voice_get_attribute'
list_voices.c:(.text+0x262): undefined reference to `swift_voice_get_attribute'
/tmp/cc8QDUJT.o:list_voices.c:(.text+0x273): more undefined references to `swift_voice_get_attribute' follow
/tmp/cc8QDUJT.o: In function `list_voices':
list_voices.c:(.text+0x2a2): undefined reference to `swift_port_find_next_voice'
collect2: ld returned 1 exit status

The shared libs are in /opt/swift/lib which is in my file. I've run ldconfig again...

I've been messing with this for hours and tried everything I can think of.... It seems like this isn't a missing library so much as a the way the libraries are linked or something.

Any suggestions?
Posts: 1
Joined: Fri Oct 24, 2008 2:19 pm

Including the swift libraries for the linker

Postby AdamW » Sat Dec 20, 2008 11:31 am

The compile line is incomplete. The linker needs to be told to link to ../lib/

For the example below, you need to compile as follows:

Code: Select all
gcc -I../include ../lib/ -lm list_voices.c

The alternate syntax using the -l flag would not work for compilation, namely:

Code: Select all
gcc -I../include -lswift -lm list_voices.c

Since the -l flag relies on finding a static library named libswift.a, and then using the shared object at its discretion. Cepstral does not ship static libraries with a standard installation. This means you cannot use the -l options to name the libraries during compilation.

You still need to set as you did for the runtime.

In general the examples will need to be handed one or more of the swift libraries at compile time.

Return to Troubleshooting

Who is online

Users browsing this forum: No registered users and 1 guest