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

Liniking error in msys2 Win10 x86_64 #2

Open
sidec opened this issue Jul 10, 2021 · 1 comment
Open

Liniking error in msys2 Win10 x86_64 #2

sidec opened this issue Jul 10, 2021 · 1 comment

Comments

@sidec
Copy link

sidec commented Jul 10, 2021

There is a problem preventing build from success. Here is the relevant make log:

Scanning dependencies of target sgvisu_tilde
[ 73%] Building CXX object CMakeFiles/sgvisu_tilde.dir/src/sgvisu~.cc.obj
[ 76%] Linking CXX shared module "../sgvisu~.dll"
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/10.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/10.2.0\libgcc_eh.a(unwind-seh.o):(.text+0x3d0): multiple definition of `_Unwind_Resume'; C:/Program Files/Pd/bin/pd.lib(d000176.o):(.text+0x0): first defined here
collect2.exe: error: ld returned 1 exit status
make[2]: *** [CMakeFiles/sgvisu_tilde.dir/build.make:110: ../sgvisu~.dll] Error 1
make[1]: *** [CMakeFiles/Makefile2:161: CMakeFiles/sgvisu_tilde.dir/all] Error 2
make: *** [Makefile:103: all] Error 2

cmake configuration seems ok, here are details:

cmake -DCMAKE_BUILD_TYPE=Release  ..
-- 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: C:/msys64/mingw64/bin/gcc.exe - 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: C:/msys64/mingw64/bin/g++.exe - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Found PkgConfig: C:/msys64/mingw64/bin/pkg-config.exe (found version "1.7.3")
-- Found Puredata headers: C:/Program Files/Pd/src
-- Performing Test _test
-- Performing Test _test - Success
-- Looking for pthread.h
-- Looking for pthread.h - found
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Success
-- Found Threads: TRUE
-- Found FLTK: C:/msys64/mingw64/lib/libfltk.dll.a
-- Found static FLTK: C:/msys64/mingw64/lib/libfltk.a
-- Found StaticFLTK: TRUE
-- Found fftw3.h in path: C:/msys64/mingw64/include
-- Found library fftw3f: C:/msys64/mingw64/lib/libfftw3f.dll.a
-- Found static library fftw3f: C:/msys64/mingw64/lib/libfftw3f.a
-- Checking for module 'jack'
--   Package 'jack', required by 'virtual:world', not found
-- Configuring done
-- Generating done
-- Build files have been written to: D:/code/pd-externals/pd-visualization/build

Linking to Miller S. Puckette's "vanilla" distribution of Pd from http://msp.ucsd.edu/software.html. While trying to link with gcc build of Pd from sources in github, I encounter another error:

[...]/bin/pure-data/pd-0.51.4/src/pthread.h:260:8: error: redefinition of 'struct timespec'
  260 | struct timespec {
      |        ^~~~~~~~
In file included from C:/msys64/mingw64/x86_64-w64-mingw32/include/time.h:300,
                 from C:/Users/przem/bin/pure-data/pd-0.51.4/src/pthread.h:189,
                 from C:/msys64/mingw64/include/c++/10.2.0/x86_64-w64-mingw32/bits/gthr-default.h:35,
                 from C:/msys64/mingw64/include/c++/10.2.0/x86_64-w64-mingw32/bits/gthr.h:148,
                 from C:/msys64/mingw64/include/c++/10.2.0/ext/atomicity.h:35,
                 from C:/msys64/mingw64/include/c++/10.2.0/bits/basic_string.h:39,
                 from C:/msys64/mingw64/include/c++/10.2.0/string:55,
                 from C:/msys64/mingw64/include/c++/10.2.0/stdexcept:39,
                 from C:/msys64/mingw64/include/c++/10.2.0/system_error:41,
                 from D:/code/pd-externals/pd-visualization/src/util/unix_fd.tcc:2,
                 from D:/code/pd-externals/pd-visualization/src/util/unix_fd.h:26,
                 from D:/code/pd-externals/pd-visualization/src/util/unix.h:2,
                 from D:/code/pd-externals/pd-visualization/src/visu~.h:3,
                 from D:/code/pd-externals/pd-visualization/src/visu~.cc:1:
C:/msys64/mingw64/x86_64-w64-mingw32/include/sys/timeb.h:91:8: note: previous definition of 'struct timespec'
   91 | struct timespec {
      |        ^~~~~~~~
make[2]: *** [CMakeFiles/visu_common.dir/build.make:83: CMakeFiles/visu_common.dir/src/visu~.cc.obj] Error 1
make[1]: *** [CMakeFiles/Makefile2:269: CMakeFiles/visu_common.dir/all] Error 2
make: *** [Makefile:103: all] Error 2

Any idea how to progress? Also is there any chance to publish Deken package?
Thanks

@sidec
Copy link
Author

sidec commented Jul 10, 2021

I succesfully linked the build by adding to CMakeList.txt

set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} "-Wl,-allow-multiple-definition")

as suggested there https://stackoverflow.com/questions/11267877/mingw-multiple-definition-of-unwind-resume
and external works in Pd 0.51-4 official binary distribution.
I am not sure where it should go in cmake files, I just put it in CMakeList.txt, so I don't make ugly pr, but it seems like enought to make it linking.

I also added PreLoad.cmake file with

set(CMAKE_GENERATOR "Unix Makefiles" CACHE INTERNAL "" FORCE

to prevent cmake from using Visual Studio toolchain on msys2.

Awesome external and definitelly worth of being more easily available through Deken.

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

1 participant