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

C compilation issues #5

Open
slavaGanzin opened this issue Nov 13, 2020 · 1 comment
Open

C compilation issues #5

slavaGanzin opened this issue Nov 13, 2020 · 1 comment

Comments

@slavaGanzin
Copy link

Hello, Georgi.

Awesome idea, awesome execution.
Really impressed with the speed of transmission in your demo.

# git clone "https://github.com/ggerganov/wave-share"; cd wave-share && mkdir build && cd build; cmake ..; make

Cloning into 'wave-share'...
remote: Enumerating objects: 122, done.
remote: Total 122 (delta 0), reused 0 (delta 0), pack-reused 122
Receiving objects: 100% (122/122), 107.20 KiB | 560.00 KiB/s, done.
Resolving deltas: 100% (62/62), done.
-- The C compiler identification is GNU 10.2.0
-- The CXX compiler identification is GNU 10.2.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /usr/bin/cc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Looking for pthread.h
-- Looking for pthread.h - found
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Failed
-- Looking for pthread_create in pthreads
-- Looking for pthread_create in pthreads - not found
-- Looking for pthread_create in pthread
-- Looking for pthread_create in pthread - found
-- Found Threads: TRUE  
-- Found FFTW: /usr/lib/libfftw3.so;/usr/lib/libfftw3f.so  
-- Configuring done
-- Generating done
-- Build files have been written to: /home/vganzin/work/whatnot/wave-share/build
Scanning dependencies of target wave-share
[ 50%] Building CXX object CMakeFiles/wave-share.dir/main.cpp.o
In file included from /home/vganzin/work/whatnot/wave-share/main.cpp:7:
/home/vganzin/work/whatnot/wave-share/reed-solomon/rs.hpp: In member function ‘void RS::ReedSolomon::EncodeBlock(const void*, void*)’:
/home/vganzin/work/whatnot/wave-share/reed-solomon/rs.hpp:76:17: warning: ISO C++ forbids variable length array ‘stack_memory’ [-Wvla]
   76 |         uint8_t stack_memory[MSG_CNT * msg_length + POLY_CNT * ecc_length * 2];
      |                 ^~~~~~~~~~~~
/home/vganzin/work/whatnot/wave-share/reed-solomon/rs.hpp: In member function ‘int RS::ReedSolomon::DecodeBlock(const void*, const void*, void*, uint8_t*, size_t)’:
/home/vganzin/work/whatnot/wave-share/reed-solomon/rs.hpp:152:17: warning: ISO C++ forbids variable length array ‘stack_memory’ [-Wvla]
  152 |         uint8_t stack_memory[MSG_CNT * msg_length + POLY_CNT * ecc_length * 2];
      |                 ^~~~~~~~~~~~
