Issue with make and "multiple definition"

Support for running, installing or compiling OpenMW

Before you submit a bug report for the first time, please read: Bug reporting guidelines
Post Reply
User avatar
bwhaines
Posts: 6
Joined: 01 May 2017, 18:18
Location: East Coast US

Issue with make and "multiple definition"

Post by bwhaines » 09 Aug 2017, 16:24

Hello all,

I'm trying to build OpenMW and OSG for Android, but I've run into an interesting problem. Building OpenMW gets to the linking stage before failing with a bunch of errors like this:

Code: Select all

/home/bwhaines/AndroidStudioProjects/android-port/deps/android14-toolchain/bin/../lib/gcc/arm-linux-androideabi/4.9/../../../../arm-linux-androideabi/bin/ld: error: /home/bwhaines/AndroidStudioProjects/android-port/deps/android14-toolchain/sysroot/usr/lib/osgPlugins-3.4.0/libosgdb_bmp.a(ReaderWriterBMP.cpp.o): multiple definition of 'osgdb_bmp'
/home/bwhaines/AndroidStudioProjects/android-port/deps/android14-toolchain/bin/../lib/gcc/arm-linux-androideabi/4.9/../../../../arm-linux-androideabi/bin/ld: /home/bwhaines/AndroidStudioProjects/android-port/deps/android14-toolchain/sysroot/usr/lib/osgPlugins-3.4.0/libosgdb_bmp.a(ReaderWriterBMP.cpp.o): previous definition here
/home/bwhaines/AndroidStudioProjects/android-port/deps/android14-toolchain/bin/../lib/gcc/arm-linux-androideabi/4.9/../../../../arm-linux-androideabi/bin/ld: error: /home/bwhaines/AndroidStudioProjects/android-port/deps/android14-toolchain/sysroot/usr/lib/osgPlugins-3.4.0/libosgdb_dds.a(ReaderWriterDDS.cpp.o): multiple definition of 'WriteDDSFile(osg::Image const*, std::ostream&, bool)'
/home/bwhaines/AndroidStudioProjects/android-port/deps/android14-toolchain/bin/../lib/gcc/arm-linux-androideabi/4.9/../../../../arm-linux-androideabi/bin/ld: /home/bwhaines/AndroidStudioProjects/android-port/deps/android14-toolchain/sysroot/usr/lib/osgPlugins-3.4.0/libosgdb_dds.a(ReaderWriterDDS.cpp.o): previous definition here
/home/bwhaines/AndroidStudioProjects/android-port/deps/android14-toolchain/bin/../lib/gcc/arm-linux-androideabi/4.9/../../../../arm-linux-androideabi/bin/ld: error: /home/bwhaines/AndroidStudioProjects/android-port/deps/android14-toolchain/sysroot/usr/lib/osgPlugins-3.4.0/libosgdb_dds.a(ReaderWriterDDS.cpp.o): multiple definition of 'osgdb_dds'
/home/bwhaines/AndroidStudioProjects/android-port/deps/android14-toolchain/bin/../lib/gcc/arm-linux-androideabi/4.9/../../../../arm-linux-androideabi/bin/ld: /home/bwhaines/AndroidStudioProjects/android-port/deps/android14-toolchain/sysroot/usr/lib/osgPlugins-3.4.0/libosgdb_dds.a(ReaderWriterDDS.cpp.o): previous definition here
There are errors like these for almost every OSG plugin built. I'm aware the issue is that OSG's object files are being linked twice, but I'm not seeing in the Makefiles where that's happening. Granted, I haven't worked with Make on a low level enough to know where to look :P

I've attached the two main Makefiles, if someone wants to look through them. Here is the script I used to build OpenMW and its dependencies: https://github.com/bwhaines/android-por ... mw_deps.sh

Has anyone else seen an issue like this before? Thanks in advance for any advice you can give!
Attachments
Makefile2.txt
(315.16 KiB) Downloaded 80 times
Makefile.txt
(55.02 KiB) Downloaded 123 times

User avatar
psi29a
Posts: 4915
Joined: 29 Sep 2011, 10:13
Location: Belgium
Gitlab profile: https://gitlab.com/psi29a/
Contact:

Re: Issue with make and "multiple definition"

Post by psi29a » 09 Aug 2017, 16:32

Thanks for looking into this, you haven't run into any issues with C++11?

Are the OSG plugins being built and are in the link path?

User avatar
bwhaines
Posts: 6
Joined: 01 May 2017, 18:18
Location: East Coast US

Re: Issue with make and "multiple definition"

Post by bwhaines » 13 Aug 2017, 20:12

Sorry it took so long to respond, I've been out of town.

No, building it for my desktop doesn't cause any issues. This only happens when cross-compiling it. The plugins are all being built as far as I can tell, and the script copies them to the toolchain's sysroot along with all of the other libraries right after building them.

Post Reply