Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't rebuild examples/fvadwav.c #18

Open
4t4nner opened this issue Jan 28, 2020 · 4 comments
Open

Can't rebuild examples/fvadwav.c #18

4t4nner opened this issue Jan 28, 2020 · 4 comments

Comments

@4t4nner
Copy link

4t4nner commented Jan 28, 2020

After building and installing I try:

cp examples/fvadwav.c ~/tmp_proj/
g++ -v -g fvadwav.c

and get an error:

Using built-in specs.
COLLECT_GCC=g++
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/8/lto-wrapper
OFFLOAD_TARGET_NAMES=nvptx-none
OFFLOAD_TARGET_DEFAULT=1
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Ubuntu 8.3.0-6ubuntu1~18.04.1' --with-bugurl=file:///usr/share/doc/gcc-8/README.Bugs --enable-languages=c,ada,c++,go,brig,d,fortran,objc,obj-c++ --prefix=/usr --with-gcc-major-version-only --program-suffix=-8 --program-prefix=x86_64-linux-gnu- --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --enable-bootstrap --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-gnu-unique-object --disable-vtable-verify --enable-libmpx --enable-plugin --enable-default-pie --with-system-zlib --with-target-system-zlib --enable-objc-gc=auto --enable-multiarch --disable-werror --with-arch-32=i686 --with-abi=m64 --with-multilib-list=m32,m64,mx32 --enable-multilib --with-tune=generic --enable-offload-targets=nvptx-none --without-cuda-driver --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu
Thread model: posix
gcc version 8.3.0 (Ubuntu 8.3.0-6ubuntu1~18.04.1) 
COLLECT_GCC_OPTIONS='-v' '-g' '-shared-libgcc' '-mtune=generic' '-march=x86-64'
 /usr/lib/gcc/x86_64-linux-gnu/8/cc1plus -quiet -v -imultiarch x86_64-linux-gnu -D_GNU_SOURCE fvadwav.c -quiet -dumpbase fvadwav.c -mtune=generic -march=x86-64 -auxbase fvadwav -g -version -fstack-protector-strong -Wformat -Wformat-security -o /tmp/ccxmJrHK.s
GNU C++14 (Ubuntu 8.3.0-6ubuntu1~18.04.1) version 8.3.0 (x86_64-linux-gnu)
	compiled by GNU C version 8.3.0, GMP version 6.1.2, MPFR version 4.0.1, MPC version 1.1.0, isl version isl-0.19-GMP

GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
ignoring duplicate directory "/usr/include/x86_64-linux-gnu/c++/8"
ignoring nonexistent directory "/usr/local/include/x86_64-linux-gnu"
ignoring nonexistent directory "/usr/lib/gcc/x86_64-linux-gnu/8/../../../../x86_64-linux-gnu/include"
#include "..." search starts here:
#include <...> search starts here:
 /usr/include/c++/8
 /usr/include/x86_64-linux-gnu/c++/8
 /usr/include/c++/8/backward
 /usr/lib/gcc/x86_64-linux-gnu/8/include
 /usr/local/include
 /usr/lib/gcc/x86_64-linux-gnu/8/include-fixed
 /usr/include/x86_64-linux-gnu
 /usr/include
End of search list.
GNU C++14 (Ubuntu 8.3.0-6ubuntu1~18.04.1) version 8.3.0 (x86_64-linux-gnu)
	compiled by GNU C version 8.3.0, GMP version 6.1.2, MPFR version 4.0.1, MPC version 1.1.0, isl version isl-0.19-GMP

GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
Compiler executable checksum: 27ae9a20c27efba91196488dcf7713bb
COLLECT_GCC_OPTIONS='-v' '-g' '-shared-libgcc' '-mtune=generic' '-march=x86-64'
 as -v --64 -o /tmp/ccNkTGt2.o /tmp/ccxmJrHK.s
