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

compiling error #2

Closed
mirkorobocop opened this issue Nov 29, 2018 · 5 comments
Closed

compiling error #2

mirkorobocop opened this issue Nov 29, 2018 · 5 comments

Comments

@mirkorobocop
Copy link

Hi

Very interesting project but I have a problem with compiling it
SDL2 and FFTW3 are installed.

root@kali:~/kbd-audio/build# cmake ..
-- The C compiler identification is GNU 8.2.0
-- The CXX compiler identification is GNU 8.2.0
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Looking for pthread.h
-- Looking for pthread.h - found
-- Looking for pthread_create
-- Looking for pthread_create - not found
-- 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/arm-linux-gnueabihf/libfftw3.so;/usr/lib/arm-linux-gnueabihf/libfftw3f.so  
-- Configuring done
-- Generating done
-- Build files have been written to: /root/kbd-audio/build
root@kali:~/kbd-audio/build# make 
Scanning dependencies of target Core
[  2%] Building CXX object CMakeFiles/Core.dir/audio_logger.cpp.o
[  5%] Linking CXX static library libCore.a
[  5%] Built target Core
Scanning dependencies of target keytap
[  7%] Building CXX object CMakeFiles/keytap.dir/keytap.cpp.o
[ 10%] Linking CXX executable keytap
[ 10%] Built target keytap
Scanning dependencies of target guess_qp
[ 13%] Building CXX object CMakeFiles/guess_qp.dir/guess_qp.cpp.o
[ 15%] Linking CXX executable guess_qp
[ 15%] Built target guess_qp
Scanning dependencies of target guess_qp2
[ 18%] Building CXX object CMakeFiles/guess_qp2.dir/guess_qp2.cpp.o
[ 21%] Linking CXX executable guess_qp2
[ 21%] Built target guess_qp2
Scanning dependencies of target play-full
[ 23%] Building CXX object CMakeFiles/play-full.dir/play-full.cpp.o
[ 26%] Linking CXX executable play-full
[ 26%] Built target play-full
Scanning dependencies of target subbreak
[ 28%] Building CXX object CMakeFiles/subbreak.dir/subbreak.cpp.o
In file included from /usr/include/c++/8/vector:69,
                 from /root/kbd-audio/subbreak.h:16,
                 from /root/kbd-audio/subbreak.cpp:6:
/usr/include/c++/8/bits/vector.tcc: In member function 'void std::vector<_Tp, _Alloc>::_M_fill_insert(std::vector<_Tp, _Alloc>::iterator, std::vector<_Tp, _Alloc>::size_type, const value_type&) [with _Tp = double; _Alloc = std::allocator<double>]':
/usr/include/c++/8/bits/vector.tcc:478:5: note: parameter passing for argument of type 'std::vector<double>::iterator' {aka '__gnu_cxx::__normal_iterator<double*, std::vector<double> >'} changed in GCC 7.1
     vector<_Tp, _Alloc>::
     ^~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/8/vector:64,
                 from /root/kbd-audio/subbreak.h:16,
                 from /root/kbd-audio/subbreak.cpp:6:
/usr/include/c++/8/bits/stl_vector.h: In function 'bool loadFreqMap(const char*, TFreqMap&)':
/usr/include/c++/8/bits/stl_vector.h:847:4: note: parameter passing for argument of type '__gnu_cxx::__normal_iterator<double*, std::vector<double> >' changed in GCC 7.1
    _M_fill_insert(end(), __new_size - size(), __x);
    ^~~~~~~~~~~~~~
[ 31%] Linking CXX executable subbreak
[ 31%] Built target subbreak
Scanning dependencies of target ImGui
[ 34%] Building CXX object CMakeFiles/ImGui.dir/imgui/imgui.cpp.o
[ 36%] Building CXX object CMakeFiles/ImGui.dir/imgui/imgui_draw.cpp.o
[ 39%] Building CXX object CMakeFiles/ImGui.dir/imgui/imgui_demo.cpp.o
[ 42%] Building CXX object CMakeFiles/ImGui.dir/imgui/imgui_widgets.cpp.o
[ 44%] Building C object CMakeFiles/ImGui.dir/imgui/examples/libs/gl3w/GL/gl3w.c.o
[ 47%] Building CXX object CMakeFiles/ImGui.dir/imgui/examples/imgui_impl_sdl.cpp.o
[ 50%] Building CXX object CMakeFiles/ImGui.dir/imgui/examples/imgui_impl_opengl3.cpp.o
[ 52%] Linking CXX static library libImGui.a
[ 52%] Built target ImGui
Scanning dependencies of target key_average_gui
[ 55%] Building CXX object CMakeFiles/key_average_gui.dir/key_average_gui.cpp.o
[ 57%] Linking CXX executable key_average_gui
/usr/bin/ld: libImGui.a(gl3w.c.o): in function `get_proc':
gl3w.c:(.text+0x4): undefined reference to `glXGetProcAddress'
/usr/bin/ld: libImGui.a(gl3w.c.o): in function `load_procs':
gl3w.c:(.text+0xc0): undefined reference to `glXGetProcAddress'
/usr/bin/ld: gl3w.c:(.text+0x100): undefined reference to `glXGetProcAddress'
/usr/bin/ld: gl3w.c:(.text+0x140): undefined reference to `glXGetProcAddress'
/usr/bin/ld: gl3w.c:(.text+0x180): undefined reference to `glXGetProcAddress'
/usr/bin/ld: libImGui.a(gl3w.c.o):gl3w.c:(.text+0x1ae): more undefined references to `glXGetProcAddress' follow
collect2: error: ld returned 1 exit status
make[2]: *** [CMakeFiles/key_average_gui.dir/build.make:87: key_average_gui] Error 1
make[1]: *** [CMakeFiles/Makefile2:259: CMakeFiles/key_average_gui.dir/all] Error 2
make: *** [Makefile:84: all] Error 2
@ggerganov
Copy link
Owner

