libnui / nui3

libnui v3
http://libnui.net
Mozilla Public License 2.0
163 stars 31 forks source link

linker multiple definition on linux #23

Closed underdoeg closed 12 years ago

underdoeg commented 13 years ago

I just tried to compile the latest github version of nui on ubuntu linux 11.04 64 bits. Compiling runs fine, but linker gives the following error:

CMakeFiles/nui3.dir/src/Attributes/nuiAttribute.o: In function nuiGetNewAttributeUniqueId()': /home/phwhitfield/programming/cppLibs/nui3/include/nuiSignalsSlots.h:160: multiple definition ofnuiAttributeTypeTrait::mTypeId' CMakeFiles/nui3.dir/src/Bindings/nuiBindings.o:/home/phwhitfield/programming/cppLibs/nui3/src/Bindings/nuiBindings.cpp:62: first defined here collect2: ld returned 1 exit status make[2]: * [libnui3.so] Error 1 make[1]: * [CMakeFiles/nui3.dir/all] Error 2 make: *\ [all] Error 2

the following is the command used to: cmake . make -j8

meeloo commented 13 years ago

hi, I'm currently on a trip. I will have a look as soon as I can touch my dev machine. Thanks.

underdoeg commented 13 years ago

no worries, just wanted to try it out. have a nice trip

jaen commented 13 years ago

Any update on that? I hit the same error building on 64-bit Arch.

oOIssaMOo commented 13 years ago

I have the same issue , I’ve tried to install ia32-libs to run 32 bit applications in 64 bit Linux , but doesn't fix the problem!

meeloo commented 13 years ago

this is very strange, I have just build nui3 (the master branch as well as the nui4 branch) on my 64 bit Debian VM and I didn't had this error. What version of gcc are you using? (4.4.5-8 here).

jaen commented 13 years ago

4.6.1-4 on my side. Can try to downgrade to your GCC version and see if it builds then.

oOIssaMOo commented 13 years ago

did it work for you Jaen after downgrade gcc ? i tried the same and I had some other problems, so i want to know if it works for you? then maybe I investigate more in that way..

meeloo commented 13 years ago

Jaen: I'm also interested in your tests results. oOlssaMOo: can you file a new bug with the errors you had?

Thanks in advance!

jaen commented 13 years ago

nui3 builds on gcc 4.4.5, make install fails with following error:

tutorials/RSS/CMakeFiles/rss.dir/build.make:44: RSS/CMakeFiles/rss.dir/depend.make: No such file or directory
tutorials/RSS/CMakeFiles/rss.dir/build.make:47: RSS/CMakeFiles/rss.dir/progress.make: No such file or directory
tutorials/RSS/CMakeFiles/rss.dir/build.make:50: RSS/CMakeFiles/rss.dir/flags.make: No such file or directory
make[2]: *** No rule to make target `RSS/CMakeFiles/rss.dir/flags.make'.  Stop.
make[1]: *** [tutorials/RSS/CMakeFiles/rss.dir/all] Error 2
make: *** [all] Error 2

but that's probably something minor. Will try nui4 soon.

jaen commented 13 years ago

nui4 fails for me with these errors:

[ 32%] Building CXX object CMakeFiles/nui3.dir/src/AudioSamples/Unix/nuiAudioDecoder_Unix.o
In file included from /home/jaen/share/code/c/nui4/include/ngl.h:592,
                 from /home/jaen/share/code/c/nui4/include/nui.h:36,
                 from /home/jaen/share/code/c/nui4/src/AudioSamples/Unix/nuiAudioDecoder_Unix.cpp:8:
/home/jaen/share/code/c/nui4/include/nui_GL/glext.h:34:1: warning: "GL_GLEXT_VERSION" redefined
In file included from /usr/include/GL/gl.h:2091,
                 from /home/jaen/share/code/c/nui4/include/ngl.h:590,
                 from /home/jaen/share/code/c/nui4/include/nui.h:36,
                 from /home/jaen/share/code/c/nui4/src/AudioSamples/Unix/nuiAudioDecoder_Unix.cpp:8:
/usr/include/GL/glext.h:34:1: warning: this is the location of the previous definition
/home/jaen/share/code/c/nui4/src/AudioSamples/Unix/nuiAudioDecoder_Unix.cpp:12:20: error: mpg123.h: No such file or directory
/home/jaen/share/code/c/nui4/src/AudioSamples/Unix/nuiAudioDecoder_Unix.cpp:31: error: ISO C++ forbids declaration of ‘mpg123_handle’ with no type
/home/jaen/share/code/c/nui4/src/AudioSamples/Unix/nuiAudioDecoder_Unix.cpp:31: error: expected ‘;’ before ‘*’ token
/home/jaen/share/code/c/nui4/src/AudioSamples/Unix/nuiAudioDecoder_Unix.cpp: In constructor ‘nuiAudioDecoderPrivate::nuiAudioDecoderPrivate()’:
/home/jaen/share/code/c/nui4/src/AudioSamples/Unix/nuiAudioDecoder_Unix.cpp:39: error: class ‘nuiAudioDecoderPrivate’ does not have any field named ‘mpHandle’
/home/jaen/share/code/c/nui4/src/AudioSamples/Unix/nuiAudioDecoder_Unix.cpp: In member function ‘bool nuiAudioDecoderPrivate::Init()’:
/home/jaen/share/code/c/nui4/src/AudioSamples/Unix/nuiAudioDecoder_Unix.cpp:51: error: ‘MPG123_OK’ was not declared in this scope
/home/jaen/share/code/c/nui4/src/AudioSamples/Unix/nuiAudioDecoder_Unix.cpp:55: error: ‘mpg123_init’ was not declared in this scope
/home/jaen/share/code/c/nui4/src/AudioSamples/Unix/nuiAudioDecoder_Unix.cpp:62: error: ‘mpHandle’ was not declared in this scope
/home/jaen/share/code/c/nui4/src/AudioSamples/Unix/nuiAudioDecoder_Unix.cpp:62: error: ‘mpg123_new’ was not declared in this scope
/home/jaen/share/code/c/nui4/src/AudioSamples/Unix/nuiAudioDecoder_Unix.cpp:67: error: ‘mpg123_open_feed’ was not declared in this scope
/home/jaen/share/code/c/nui4/src/AudioSamples/Unix/nuiAudioDecoder_Unix.cpp:70: error: ‘mpg123_delete’ was not declared in this scope
/home/jaen/share/code/c/nui4/src/AudioSamples/Unix/nuiAudioDecoder_Unix.cpp: In member function ‘void nuiAudioDecoderPrivate::Clear()’:
/home/jaen/share/code/c/nui4/src/AudioSamples/Unix/nuiAudioDecoder_Unix.cpp:81: error: ‘mpHandle’ was not declared in this scope
/home/jaen/share/code/c/nui4/src/AudioSamples/Unix/nuiAudioDecoder_Unix.cpp:81: error: ‘mpg123_delete’ was not declared in this scope
/home/jaen/share/code/c/nui4/src/AudioSamples/Unix/nuiAudioDecoder_Unix.cpp:88: error: ‘mpg123_exit’ was not declared in this scope
/home/jaen/share/code/c/nui4/src/AudioSamples/Unix/nuiAudioDecoder_Unix.cpp: In member function ‘virtual bool nuiAudioDecoder::ReadInfo()’:
/home/jaen/share/code/c/nui4/src/AudioSamples/Unix/nuiAudioDecoder_Unix.cpp:137: error: ‘class nuiAudioDecoderPrivate’ has no member named ‘mpHandle’
/home/jaen/share/code/c/nui4/src/AudioSamples/Unix/nuiAudioDecoder_Unix.cpp:137: error: ‘mpg123_decode’ was not declared in this scope
/home/jaen/share/code/c/nui4/src/AudioSamples/Unix/nuiAudioDecoder_Unix.cpp:139: error: ‘MPG123_NEW_FORMAT’ was not declared in this scope
/home/jaen/share/code/c/nui4/src/AudioSamples/Unix/nuiAudioDecoder_Unix.cpp:141: error: ‘mpg123_frameinfo’ was not declared in this scope
/home/jaen/share/code/c/nui4/src/AudioSamples/Unix/nuiAudioDecoder_Unix.cpp:141: error: expected ‘;’ before ‘frameinfo’
/home/jaen/share/code/c/nui4/src/AudioSamples/Unix/nuiAudioDecoder_Unix.cpp:142: error: ‘class nuiAudioDecoderPrivate’ has no member named ‘mpHandle’
/home/jaen/share/code/c/nui4/src/AudioSamples/Unix/nuiAudioDecoder_Unix.cpp:142: error: ‘frameinfo’ was not declared in this scope
/home/jaen/share/code/c/nui4/src/AudioSamples/Unix/nuiAudioDecoder_Unix.cpp:142: error: ‘mpg123_info’ was not declared in this scope
/home/jaen/share/code/c/nui4/src/AudioSamples/Unix/nuiAudioDecoder_Unix.cpp:143: error: ‘MPG123_OK’ was not declared in this scope
/home/jaen/share/code/c/nui4/src/AudioSamples/Unix/nuiAudioDecoder_Unix.cpp:149: error: ‘MPG123_M_MONO’ was not declared in this scope
/home/jaen/share/code/c/nui4/src/AudioSamples/Unix/nuiAudioDecoder_Unix.cpp:155: error: ‘MPG123_ENC_SIGNED_16’ was not declared in this scope
/home/jaen/share/code/c/nui4/src/AudioSamples/Unix/nuiAudioDecoder_Unix.cpp:157: error: ‘class nuiAudioDecoderPrivate’ has no member named ‘mpHandle’
/home/jaen/share/code/c/nui4/src/AudioSamples/Unix/nuiAudioDecoder_Unix.cpp:157: error: ‘mpg123_format_support’ was not declared in this scope
/home/jaen/share/code/c/nui4/src/AudioSamples/Unix/nuiAudioDecoder_Unix.cpp:164: error: ‘MPG123_MONO’ was not declared in this scope
/home/jaen/share/code/c/nui4/src/AudioSamples/Unix/nuiAudioDecoder_Unix.cpp:165: error: ‘MPG123_STEREO’ was not declared in this scope
/home/jaen/share/code/c/nui4/src/AudioSamples/Unix/nuiAudioDecoder_Unix.cpp:175: error: ‘class nuiAudioDecoderPrivate’ has no member named ‘mpHandle’
/home/jaen/share/code/c/nui4/src/AudioSamples/Unix/nuiAudioDecoder_Unix.cpp:175: error: ‘mpg123_format_none’ was not declared in this scope
/home/jaen/share/code/c/nui4/src/AudioSamples/Unix/nuiAudioDecoder_Unix.cpp:177: error: ‘class nuiAudioDecoderPrivate’ has no member named ‘mpHandle’
/home/jaen/share/code/c/nui4/src/AudioSamples/Unix/nuiAudioDecoder_Unix.cpp:177: error: ‘mpg123_format’ was not declared in this scope
/home/jaen/share/code/c/nui4/src/AudioSamples/Unix/nuiAudioDecoder_Unix.cpp:178: error: ‘MPG123_OK’ was not declared in this scope
/home/jaen/share/code/c/nui4/src/AudioSamples/Unix/nuiAudioDecoder_Unix.cpp:183: error: ‘class nuiAudioDecoderPrivate’ has no member named ‘mpHandle’
/home/jaen/share/code/c/nui4/src/AudioSamples/Unix/nuiAudioDecoder_Unix.cpp:183: error: ‘mpg123_length’ was not declared in this scope
/home/jaen/share/code/c/nui4/src/AudioSamples/Unix/nuiAudioDecoder_Unix.cpp:192: error: ‘MPG123_ENC_FLOAT_32’ was not declared in this scope
/home/jaen/share/code/c/nui4/src/AudioSamples/Unix/nuiAudioDecoder_Unix.cpp: In member function ‘bool nuiAudioDecoder::Seek(uint64)’:
/home/jaen/share/code/c/nui4/src/AudioSamples/Unix/nuiAudioDecoder_Unix.cpp:215: error: ‘class nuiAudioDecoderPrivate’ has no member named ‘mpHandle’
/home/jaen/share/code/c/nui4/src/AudioSamples/Unix/nuiAudioDecoder_Unix.cpp:215: error: ‘mpg123_feedseek’ was not declared in this scope
/home/jaen/share/code/c/nui4/src/AudioSamples/Unix/nuiAudioDecoder_Unix.cpp: In member function ‘virtual uint32 nuiAudioDecoder::ReadIN(void*, uint32, nuiSampleBitFormat)’:
/home/jaen/share/code/c/nui4/src/AudioSamples/Unix/nuiAudioDecoder_Unix.cpp:261: error: ‘MPG123_OK’ was not declared in this scope
/home/jaen/share/code/c/nui4/src/AudioSamples/Unix/nuiAudioDecoder_Unix.cpp:262: error: ‘MPG123_DONE’ was not declared in this scope
/home/jaen/share/code/c/nui4/src/AudioSamples/Unix/nuiAudioDecoder_Unix.cpp:266: error: ‘class nuiAudioDecoderPrivate’ has no member named ‘mpHandle’
/home/jaen/share/code/c/nui4/src/AudioSamples/Unix/nuiAudioDecoder_Unix.cpp:266: error: ‘mpg123_decode’ was not declared in this scope
/home/jaen/share/code/c/nui4/src/AudioSamples/Unix/nuiAudioDecoder_Unix.cpp:270: error: ‘MPG123_NEW_FORMAT’ was not declared in this scope
/home/jaen/share/code/c/nui4/src/AudioSamples/Unix/nuiAudioDecoder_Unix.cpp:275: error: ‘class nuiAudioDecoderPrivate’ has no member named ‘mpHandle’
/home/jaen/share/code/c/nui4/src/AudioSamples/Unix/nuiAudioDecoder_Unix.cpp:275: error: ‘mpg123_getformat’ was not declared in this scope
/home/jaen/share/code/c/nui4/src/AudioSamples/Unix/nuiAudioDecoder_Unix.cpp:279: error: ‘MPG123_NEED_MORE’ was not declared in this scope
/home/jaen/share/code/c/nui4/src/AudioSamples/Unix/nuiAudioDecoder_Unix.cpp:287: error: ‘class nuiAudioDecoderPrivate’ has no member named ‘mpHandle’
make[2]: *** [CMakeFiles/nui3.dir/src/AudioSamples/Unix/nuiAudioDecoder_Unix.o] Error 1
make[1]: *** [CMakeFiles/nui3.dir/all] Error 2
make: *** [all] Error 2
oOIssaMOo commented 13 years ago

Nui3 fails with gcc 4.5.2 :

Linking CXX shared library libnui3.so

CMakeFiles/nui3.dir/src/Attributes/nuiAttribute.o:(.bss._ZN21nuiAttributeTypeTraitIvE7mTypeIdE[nuiAttributeTypeTrait::mTypeId]+0x0): multiple definition of `nuiAttributeTypeTrait::mTypeId' CMakeFiles/nui3.dir/src/Bindings/nuiBindings.o:/home/issam/Bureau/nui_lib/nui3/src/Bindings/nuiBindings.cpp:62: first defined here collect2: ld returned 1 exit status make[2]: * [libnui3.so] Erreur 1 make[1]: * [CMakeFiles/nui3.dir/all] Erreur 2 make: *\ [all] Erreur 2