GNU ассемблер, версия 2.30 (x86_64-linux-gnu); используется BFD версии (GNU Binutils for Ubuntu) 2.30
COMPILER_PATH=/usr/lib/gcc/x86_64-linux-gnu/8/:/usr/lib/gcc/x86_64-linux-gnu/8/:/usr/lib/gcc/x86_64-linux-gnu/:/usr/lib/gcc/x86_64-linux-gnu/8/:/usr/lib/gcc/x86_64-linux-gnu/
LIBRARY_PATH=/usr/lib/gcc/x86_64-linux-gnu/8/:/usr/lib/gcc/x86_64-linux-gnu/8/../../../x86_64-linux-gnu/:/usr/lib/gcc/x86_64-linux-gnu/8/../../../../lib/:/lib/x86_64-linux-gnu/:/lib/../lib/:/usr/lib/x86_64-linux-gnu/:/usr/lib/../lib/:/usr/lib/gcc/x86_64-linux-gnu/8/../../../:/lib/:/usr/lib/
COLLECT_GCC_OPTIONS='-v' '-g' '-shared-libgcc' '-mtune=generic' '-march=x86-64'
 /usr/lib/gcc/x86_64-linux-gnu/8/collect2 -plugin /usr/lib/gcc/x86_64-linux-gnu/8/liblto_plugin.so -plugin-opt=/usr/lib/gcc/x86_64-linux-gnu/8/lto-wrapper -plugin-opt=-fresolution=/tmp/cc5K4mhk.res -plugin-opt=-pass-through=-lgcc_s -plugin-opt=-pass-through=-lgcc -plugin-opt=-pass-through=-lc -plugin-opt=-pass-through=-lgcc_s -plugin-opt=-pass-through=-lgcc --build-id --eh-frame-hdr -m elf_x86_64 --hash-style=gnu --as-needed -dynamic-linker /lib64/ld-linux-x86-64.so.2 -pie -z now -z relro /usr/lib/gcc/x86_64-linux-gnu/8/../../../x86_64-linux-gnu/Scrt1.o /usr/lib/gcc/x86_64-linux-gnu/8/../../../x86_64-linux-gnu/crti.o /usr/lib/gcc/x86_64-linux-gnu/8/crtbeginS.o -L/usr/lib/gcc/x86_64-linux-gnu/8 -L/usr/lib/gcc/x86_64-linux-gnu/8/../../../x86_64-linux-gnu -L/usr/lib/gcc/x86_64-linux-gnu/8/../../../../lib -L/lib/x86_64-linux-gnu -L/lib/../lib -L/usr/lib/x86_64-linux-gnu -L/usr/lib/../lib -L/usr/lib/gcc/x86_64-linux-gnu/8/../../.. /tmp/ccNkTGt2.o -lstdc++ -lm -lgcc_s -lgcc -lc -lgcc_s -lgcc /usr/lib/gcc/x86_64-linux-gnu/8/crtendS.o /usr/lib/gcc/x86_64-linux-gnu/8/../../../x86_64-linux-gnu/crtn.o