Not sure what is the issue.

Can you try building the ImGui SDL example alone and see if it works:

cd kbd-audio/imgui/examples/example_sdl_opengl3
make
./example_sdl_opengl3

@mirkorobocop
Copy link
Author

Not sure what is the issue.

Can you try building the ImGui SDL example alone and see if it works:

cd kbd-audio/imgui/examples/example_sdl_opengl3
make
./example_sdl_opengl3

Yep, I can confirm that it works

root@kali:~/kbd-audio/imgui/examples/example_sdl_opengl3# make
g++ -I../ -I../../ -I../libs/gl3w `sdl2-config --cflags` -Wall -Wformat -c -o main.o main.cpp
g++ -I../ -I../../ -I../libs/gl3w `sdl2-config --cflags` -Wall -Wformat -c -o imgui_impl_sdl.o ../imgui_impl_sdl.cpp
g++ -I../ -I../../ -I../libs/gl3w `sdl2-config --cflags` -Wall -Wformat -c -o imgui_impl_opengl3.o ../imgui_impl_opengl3.cpp
g++ -I../ -I../../ -I../libs/gl3w `sdl2-config --cflags` -Wall -Wformat -c -o imgui.o ../../imgui.cpp
g++ -I../ -I../../ -I../libs/gl3w `sdl2-config --cflags` -Wall -Wformat -c -o imgui_demo.o ../../imgui_demo.cpp
g++ -I../ -I../../ -I../libs/gl3w `sdl2-config --cflags` -Wall -Wformat -c -o imgui_draw.o ../../imgui_draw.cpp
g++ -I../ -I../../ -I../libs/gl3w `sdl2-config --cflags` -Wall -Wformat -c -o imgui_widgets.o ../../imgui_widgets.cpp
cc -I../ -I../../ -I../libs/gl3w `sdl2-config --cflags` -Wall -Wformat -c -o gl3w.o ../libs/gl3w/GL/gl3w.c
g++ -o example_sdl_opengl3 main.o imgui_impl_sdl.o imgui_impl_opengl3.o imgui.o imgui_demo.o imgui_draw.o imgui_widgets.o gl3w.o -I../ -I../../ -I../libs/gl3w `sdl2-config --cflags` -Wall -Wformat -lGL -ldl `sdl2-config --libs`
Build complete for Linux
root@kali:~/kbd-audio/imgui/examples/example_sdl_opengl3# ./example_sdl_opengl3

image

@d4em0n
Copy link

d4em0n commented Nov 30, 2018

Build error

Scanning dependencies of target Core
[  2%] Building CXX object CMakeFiles/Core.dir/audio_logger.cpp.o
[  5%] Linking CXX static library libCore.a
[  5%] Built target Core
Scanning dependencies of target subbreak
[  7%] Building CXX object CMakeFiles/subbreak.dir/subbreak.cpp.o
[ 10%] Linking CXX executable subbreak
[ 10%] Built target subbreak
Scanning dependencies of target play
[ 13%] Building CXX object CMakeFiles/play.dir/play.cpp.o
[ 15%] Linking CXX executable play
[ 15%] Built target play
Scanning dependencies of target guess_qp
[ 18%] Building CXX object CMakeFiles/guess_qp.dir/guess_qp.cpp.o
[ 21%] Linking CXX executable guess_qp
[ 21%] Built target guess_qp
Scanning dependencies of target scale
[ 23%] Building CXX object CMakeFiles/scale.dir/scale.cpp.o
[ 26%] Linking CXX executable scale
[ 26%] Built target scale
Scanning dependencies of target ImGui
[ 28%] Building CXX object CMakeFiles/ImGui.dir/imgui/imgui.cpp.o
[ 31%] Building CXX object CMakeFiles/ImGui.dir/imgui/imgui_draw.cpp.o
[ 34%] Building CXX object CMakeFiles/ImGui.dir/imgui/imgui_demo.cpp.o
[ 36%] Building CXX object CMakeFiles/ImGui.dir/imgui/imgui_widgets.cpp.o
[ 39%] Building C object CMakeFiles/ImGui.dir/imgui/examples/libs/gl3w/GL/gl3w.c.o
[ 42%] Building CXX object CMakeFiles/ImGui.dir/imgui/examples/imgui_impl_sdl.cpp.o
[ 44%] Building CXX object CMakeFiles/ImGui.dir/imgui/examples/imgui_impl_opengl3.cpp.o
[ 47%] Linking CXX static library libImGui.a
[ 47%] Built target ImGui
Scanning dependencies of target key_average_gui
[ 50%] Building CXX object CMakeFiles/key_average_gui.dir/key_average_gui.cpp.o
[ 52%] Linking CXX executable key_average_gui
/usr/bin/ld: libImGui.a(gl3w.c.o): relocation R_X86_64_32 against `.rodata.str1.1' can not be used when making a PIE object; recompile with -fPIC
/usr/bin/ld: final link failed: Nonrepresentable section on output
collect2: error: ld returned 1 exit status
CMakeFiles/key_average_gui.dir/build.make:86: recipe for target 'key_average_gui' failed
make[2]: *** [key_average_gui] Error 1
CMakeFiles/Makefile2:221: recipe for target 'CMakeFiles/key_average_gui.dir/all' failed
make[1]: *** [CMakeFiles/key_average_gui.dir/all] Error 2
Makefile:83: recipe for target 'all' failed
make: *** [all] Error 2

@mirkorobocop
Copy link
Author

fixed

@ggerganov
Copy link
Owner

@d4em0n If the -fPIC issue persists make sure to open a new issue.

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