[100%] Linking CXX executable wave-share
/usr/bin/ld: CMakeFiles/wave-share.dir/main.cpp.o: in function `update() [clone .part.0]':
main.cpp:(.text+0x747): undefined reference to `SDL_PollEvent'
/usr/bin/ld: main.cpp:(.text+0x76c): undefined reference to `SDL_PauseAudioDevice'
/usr/bin/ld: main.cpp:(.text+0x78e): undefined reference to `SDL_GetQueuedAudioSize'
/usr/bin/ld: main.cpp:(.text+0x7c9): undefined reference to `SDL_PauseAudioDevice'
/usr/bin/ld: main.cpp:(.text+0x7d4): undefined reference to `SDL_CloseAudioDevice'
/usr/bin/ld: main.cpp:(.text+0x7e4): undefined reference to `SDL_PauseAudioDevice'
/usr/bin/ld: main.cpp:(.text+0x7ef): undefined reference to `SDL_CloseAudioDevice'
/usr/bin/ld: main.cpp:(.text+0x7f4): undefined reference to `SDL_CloseAudio'
/usr/bin/ld: main.cpp:(.text+0x7f9): undefined reference to `SDL_Quit'
/usr/bin/ld: main.cpp:(.text+0x806): undefined reference to `SDL_PauseAudioDevice'
/usr/bin/ld: main.cpp:(.text+0x816): undefined reference to `SDL_PauseAudioDevice'
/usr/bin/ld: main.cpp:(.text+0x859): undefined reference to `SDL_PauseAudioDevice'
/usr/bin/ld: main.cpp:(.text+0x8e8): undefined reference to `SDL_ClearQueuedAudio'
/usr/bin/ld: CMakeFiles/wave-share.dir/main.cpp.o: in function `init()':
main.cpp:(.text+0x95c): undefined reference to `SDL_LogSetPriority'
/usr/bin/ld: main.cpp:(.text+0x966): undefined reference to `SDL_Init'
/usr/bin/ld: main.cpp:(.text+0x988): undefined reference to `SDL_SetHintWithPriority'
/usr/bin/ld: main.cpp:(.text+0x996): undefined reference to `SDL_GetNumAudioDevices'
/usr/bin/ld: main.cpp:(.text+0x9b5): undefined reference to `SDL_GetAudioDeviceName'
/usr/bin/ld: main.cpp:(.text+0x9d5): undefined reference to `SDL_GetNumAudioDevices'
/usr/bin/ld: main.cpp:(.text+0xa08): undefined reference to `SDL_GetAudioDeviceName'
/usr/bin/ld: main.cpp:(.text+0xa35): undefined reference to `SDL_memset'
/usr/bin/ld: main.cpp:(.text+0xa6d): undefined reference to `SDL_memset'
/usr/bin/ld: main.cpp:(.text+0xa82): undefined reference to `SDL_GetAudioDeviceName'
/usr/bin/ld: main.cpp:(.text+0xaa6): undefined reference to `SDL_GetAudioDeviceName'
/usr/bin/ld: main.cpp:(.text+0xab9): undefined reference to `SDL_OpenAudioDevice'
/usr/bin/ld: main.cpp:(.text+0xbac): undefined reference to `SDL_GetAudioDeviceName'
/usr/bin/ld: main.cpp:(.text+0xbd3): undefined reference to `SDL_GetAudioDeviceName'
/usr/bin/ld: main.cpp:(.text+0xbeb): undefined reference to `SDL_OpenAudioDevice'
/usr/bin/ld: main.cpp:(.text+0xc00): undefined reference to `SDL_GetError'
/usr/bin/ld: main.cpp:(.text+0xd09): undefined reference to `SDL_GetError'
/usr/bin/ld: main.cpp:(.text+0xdba): undefined reference to `SDL_OpenAudioDevice'
/usr/bin/ld: main.cpp:(.text+0xdf4): undefined reference to `SDL_OpenAudioDevice'
/usr/bin/ld: main.cpp:(.text+0xe09): undefined reference to `SDL_GetError'
/usr/bin/ld: main.cpp:(.text+0xe1c): undefined reference to `SDL_LogError'
/usr/bin/ld: main.cpp:(.text+0xe30): undefined reference to `SDL_CloseAudio'
/usr/bin/ld: CMakeFiles/wave-share.dir/main.cpp.o: in function `DataRxTx::send()':
main.cpp:(.text._ZN8DataRxTx4sendEv[_ZN8DataRxTx4sendEv]+0x30d): undefined reference to `SDL_QueueAudio'
/usr/bin/ld: CMakeFiles/wave-share.dir/main.cpp.o: in function `DataRxTx::receive()':
main.cpp:(.text._ZN8DataRxTx7receiveEv[_ZN8DataRxTx7receiveEv]+0x137): undefined reference to `SDL_DequeueAudio'
/usr/bin/ld: main.cpp:(.text._ZN8DataRxTx7receiveEv[_ZN8DataRxTx7receiveEv]+0xdf6): undefined reference to `SDL_GetQueuedAudioSize'
/usr/bin/ld: main.cpp:(.text._ZN8DataRxTx7receiveEv[_ZN8DataRxTx7receiveEv]+0x1812): undefined reference to `SDL_GetQueuedAudioSize'
/usr/bin/ld: main.cpp:(.text._ZN8DataRxTx7receiveEv[_ZN8DataRxTx7receiveEv]+0x1858): undefined reference to `SDL_ClearQueuedAudio'
/usr/bin/ld: CMakeFiles/wave-share.dir/main.cpp.o: in function `main':
main.cpp:(.text.startup+0x41e): undefined reference to `SDL_Delay'
collect2: error: ld returned 1 exit status
make[2]: *** [CMakeFiles/wave-share.dir/build.make:105: wave-share] Error 1
make[1]: *** [CMakeFiles/Makefile2:95: CMakeFiles/wave-share.dir/all] Error 2
make: *** [Makefile:103: all] Error 2

p.s. I don't think you should be worried about 1mb emscripten module. Modern sites gets over 5mb easily and nobody complains.

@ggerganov
Copy link
Owner

Thanks!

Looks like it fails to link the SDL2 lib for some reason.
One option is to try to run cmake -DUSE_FINDSDL2=ON .. instead of cmake ..

If this does not help then try building without using CMake at all.
Simply go to wave-share root and run g++ -std=c++11 -O3 main.cpp -lpthread -lfftw3 -lfftw3f -lSDL2 -o wave-share. This should produce a binary called wave-share.

If it fails again then try to reinstall SDL2 on your system.

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

2 participants