/tmp/ccNkTGt2.o: In function `process_sf(SNDFILE_tag*, Fvad*, unsigned long, SNDFILE_tag**, _IO_FILE*)':
/home/t4nner/proj/learning/vad/fvadwav.c:38: undefined reference to `sf_read_double'
/home/t4nner/proj/learning/vad/fvadwav.c:44: undefined reference to `fvad_process'
/home/t4nner/proj/learning/vad/fvadwav.c:57: undefined reference to `sf_write_double'
/tmp/ccNkTGt2.o: In function `main':
/home/t4nner/proj/learning/vad/fvadwav.c:114: undefined reference to `fvad_new'
/home/t4nner/proj/learning/vad/fvadwav.c:126: undefined reference to `fvad_set_mode'
/home/t4nner/proj/learning/vad/fvadwav.c:179: undefined reference to `sf_open'
/home/t4nner/proj/learning/vad/fvadwav.c:181: undefined reference to `sf_strerror'
/home/t4nner/proj/learning/vad/fvadwav.c:190: undefined reference to `fvad_set_sample_rate'
/home/t4nner/proj/learning/vad/fvadwav.c:205: undefined reference to `sf_open'
/home/t4nner/proj/learning/vad/fvadwav.c:207: undefined reference to `sf_strerror'
/home/t4nner/proj/learning/vad/fvadwav.c:242: undefined reference to `sf_close'
/home/t4nner/proj/learning/vad/fvadwav.c:244: undefined reference to `sf_close'
/home/t4nner/proj/learning/vad/fvadwav.c:246: undefined reference to `fvad_free'
collect2: error: ld returned 1 exit status

my /usr/include is:

➜  vad ll /usr/include | grep sndfile  
-rw-r--r--   1 root root  29K июн  8  2019 sndfile.h
-rw-r--r--   1 root root  13K июн  8  2019 sndfile.hh

/usr/local/include:

➜  vad ll -t /usr/local/include | head -n 2
-rw-r--r-- 1 root root 2,6K янв 28 15:01 fvad.h

how can I reproduce your example code without errors?

Update

I found solution

g++ -v -g fvadwav.c -lsndfile -lfvad

Please, add it to description.

@alamnasim
Copy link

I am also facing the same issue while making executable of fvadwav.c as "fvadwav" to run wavtest.sh in tests folder.

when I run this :
gcc fvadwav.c -o fvadwav

I got the same erro as yours:
/tmp/ccwtRlGE.o: In function process_sf': fvadwav.c:(.text+0x13f): undefined reference to fvad_process'
fvadwav.c:(.text+0x1ed): undefined reference to sf_write_double' fvadwav.c:(.text+0x242): undefined reference to sf_read_double'
/tmp/ccwtRlGE.o: In function main': fvadwav.c:(.text+0x505): undefined reference to fvad_new'
fvadwav.c:(.text+0x5b2): undefined reference to fvad_set_mode' fvadwav.c:(.text+0x79d): undefined reference to sf_open'
fvadwav.c:(.text+0x7b8): undefined reference to sf_strerror' fvadwav.c:(.text+0x82a): undefined reference to fvad_set_sample_rate'
fvadwav.c:(.text+0x926): undefined reference to sf_open' fvadwav.c:(.text+0x952): undefined reference to sf_strerror'
fvadwav.c:(.text+0xaad): undefined reference to sf_close' fvadwav.c:(.text+0xae0): undefined reference to sf_close'
fvadwav.c:(.text+0xb22): undefined reference to `fvad_free'
collect2: error: ld returned 1 exit status

Can you confirm how did you solve that issue from above command:
g++ -v -g fvadwav.c -lsndfile -lfvad

the solution is not working for me even I run your solution I get following error:
fvadwav.c: In function ‘bool process_sf(SNDFILE*, Fvad*, size_t, SNDFILE**, FILE*)’:
fvadwav.c:32:31: error: invalid conversion from ‘void*’ to ‘double*’ [-fpermissive]
|| !(buf0 = malloc(framelen * sizeof buf0))
~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
fvadwav.c:33:31: error: invalid conversion from ‘void
’ to ‘int16_t* {aka short int*}’ [-fpermissive]
|| !(buf1 = malloc(framelen * sizeof buf1))) {
~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
fvadwav.c: In function ‘int main(int, char
*)’:
fvadwav.c:204:13: sorry, unimplemented: non-trivial designated initializers not supported
};
^
fvadwav.c:204:13: sorry, unimplemented: non-trivial designated initializers not supported
fvadwav.c:204:13: sorry, unimplemented: non-trivial designated initializers not supported

Thanks

@4t4nner
Copy link
Author

4t4nner commented Nov 5, 2020

Had you "-lsndfile -lfvad" flags in your run attempt?

@alamnasim
Copy link

Thanks for the reply.

Yes It worked for me.

@jonnor
Copy link
Contributor

jonnor commented Apr 20, 2024

This issue has a fix and can be closed. CC @dpirch

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants