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

msys2 fix multiple definition issue #1416

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

giuspen
Copy link

@giuspen giuspen commented Aug 26, 2020

Cpputest has been recently added to msys2 but unfortunately when I build my project under msys2 I got the following issue, which is fixed with this patch:

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/../../../../lib/libCppUTest.a(MemoryLeakWarningPlugin.cpp.obj):(.text+0xf10): multiple definition of `operator new(unsigned long long)'; C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/10.2.0/libstdc++.dll.a(d006537.o):(.text+0x0): first defined here
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/../../../../lib/libCppUTest.a(MemoryLeakWarningPlugin.cpp.obj):(.text+0xf50): multiple definition of `operator delete(void*, unsigned long long)'; C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/10.2.0/libstdc++.dll.a(d006531.o):(.text+0x0): first defined here
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/../../../../lib/libCppUTest.a(MemoryLeakWarningPlugin.cpp.obj):(.text+0xf60): multiple definition of `operator new[](unsigned long long)'; C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/10.2.0/libstdc++.dll.a(d006533.o):(.text+0x0): first defined here
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/../../../../lib/libCppUTest.a(MemoryLeakWarningPlugin.cpp.obj):(.text+0xf80): multiple definition of `operator delete[](void*)'; C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/10.2.0/libstdc++.dll.a(d006521.o):(.text+0x0): first defined here
collect2.exe: error: ld returned 1 exit status
make[2]: *** [tests/CMakeFiles/run_tests.dir/build.make:213: tests/run_tests.exe] Error 1
make[1]: *** [CMakeFiles/Makefile2:321: tests/CMakeFiles/run_tests.dir/all] Error 2
make: *** [Makefile:183: all] Error 2

@coveralls
Copy link

coveralls commented Aug 26, 2020

Coverage Status

Coverage remained the same at 99.833% when pulling 38c7aa3 on giuspen:msys2_fix into ec0b029 on cpputest:master.

@basvodde
Copy link
Member

basvodde commented Sep 8, 2020

Uhm, this fix actually broke some of the cygwin builds... did you noticed that?

@giuspen
Copy link
Author

giuspen commented Sep 8, 2020

@basvodde I noticed, I was planning to change the macro to be more restrictive so that cygwin won't be impacted but only msys2, then I've been busy doing other stuff, I will get back on this. Unfortunately the cpputest in msys2 is unusable until I sort this out so I'm currently building it manually as you can see in https://github.com/giuspen/cherrytree/blob/master/.travis.yml avoiding to build that source file at all with the --disable-memory-leak-detection trick

case $TRAVIS_OS_NAME in
  windows)
    $mingw64 wget https://github.com/cpputest/cpputest/releases/download/v3.8/cpputest-3.8.tar.gz
    $mingw64 tar xf cpputest-3.8.tar.gz
    cd cpputest-3.8
    $mingw64 ./autogen.sh
    $mingw64 ./configure --disable-memory-leak-detection
    $mingw64 mingw32-make
    $mingw64 mingw32-make install
    ;;
esac

@giuspen giuspen closed this Sep 9, 2020
@basvodde
Copy link
Member

Closed ?

@giuspen
Copy link
Author

giuspen commented Sep 10, 2020

Sorry @basvodde it's because at the moment I don't have time to debug this issue anymore so I thought to just keep building cpputest on msys2 manually with --disable-memory-leak-detection for now. I noticed that even on msys2 the unit tests of cpputest fail with the changes that make it work for me so maybe it's me doing something wrong. If you have a moment to have a look it's easy to reproduce on msys2, my building instructions are https://github.com/giuspen/cherrytree/blob/master/README.md#building-cherrytree-on-windows if you remove --disable-memory-leak-detection cherrytree unit tests will fail to link with the error at the top of this pull request

@basvodde
Copy link
Member

Ok, thanks. I'll re-open it then so that we remember to do something about it (especially trying to get this in the automated build)

@giuspen giuspen reopened this Sep 10, 2020
@giuspen
Copy link
Author

giuspen commented Sep 10, 2020

Thanks @basvodde

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

Successfully merging this pull request may close these issues.

None yet

3 participants