meeloo commented 13 years ago

Jaen: thanks for the output, I have added an implementation of nuiAudioDecoder in nui4, can you try to install libmpg123 dev files? I haven't found a way to check its presence with CMake yet.

oOlssaMOo: ok, so that really is what I need to fix. I remember having seen something similar with beta versions of the clang compiler one year ago or so. I haven't been able to upgrade my version of gcc on my linux VMs yet but I'll try to have a look asap.

An idea, somebody?

jaen commented 13 years ago

Actually for me the nui3 branch compiles, but there has to be something wrong with it since it segfaults on some of the tutorial applications.

After installing libmpg123 nui4 compiled, but when I try to compile any of the tutorial examples it barfs a lot of syntactic errors from coming from the nui headers, so again something has to be wrong there.

I'll try looking into this more.

oOIssaMOo commented 12 years ago

Hello everyone, Any News ? meeloo : I have no idea on how to upgrade gcc on à VM . Did you check the problem ? i think it doesn’t depend on the architecture 32 Or 64 bit .. Anyway, you said that you saw something similar before, can you please give me the link to the thread .

kuroyi commented 12 years ago

gcc version 4.6.1 20110908 (Red Hat 4.6.1-9) (GCC)

I had to enable the #ifdef clang section of code in nuiVariant.h for nui3 to link.

meeloo commented 12 years ago

thanks for finding a solution kuroyi! I have added a check for your version of gcc in that file.

meeloo commented 12 years ago

I'll close that bug now. Reopen it if the fix doesn't work for you guys! Thanks!