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

undefined reference to `Corrade::Utility::Debug Magnum::Math::operator<< <2ul, int>(Corrade::Utility::Debug, Magnum::Math::Vector<2ul, int> const&) #73

Closed
wivlaro opened this Issue Nov 9, 2014 · 8 comments

Comments

Projects
None yet
2 participants
@wivlaro
Contributor

wivlaro commented Nov 9, 2014

I'm having to comment out this line to get it to compile properly:

    Error() << "TextureTools::atlas(): requested atlas size" << atlasSize
            << "is too small to fit" << sizes.size() << paddedSize
            << "textures. Generated atlas will be empty.";

Otherwise I get this error:

/usr/local/lib/libMagnumTextureTools-d.a(Atlas.cpp.o): In function `Corrade::Utility::Debug Magnum::Math::operator<< <int>(Corrade::Utility::Debug, Magnum::Math::Vector2<int> const&)':
/home/bill/programming/magnum/src/Magnum/Math/Vector2.h:169: undefined reference to `Corrade::Utility::Debug Magnum::Math::operator<< <2ul, int>(Corrade::Utility::Debug, Magnum::Math::Vector<2ul, int> const&)'
collect2: error: ld returned 1 exit status

I have the library just compiled statically, btw. These are my cmake options:
-DBUILD_STATIC=ON -DBUILD_PLUGINS_STATIC=ON -DWITH_SDL2APPLICATION=ON -DWITH_AUDIO=ON -DWITH_DEBUGTOOLS=ON -DWITH_TEXT=ON -DWITH_OBJIMPORTER=ON -DWITH_TGAIMPORTER=ON -DWITH_TGAIMAGECONVERTER=ON -DWITH_MAGNUMFONTCONVERTER=ON

@mosra

This comment has been minimized.

Show comment
Hide comment
@mosra

mosra Nov 9, 2014

Owner

Hi, I'm just trying to reproduce this (GCC 4.7, 4.9, clang, libc++, libstdc++, static, non-static) and unfortunately everything is working fine here. Can you try a clean rebuild of both Corrade and Magnum libraries? I don't recall doing any binary-incompatible changes lately, but just to be sure :)

I think you already sent me your system info, but can't find that right now. What's your OS, compiler, compiler version, is Corrade also built statically?

Owner

mosra commented Nov 9, 2014

Hi, I'm just trying to reproduce this (GCC 4.7, 4.9, clang, libc++, libstdc++, static, non-static) and unfortunately everything is working fine here. Can you try a clean rebuild of both Corrade and Magnum libraries? I don't recall doing any binary-incompatible changes lately, but just to be sure :)

I think you already sent me your system info, but can't find that right now. What's your OS, compiler, compiler version, is Corrade also built statically?

@mosra

This comment has been minimized.

Show comment
Hide comment
@mosra

mosra Dec 25, 2014

Owner

I'm sorry, does this error still appear or can I close this?

Owner

mosra commented Dec 25, 2014

I'm sorry, does this error still appear or can I close this?

@wivlaro

This comment has been minimized.

Show comment
Hide comment
@wivlaro

wivlaro Jan 4, 2015

Contributor

I still get this with a plain magnum install on Ubuntu 14.10. Compiler: gcc (Ubuntu 4.9.1-16ubuntu6) 4.9.

Here's my setup script snippet if it helps too:

MAKE_OPTIONS=-j2

DEPS_BUILD_TYPE=Debug

    set +e
    git clone git://github.com/mosra/corrade.git
    set -e
    (
        cd corrade
        git pull
        mkdir -p Build/$DEPS_BUILD_TYPE && cd Build/$DEPS_BUILD_TYPE
        cmake ../.. -DCMAKE_BUILD_TYPE=$DEPS_BUILD_TYPE -DBUILD_STATIC=ON
        make $MAKE_OPTIONS
        sudo make install
    )

    set +e
    git clone git://github.com/mosra/magnum.git
    set -e
    (
        cd magnum
        git pull
        mkdir -p Build/$DEPS_BUILD_TYPE && cd Build/$DEPS_BUILD_TYPE
        cmake ../.. -DCMAKE_BUILD_TYPE=$DEPS_BUILD_TYPE -DBUILD_STATIC=ON -DBUILD_PLUGINS_STATIC=ON -DWITH_SDL2APPLICATION=ON -DWITH_AUDIO=ON -DWITH_DEBUGTOOLS=ON -DWITH_TEXT=ON -DWITH_OBJIMPORTER=ON -DWITH_TGAIMPORTER=ON -DWITH_TGAIMAGECONVERTER=ON -DWITH_MAGNUMFONTCONVERTER=ON 
        make $MAKE_OPTIONS
        sudo make install
    )

    set +e
    git clone git://github.com/mosra/magnum-plugins.git
    set -e
    (
        cd magnum-plugins
        git pull
        mkdir -p Build/$DEPS_BUILD_TYPE && cd Build/$DEPS_BUILD_TYPE
        cmake ../.. -DCMAKE_BUILD_TYPE=$DEPS_BUILD_TYPE -DBUILD_STATIC=ON -DWITH_COLLADAIMPORTER=ON -DWITH_FREETYPEFONT=ON -DWITH_JPEGIMPORTER=ON -DWITH_PNGIMPORTER=ON -DWITH_ANYIMAGEIMPORTER=ON
        make $MAKE_OPTIONS
        sudo make install
    )

Also, when inspecting the symbols in the .a files that result, this is what I get:

> nm -AC /usr/local/lib/libMagnum*.a | grep 'operator<<.*Vector'
/usr/local/lib/libMagnum.a:AbstractShaderProgram.cpp.o:00000000000052db T Magnum::Implementation::operator<<(Corrade::Utility::Debug, Magnum::Implementation::Attribute<Magnum::Math::Vector<3ul, float> >::DataType)
/usr/local/lib/libMagnum.a:AbstractShaderProgram.cpp.o:0000000000004f6c T Magnum::Implementation::operator<<(Corrade::Utility::Debug, Magnum::Implementation::Attribute<Magnum::Math::Vector<4ul, float> >::Components)
/usr/local/lib/libMagnum.a:AbstractShaderProgram.cpp.o:00000000000054b8 T Magnum::Implementation::operator<<(Corrade::Utility::Debug, Magnum::Implementation::Attribute<Magnum::Math::Vector<4ul, float> >::DataType)
/usr/local/lib/libMagnum.a:instantiation.cpp.o:0000000000000000 W Corrade::Utility::Debug Magnum::Math::operator<< <2ul, double>(Corrade::Utility::Debug, Magnum::Math::Vector<2ul, double> const&)
/usr/local/lib/libMagnum.a:instantiation.cpp.o:0000000000000000 W Corrade::Utility::Debug Magnum::Math::operator<< <2ul, float>(Corrade::Utility::Debug, Magnum::Math::Vector<2ul, float> const&)
/usr/local/lib/libMagnum.a:instantiation.cpp.o:0000000000000000 W Corrade::Utility::Debug Magnum::Math::operator<< <2ul, int>(Corrade::Utility::Debug, Magnum::Math::Vector<2ul, int> const&)
/usr/local/lib/libMagnum.a:instantiation.cpp.o:0000000000000000 W Corrade::Utility::Debug Magnum::Math::operator<< <2ul, unsigned int>(Corrade::Utility::Debug, Magnum::Math::Vector<2ul, unsigned int> const&)
/usr/local/lib/libMagnum.a:instantiation.cpp.o:0000000000000000 W Corrade::Utility::Debug Magnum::Math::operator<< <3ul, double>(Corrade::Utility::Debug, Magnum::Math::Vector<3ul, double> const&)
/usr/local/lib/libMagnum.a:instantiation.cpp.o:0000000000000000 W Corrade::Utility::Debug Magnum::Math::operator<< <3ul, float>(Corrade::Utility::Debug, Magnum::Math::Vector<3ul, float> const&)
/usr/local/lib/libMagnum.a:instantiation.cpp.o:0000000000000000 W Corrade::Utility::Debug Magnum::Math::operator<< <3ul, int>(Corrade::Utility::Debug, Magnum::Math::Vector<3ul, int> const&)
/usr/local/lib/libMagnum.a:instantiation.cpp.o:0000000000000000 W Corrade::Utility::Debug Magnum::Math::operator<< <3ul, unsigned int>(Corrade::Utility::Debug, Magnum::Math::Vector<3ul, unsigned int> const&)
/usr/local/lib/libMagnum.a:instantiation.cpp.o:0000000000000000 W Corrade::Utility::Debug Magnum::Math::operator<< <4ul, double>(Corrade::Utility::Debug, Magnum::Math::Vector<4ul, double> const&)
/usr/local/lib/libMagnum.a:instantiation.cpp.o:0000000000000000 W Corrade::Utility::Debug Magnum::Math::operator<< <4ul, float>(Corrade::Utility::Debug, Magnum::Math::Vector<4ul, float> const&)
/usr/local/lib/libMagnum.a:instantiation.cpp.o:0000000000000000 W Corrade::Utility::Debug Magnum::Math::operator<< <4ul, int>(Corrade::Utility::Debug, Magnum::Math::Vector<4ul, int> const&)
/usr/local/lib/libMagnum.a:instantiation.cpp.o:0000000000000000 W Corrade::Utility::Debug Magnum::Math::operator<< <4ul, unsigned int>(Corrade::Utility::Debug, Magnum::Math::Vector<4ul, unsigned int> const&)
/usr/local/lib/libMagnum-d.a:Attribute.cpp.o:000000000000115b T Magnum::Implementation::operator<<(Corrade::Utility::Debug, Magnum::Implementation::Attribute<Magnum::Math::Vector<3ul, float> >::DataType)
/usr/local/lib/libMagnum-d.a:Attribute.cpp.o:0000000000000dec T Magnum::Implementation::operator<<(Corrade::Utility::Debug, Magnum::Implementation::Attribute<Magnum::Math::Vector<4ul, float> >::Components)
/usr/local/lib/libMagnum-d.a:Attribute.cpp.o:0000000000001338 T Magnum::Implementation::operator<<(Corrade::Utility::Debug, Magnum::Implementation::Attribute<Magnum::Math::Vector<4ul, float> >::DataType)
/usr/local/lib/libMagnum-d.a:instantiation.cpp.o:0000000000000000 W Corrade::Utility::Debug Magnum::Math::operator<< <2ul, double>(Corrade::Utility::Debug, Magnum::Math::Vector<2ul, double> const&)
/usr/local/lib/libMagnum-d.a:instantiation.cpp.o:0000000000000000 W Corrade::Utility::Debug Magnum::Math::operator<< <2ul, float>(Corrade::Utility::Debug, Magnum::Math::Vector<2ul, float> const&)
/usr/local/lib/libMagnum-d.a:instantiation.cpp.o:0000000000000000 W Corrade::Utility::Debug Magnum::Math::operator<< <2ul, int>(Corrade::Utility::Debug, Magnum::Math::Vector<2ul, int> const&)
/usr/local/lib/libMagnum-d.a:instantiation.cpp.o:0000000000000000 W Corrade::Utility::Debug Magnum::Math::operator<< <2ul, unsigned int>(Corrade::Utility::Debug, Magnum::Math::Vector<2ul, unsigned int> const&)
/usr/local/lib/libMagnum-d.a:instantiation.cpp.o:0000000000000000 W Corrade::Utility::Debug Magnum::Math::operator<< <3ul, double>(Corrade::Utility::Debug, Magnum::Math::Vector<3ul, double> const&)
/usr/local/lib/libMagnum-d.a:instantiation.cpp.o:0000000000000000 W Corrade::Utility::Debug Magnum::Math::operator<< <3ul, float>(Corrade::Utility::Debug, Magnum::Math::Vector<3ul, float> const&)
/usr/local/lib/libMagnum-d.a:instantiation.cpp.o:0000000000000000 W Corrade::Utility::Debug Magnum::Math::operator<< <3ul, int>(Corrade::Utility::Debug, Magnum::Math::Vector<3ul, int> const&)
/usr/local/lib/libMagnum-d.a:instantiation.cpp.o:0000000000000000 W Corrade::Utility::Debug Magnum::Math::operator<< <3ul, unsigned int>(Corrade::Utility::Debug, Magnum::Math::Vector<3ul, unsigned int> const&)
/usr/local/lib/libMagnum-d.a:instantiation.cpp.o:0000000000000000 W Corrade::Utility::Debug Magnum::Math::operator<< <4ul, double>(Corrade::Utility::Debug, Magnum::Math::Vector<4ul, double> const&)
/usr/local/lib/libMagnum-d.a:instantiation.cpp.o:0000000000000000 W Corrade::Utility::Debug Magnum::Math::operator<< <4ul, float>(Corrade::Utility::Debug, Magnum::Math::Vector<4ul, float> const&)
/usr/local/lib/libMagnum-d.a:instantiation.cpp.o:0000000000000000 W Corrade::Utility::Debug Magnum::Math::operator<< <4ul, int>(Corrade::Utility::Debug, Magnum::Math::Vector<4ul, int> const&)
/usr/local/lib/libMagnum-d.a:instantiation.cpp.o:0000000000000000 W Corrade::Utility::Debug Magnum::Math::operator<< <4ul, unsigned int>(Corrade::Utility::Debug, Magnum::Math::Vector<4ul, unsigned int> const&)
/usr/local/lib/libMagnumTextureTools.a:Atlas.cpp.o:0000000000000000 W Corrade::Utility::Debug Magnum::Math::operator<< <int>(Corrade::Utility::Debug, Magnum::Math::Vector2<int> const&)
/usr/local/lib/libMagnumTextureTools.a:Atlas.cpp.o:                 U Corrade::Utility::Debug Magnum::Math::operator<< <2ul, int>(Corrade::Utility::Debug, Magnum::Math::Vector<2ul, int> const&)
/usr/local/lib/libMagnumTextureTools-d.a:Atlas.cpp.o:0000000000000000 W Corrade::Utility::Debug Magnum::Math::operator<< <int>(Corrade::Utility::Debug, Magnum::Math::Vector2<int> const&)
/usr/local/lib/libMagnumTextureTools-d.a:Atlas.cpp.o:                 U Corrade::Utility::Debug Magnum::Math::operator<< <2ul, int>(Corrade::Utility::Debug, Magnum::Math::Vector<2ul, int> const&)
Contributor

wivlaro commented Jan 4, 2015

I still get this with a plain magnum install on Ubuntu 14.10. Compiler: gcc (Ubuntu 4.9.1-16ubuntu6) 4.9.

Here's my setup script snippet if it helps too:

MAKE_OPTIONS=-j2

DEPS_BUILD_TYPE=Debug

    set +e
    git clone git://github.com/mosra/corrade.git
    set -e
    (
        cd corrade
        git pull
        mkdir -p Build/$DEPS_BUILD_TYPE && cd Build/$DEPS_BUILD_TYPE
        cmake ../.. -DCMAKE_BUILD_TYPE=$DEPS_BUILD_TYPE -DBUILD_STATIC=ON
        make $MAKE_OPTIONS
        sudo make install
    )

    set +e
    git clone git://github.com/mosra/magnum.git
    set -e
    (
        cd magnum
        git pull
        mkdir -p Build/$DEPS_BUILD_TYPE && cd Build/$DEPS_BUILD_TYPE
        cmake ../.. -DCMAKE_BUILD_TYPE=$DEPS_BUILD_TYPE -DBUILD_STATIC=ON -DBUILD_PLUGINS_STATIC=ON -DWITH_SDL2APPLICATION=ON -DWITH_AUDIO=ON -DWITH_DEBUGTOOLS=ON -DWITH_TEXT=ON -DWITH_OBJIMPORTER=ON -DWITH_TGAIMPORTER=ON -DWITH_TGAIMAGECONVERTER=ON -DWITH_MAGNUMFONTCONVERTER=ON 
        make $MAKE_OPTIONS
        sudo make install
    )

    set +e
    git clone git://github.com/mosra/magnum-plugins.git
    set -e
    (
        cd magnum-plugins
        git pull
        mkdir -p Build/$DEPS_BUILD_TYPE && cd Build/$DEPS_BUILD_TYPE
        cmake ../.. -DCMAKE_BUILD_TYPE=$DEPS_BUILD_TYPE -DBUILD_STATIC=ON -DWITH_COLLADAIMPORTER=ON -DWITH_FREETYPEFONT=ON -DWITH_JPEGIMPORTER=ON -DWITH_PNGIMPORTER=ON -DWITH_ANYIMAGEIMPORTER=ON
        make $MAKE_OPTIONS
        sudo make install
    )

Also, when inspecting the symbols in the .a files that result, this is what I get:

> nm -AC /usr/local/lib/libMagnum*.a | grep 'operator<<.*Vector'
/usr/local/lib/libMagnum.a:AbstractShaderProgram.cpp.o:00000000000052db T Magnum::Implementation::operator<<(Corrade::Utility::Debug, Magnum::Implementation::Attribute<Magnum::Math::Vector<3ul, float> >::DataType)
/usr/local/lib/libMagnum.a:AbstractShaderProgram.cpp.o:0000000000004f6c T Magnum::Implementation::operator<<(Corrade::Utility::Debug, Magnum::Implementation::Attribute<Magnum::Math::Vector<4ul, float> >::Components)
/usr/local/lib/libMagnum.a:AbstractShaderProgram.cpp.o:00000000000054b8 T Magnum::Implementation::operator<<(Corrade::Utility::Debug, Magnum::Implementation::Attribute<Magnum::Math::Vector<4ul, float> >::DataType)
/usr/local/lib/libMagnum.a:instantiation.cpp.o:0000000000000000 W Corrade::Utility::Debug Magnum::Math::operator<< <2ul, double>(Corrade::Utility::Debug, Magnum::Math::Vector<2ul, double> const&)
/usr/local/lib/libMagnum.a:instantiation.cpp.o:0000000000000000 W Corrade::Utility::Debug Magnum::Math::operator<< <2ul, float>(Corrade::Utility::Debug, Magnum::Math::Vector<2ul, float> const&)
/usr/local/lib/libMagnum.a:instantiation.cpp.o:0000000000000000 W Corrade::Utility::Debug Magnum::Math::operator<< <2ul, int>(Corrade::Utility::Debug, Magnum::Math::Vector<2ul, int> const&)
/usr/local/lib/libMagnum.a:instantiation.cpp.o:0000000000000000 W Corrade::Utility::Debug Magnum::Math::operator<< <2ul, unsigned int>(Corrade::Utility::Debug, Magnum::Math::Vector<2ul, unsigned int> const&)
/usr/local/lib/libMagnum.a:instantiation.cpp.o:0000000000000000 W Corrade::Utility::Debug Magnum::Math::operator<< <3ul, double>(Corrade::Utility::Debug, Magnum::Math::Vector<3ul, double> const&)
/usr/local/lib/libMagnum.a:instantiation.cpp.o:0000000000000000 W Corrade::Utility::Debug Magnum::Math::operator<< <3ul, float>(Corrade::Utility::Debug, Magnum::Math::Vector<3ul, float> const&)
/usr/local/lib/libMagnum.a:instantiation.cpp.o:0000000000000000 W Corrade::Utility::Debug Magnum::Math::operator<< <3ul, int>(Corrade::Utility::Debug, Magnum::Math::Vector<3ul, int> const&)
/usr/local/lib/libMagnum.a:instantiation.cpp.o:0000000000000000 W Corrade::Utility::Debug Magnum::Math::operator<< <3ul, unsigned int>(Corrade::Utility::Debug, Magnum::Math::Vector<3ul, unsigned int> const&)
/usr/local/lib/libMagnum.a:instantiation.cpp.o:0000000000000000 W Corrade::Utility::Debug Magnum::Math::operator<< <4ul, double>(Corrade::Utility::Debug, Magnum::Math::Vector<4ul, double> const&)
/usr/local/lib/libMagnum.a:instantiation.cpp.o:0000000000000000 W Corrade::Utility::Debug Magnum::Math::operator<< <4ul, float>(Corrade::Utility::Debug, Magnum::Math::Vector<4ul, float> const&)
/usr/local/lib/libMagnum.a:instantiation.cpp.o:0000000000000000 W Corrade::Utility::Debug Magnum::Math::operator<< <4ul, int>(Corrade::Utility::Debug, Magnum::Math::Vector<4ul, int> const&)
/usr/local/lib/libMagnum.a:instantiation.cpp.o:0000000000000000 W Corrade::Utility::Debug Magnum::Math::operator<< <4ul, unsigned int>(Corrade::Utility::Debug, Magnum::Math::Vector<4ul, unsigned int> const&)
/usr/local/lib/libMagnum-d.a:Attribute.cpp.o:000000000000115b T Magnum::Implementation::operator<<(Corrade::Utility::Debug, Magnum::Implementation::Attribute<Magnum::Math::Vector<3ul, float> >::DataType)
/usr/local/lib/libMagnum-d.a:Attribute.cpp.o:0000000000000dec T Magnum::Implementation::operator<<(Corrade::Utility::Debug, Magnum::Implementation::Attribute<Magnum::Math::Vector<4ul, float> >::Components)
/usr/local/lib/libMagnum-d.a:Attribute.cpp.o:0000000000001338 T Magnum::Implementation::operator<<(Corrade::Utility::Debug, Magnum::Implementation::Attribute<Magnum::Math::Vector<4ul, float> >::DataType)
/usr/local/lib/libMagnum-d.a:instantiation.cpp.o:0000000000000000 W Corrade::Utility::Debug Magnum::Math::operator<< <2ul, double>(Corrade::Utility::Debug, Magnum::Math::Vector<2ul, double> const&)
/usr/local/lib/libMagnum-d.a:instantiation.cpp.o:0000000000000000 W Corrade::Utility::Debug Magnum::Math::operator<< <2ul, float>(Corrade::Utility::Debug, Magnum::Math::Vector<2ul, float> const&)
/usr/local/lib/libMagnum-d.a:instantiation.cpp.o:0000000000000000 W Corrade::Utility::Debug Magnum::Math::operator<< <2ul, int>(Corrade::Utility::Debug, Magnum::Math::Vector<2ul, int> const&)
/usr/local/lib/libMagnum-d.a:instantiation.cpp.o:0000000000000000 W Corrade::Utility::Debug Magnum::Math::operator<< <2ul, unsigned int>(Corrade::Utility::Debug, Magnum::Math::Vector<2ul, unsigned int> const&)
/usr/local/lib/libMagnum-d.a:instantiation.cpp.o:0000000000000000 W Corrade::Utility::Debug Magnum::Math::operator<< <3ul, double>(Corrade::Utility::Debug, Magnum::Math::Vector<3ul, double> const&)
/usr/local/lib/libMagnum-d.a:instantiation.cpp.o:0000000000000000 W Corrade::Utility::Debug Magnum::Math::operator<< <3ul, float>(Corrade::Utility::Debug, Magnum::Math::Vector<3ul, float> const&)
/usr/local/lib/libMagnum-d.a:instantiation.cpp.o:0000000000000000 W Corrade::Utility::Debug Magnum::Math::operator<< <3ul, int>(Corrade::Utility::Debug, Magnum::Math::Vector<3ul, int> const&)
/usr/local/lib/libMagnum-d.a:instantiation.cpp.o:0000000000000000 W Corrade::Utility::Debug Magnum::Math::operator<< <3ul, unsigned int>(Corrade::Utility::Debug, Magnum::Math::Vector<3ul, unsigned int> const&)
/usr/local/lib/libMagnum-d.a:instantiation.cpp.o:0000000000000000 W Corrade::Utility::Debug Magnum::Math::operator<< <4ul, double>(Corrade::Utility::Debug, Magnum::Math::Vector<4ul, double> const&)
/usr/local/lib/libMagnum-d.a:instantiation.cpp.o:0000000000000000 W Corrade::Utility::Debug Magnum::Math::operator<< <4ul, float>(Corrade::Utility::Debug, Magnum::Math::Vector<4ul, float> const&)
/usr/local/lib/libMagnum-d.a:instantiation.cpp.o:0000000000000000 W Corrade::Utility::Debug Magnum::Math::operator<< <4ul, int>(Corrade::Utility::Debug, Magnum::Math::Vector<4ul, int> const&)
/usr/local/lib/libMagnum-d.a:instantiation.cpp.o:0000000000000000 W Corrade::Utility::Debug Magnum::Math::operator<< <4ul, unsigned int>(Corrade::Utility::Debug, Magnum::Math::Vector<4ul, unsigned int> const&)
/usr/local/lib/libMagnumTextureTools.a:Atlas.cpp.o:0000000000000000 W Corrade::Utility::Debug Magnum::Math::operator<< <int>(Corrade::Utility::Debug, Magnum::Math::Vector2<int> const&)
/usr/local/lib/libMagnumTextureTools.a:Atlas.cpp.o:                 U Corrade::Utility::Debug Magnum::Math::operator<< <2ul, int>(Corrade::Utility::Debug, Magnum::Math::Vector<2ul, int> const&)
/usr/local/lib/libMagnumTextureTools-d.a:Atlas.cpp.o:0000000000000000 W Corrade::Utility::Debug Magnum::Math::operator<< <int>(Corrade::Utility::Debug, Magnum::Math::Vector2<int> const&)
/usr/local/lib/libMagnumTextureTools-d.a:Atlas.cpp.o:                 U Corrade::Utility::Debug Magnum::Math::operator<< <2ul, int>(Corrade::Utility::Debug, Magnum::Math::Vector<2ul, int> const&)
@mosra

This comment has been minimized.

Show comment
Hide comment
@mosra

mosra Jan 4, 2015

Owner

Oh, so if I understand correctly, Magnum compiles and installs without issue and the linker error happens when linking some application executable later?

If that's the case, can you please try reordering library link order, e.g. from this:

target_link_libraries(...
    ${MAGNUM_LIBRARIES}
    ...
    ${MAGNUM_TEXTURETOOLS_LIBRARIES})

to this (linking Magnum library after TextureTools library):

target_link_libraries(...
    ...
    ${MAGNUM_TEXTURETOOLS_LIBRARIES}
    ${MAGNUM_LIBRARIES})

Um, sorry, just found out that the magnum-examples repository has various similar issues when using static build. I'll hopefully manage to fix this in the CMake scripts themselves to make the linking more robust. In the meantime, reordering linked libraries should help. As far as I can tell, the magnum-distancefieldconverter and magnum-fontconverter utilities (-DWITH_DISTANCEFIELDCONVERTER, -DWITH_FONTCONVERTER) are linking fine on static build.

Owner

mosra commented Jan 4, 2015

Oh, so if I understand correctly, Magnum compiles and installs without issue and the linker error happens when linking some application executable later?

If that's the case, can you please try reordering library link order, e.g. from this:

target_link_libraries(...
    ${MAGNUM_LIBRARIES}
    ...
    ${MAGNUM_TEXTURETOOLS_LIBRARIES})

to this (linking Magnum library after TextureTools library):

target_link_libraries(...
    ...
    ${MAGNUM_TEXTURETOOLS_LIBRARIES}
    ${MAGNUM_LIBRARIES})

Um, sorry, just found out that the magnum-examples repository has various similar issues when using static build. I'll hopefully manage to fix this in the CMake scripts themselves to make the linking more robust. In the meantime, reordering linked libraries should help. As far as I can tell, the magnum-distancefieldconverter and magnum-fontconverter utilities (-DWITH_DISTANCEFIELDCONVERTER, -DWITH_FONTCONVERTER) are linking fine on static build.

@mosra mosra added the buildsystem label Jan 4, 2015

@wivlaro

This comment has been minimized.

Show comment
Hide comment
@wivlaro

wivlaro Jan 6, 2015

Contributor

Ok. I've tried shuffling these around and I'm kind of stuck in a loop with TextureTools, Text and the core library. So I'm going back to commenting the atlas line out for now.

Here are some variations, each followed by the linker errors I get with it:

${MAGNUM_LIBRARIES}
${MAGNUM_TEXTURETOOLS_LIBRARIES}
${MAGNUM_TEXT_LIBRARIES}
/usr/local/lib/libMagnumText-d.a(GlyphCache.cpp.o): In function `Magnum::Text::GlyphCache::reserve(std::vector<Magnum::Math::Vector2<int>, std::allocator<Magnum::Math::Vector2<int> > > const&)':
/home/bill/programming/magnum/src/Magnum/Text/GlyphCache.cpp:80: undefined reference to `Magnum::TextureTools::atlas(Magnum::Math::Vector2<int> const&, std::vector<Magnum::Math::Vector2<int>, std::allocator<Magnum::Math::Vector2<int> > > const&, Magnum::Math::Vector2<int> const&)'
collect2: error: ld returned 1 exit status
${MAGNUM_TEXT_LIBRARIES}
${MAGNUM_TEXTURETOOLS_LIBRARIES}
${MAGNUM_SHADERS_LIBRARIES}
/usr/local/lib/libMagnumTextureTools-d.a(Atlas.cpp.o): In function `Corrade::Utility::Debug Magnum::Math::operator<< <int>(Corrade::Utility::Debug, Magnum::Math::Vector2<int> const&)':
/home/bill/programming/magnum/src/Magnum/Math/Vector2.h:169: undefined reference to `Corrade::Utility::Debug Magnum::Math::operator<< <2ul, int>(Corrade::Utility::Debug, Magnum::Math::Vector<2ul, int> const&)'
collect2: error: ld returned 1 exit status
${MAGNUM_TEXTURETOOLS_LIBRARIES}
${MAGNUM_LIBRARIES}
${MAGNUM_TEXT_LIBRARIES}
/usr/local/lib/libMagnumText-d.a(GlyphCache.cpp.o): In function `Magnum::Text::GlyphCache::reserve(std::vector<Magnum::Math::Vector2<int>, std::allocator<Magnum::Math::Vector2<int> > > const&)':
/home/bill/programming/magnum/src/Magnum/Text/GlyphCache.cpp:80: undefined reference to `Magnum::TextureTools::atlas(Magnum::Math::Vector2<int> const&, std::vector<Magnum::Math::Vector2<int>, std::allocator<Magnum::Math::Vector2<int> > > const&, Magnum::Math::Vector2<int> const&)'
collect2: error: ld returned 1 exit status
${MAGNUM_TEXT_LIBRARIES}
${MAGNUM_TEXTURETOOLS_LIBRARIES}
${MAGNUM_LIBRARIES}
/usr/local/lib/magnum/fonts/libFreeTypeFont-d.a(FreeTypeFont.cpp.o): In function `Magnum::Text::FreeTypeFont::FreeTypeFont()':
/home/bill/programming/magnum-plugins/src/MagnumPlugins/FreeTypeFont/FreeTypeFont.cpp:72: undefined reference to `Magnum::Text::AbstractFont::AbstractFont()'
/usr/local/lib/magnum/fonts/libFreeTypeFont-d.a(FreeTypeFont.cpp.o): In function `Magnum::Text::FreeTypeFont::FreeTypeFont(Corrade::PluginManager::AbstractManager&, std::string)':
/home/bill/programming/magnum-plugins/src/MagnumPlugins/FreeTypeFont/FreeTypeFont.cpp:74: undefined reference to `Magnum::Text::AbstractFont::AbstractFont(Corrade::PluginManager::AbstractManager&, std::string)'
/usr/local/lib/magnum/fonts/libFreeTypeFont-d.a(FreeTypeFont.cpp.o): In function `Magnum::Text::FreeTypeFont::~FreeTypeFont()':
/home/bill/programming/magnum-plugins/src/MagnumPlugins/FreeTypeFont/FreeTypeFont.cpp:76: undefined reference to `Magnum::Text::AbstractFont::close()'
/usr/local/lib/magnum/fonts/libFreeTypeFont-d.a(FreeTypeFont.cpp.o): In function `Magnum::Text::FreeTypeFont::doFillGlyphCache(Magnum::Text::GlyphCache&, std::basic_string<char32_t, std::char_traits<char32_t>, std::allocator<char32_t> > const&)':
/home/bill/programming/magnum-plugins/src/MagnumPlugins/FreeTypeFont/FreeTypeFont.cpp:136: undefined reference to `Magnum::Text::GlyphCache::reserve(std::vector<Magnum::Math::Vector2<int>, std::allocator<Magnum::Math::Vector2<int> > > const&)'
/home/bill/programming/magnum-plugins/src/MagnumPlugins/FreeTypeFont/FreeTypeFont.cpp:165: undefined reference to `Magnum::Text::GlyphCache::insert(unsigned int, Magnum::Math::Vector2<int> const&, Magnum::Math::Range2D<int> const&)'
/usr/local/lib/magnum/fonts/libFreeTypeFont-d.a(FreeTypeFont.cpp.o): In function `FreeTypeLayouter':
/home/bill/programming/magnum-plugins/src/MagnumPlugins/FreeTypeFont/FreeTypeFont.cpp:187: undefined reference to `Magnum::Text::AbstractLayouter::AbstractLayouter(unsigned int)'
/usr/local/lib/magnum/fonts/libFreeTypeFont-d.a(FreeTypeFont.cpp.o): In function `Magnum::Text::AbstractFont::~AbstractFont()':
/usr/local/include/Magnum/Text/AbstractFont.h:77: undefined reference to `vtable for Magnum::Text::AbstractFont'
/usr/local/lib/magnum/fonts/libFreeTypeFont-d.a(FreeTypeFont.cpp.o):(.rodata._ZTVN6Magnum4Text12FreeTypeFontE[_ZTVN6Magnum4Text12FreeTypeFontE]+0x38): undefined reference to `Magnum::Text::AbstractFont::doOpenData(std::vector<std::pair<std::string, Corrade::Containers::ArrayReference<unsigned char const> >, std::allocator<std::pair<std::string, Corrade::Containers::ArrayReference<unsigned char const> > > > const&, float)'
/usr/local/lib/magnum/fonts/libFreeTypeFont-d.a(FreeTypeFont.cpp.o):(.rodata._ZTVN6Magnum4Text12FreeTypeFontE[_ZTVN6Magnum4Text12FreeTypeFontE]+0x48): undefined reference to `Magnum::Text::AbstractFont::doOpenFile(std::string const&, float)'
/usr/local/lib/magnum/fonts/libFreeTypeFont-d.a(FreeTypeFont.cpp.o):(.rodata._ZTVN6Magnum4Text12FreeTypeFontE[_ZTVN6Magnum4Text12FreeTypeFontE]+0x70): undefined reference to `Magnum::Text::AbstractFont::doCreateGlyphCache()'
/usr/local/lib/magnum/fonts/libFreeTypeFont-d.a(FreeTypeFont.cpp.o):(.rodata._ZTIN6Magnum4Text12FreeTypeFontE[_ZTIN6Magnum4Text12FreeTypeFontE]+0x10): undefined reference to `typeinfo for Magnum::Text::AbstractFont'
collect2: error: ld returned 1 exit status
${MAGNUM_TEXTURETOOLS_LIBRARIES}
${MAGNUM_TEXT_LIBRARIES}
${MAGNUM_LIBRARIES}
/usr/local/lib/magnum/fonts/libFreeTypeFont-d.a(FreeTypeFont.cpp.o): In function `Magnum::Text::FreeTypeFont::FreeTypeFont()':
/home/bill/programming/magnum-plugins/src/MagnumPlugins/FreeTypeFont/FreeTypeFont.cpp:72: undefined reference to `Magnum::Text::AbstractFont::AbstractFont()'
/usr/local/lib/magnum/fonts/libFreeTypeFont-d.a(FreeTypeFont.cpp.o): In function `Magnum::Text::FreeTypeFont::FreeTypeFont(Corrade::PluginManager::AbstractManager&, std::string)':
/home/bill/programming/magnum-plugins/src/MagnumPlugins/FreeTypeFont/FreeTypeFont.cpp:74: undefined reference to `Magnum::Text::AbstractFont::AbstractFont(Corrade::PluginManager::AbstractManager&, std::string)'
/usr/local/lib/magnum/fonts/libFreeTypeFont-d.a(FreeTypeFont.cpp.o): In function `Magnum::Text::FreeTypeFont::~FreeTypeFont()':
/home/bill/programming/magnum-plugins/src/MagnumPlugins/FreeTypeFont/FreeTypeFont.cpp:76: undefined reference to `Magnum::Text::AbstractFont::close()'
/usr/local/lib/magnum/fonts/libFreeTypeFont-d.a(FreeTypeFont.cpp.o): In function `Magnum::Text::FreeTypeFont::doFillGlyphCache(Magnum::Text::GlyphCache&, std::basic_string<char32_t, std::char_traits<char32_t>, std::allocator<char32_t> > const&)':
/home/bill/programming/magnum-plugins/src/MagnumPlugins/FreeTypeFont/FreeTypeFont.cpp:136: undefined reference to `Magnum::Text::GlyphCache::reserve(std::vector<Magnum::Math::Vector2<int>, std::allocator<Magnum::Math::Vector2<int> > > const&)'
/home/bill/programming/magnum-plugins/src/MagnumPlugins/FreeTypeFont/FreeTypeFont.cpp:165: undefined reference to `Magnum::Text::GlyphCache::insert(unsigned int, Magnum::Math::Vector2<int> const&, Magnum::Math::Range2D<int> const&)'
/usr/local/lib/magnum/fonts/libFreeTypeFont-d.a(FreeTypeFont.cpp.o): In function `FreeTypeLayouter':
/home/bill/programming/magnum-plugins/src/MagnumPlugins/FreeTypeFont/FreeTypeFont.cpp:187: undefined reference to `Magnum::Text::AbstractLayouter::AbstractLayouter(unsigned int)'
/usr/local/lib/magnum/fonts/libFreeTypeFont-d.a(FreeTypeFont.cpp.o): In function `Magnum::Text::AbstractFont::~AbstractFont()':
/usr/local/include/Magnum/Text/AbstractFont.h:77: undefined reference to `vtable for Magnum::Text::AbstractFont'
/usr/local/lib/magnum/fonts/libFreeTypeFont-d.a(FreeTypeFont.cpp.o):(.rodata._ZTVN6Magnum4Text12FreeTypeFontE[_ZTVN6Magnum4Text12FreeTypeFontE]+0x38): undefined reference to `Magnum::Text::AbstractFont::doOpenData(std::vector<std::pair<std::string, Corrade::Containers::ArrayReference<unsigned char const> >, std::allocator<std::pair<std::string, Corrade::Containers::ArrayReference<unsigned char const> > > > const&, float)'
/usr/local/lib/magnum/fonts/libFreeTypeFont-d.a(FreeTypeFont.cpp.o):(.rodata._ZTVN6Magnum4Text12FreeTypeFontE[_ZTVN6Magnum4Text12FreeTypeFontE]+0x48): undefined reference to `Magnum::Text::AbstractFont::doOpenFile(std::string const&, float)'
/usr/local/lib/magnum/fonts/libFreeTypeFont-d.a(FreeTypeFont.cpp.o):(.rodata._ZTVN6Magnum4Text12FreeTypeFontE[_ZTVN6Magnum4Text12FreeTypeFontE]+0x70): undefined reference to `Magnum::Text::AbstractFont::doCreateGlyphCache()'
/usr/local/lib/magnum/fonts/libFreeTypeFont-d.a(FreeTypeFont.cpp.o):(.rodata._ZTIN6Magnum4Text12FreeTypeFontE[_ZTIN6Magnum4Text12FreeTypeFontE]+0x10): undefined reference to `typeinfo for Magnum::Text::AbstractFont'
collect2: error: ld returned 1 exit status
${MAGNUM_TEXT_LIBRARIES}
${MAGNUM_LIBRARIES}
${MAGNUM_TEXTURETOOLS_LIBRARIES}
/usr/local/lib/magnum/fonts/libFreeTypeFont-d.a(FreeTypeFont.cpp.o): In function `Magnum::Text::FreeTypeFont::FreeTypeFont()':
/home/bill/programming/magnum-plugins/src/MagnumPlugins/FreeTypeFont/FreeTypeFont.cpp:72: undefined reference to `Magnum::Text::AbstractFont::AbstractFont()'
/usr/local/lib/magnum/fonts/libFreeTypeFont-d.a(FreeTypeFont.cpp.o): In function `Magnum::Text::FreeTypeFont::FreeTypeFont(Corrade::PluginManager::AbstractManager&, std::string)':
/home/bill/programming/magnum-plugins/src/MagnumPlugins/FreeTypeFont/FreeTypeFont.cpp:74: undefined reference to `Magnum::Text::AbstractFont::AbstractFont(Corrade::PluginManager::AbstractManager&, std::string)'
/usr/local/lib/magnum/fonts/libFreeTypeFont-d.a(FreeTypeFont.cpp.o): In function `Magnum::Text::FreeTypeFont::~FreeTypeFont()':
/home/bill/programming/magnum-plugins/src/MagnumPlugins/FreeTypeFont/FreeTypeFont.cpp:76: undefined reference to `Magnum::Text::AbstractFont::close()'
/usr/local/lib/magnum/fonts/libFreeTypeFont-d.a(FreeTypeFont.cpp.o): In function `Magnum::Text::FreeTypeFont::doFillGlyphCache(Magnum::Text::GlyphCache&, std::basic_string<char32_t, std::char_traits<char32_t>, std::allocator<char32_t> > const&)':
/home/bill/programming/magnum-plugins/src/MagnumPlugins/FreeTypeFont/FreeTypeFont.cpp:136: undefined reference to `Magnum::Text::GlyphCache::reserve(std::vector<Magnum::Math::Vector2<int>, std::allocator<Magnum::Math::Vector2<int> > > const&)'
/home/bill/programming/magnum-plugins/src/MagnumPlugins/FreeTypeFont/FreeTypeFont.cpp:165: undefined reference to `Magnum::Text::GlyphCache::insert(unsigned int, Magnum::Math::Vector2<int> const&, Magnum::Math::Range2D<int> const&)'
/usr/local/lib/magnum/fonts/libFreeTypeFont-d.a(FreeTypeFont.cpp.o): In function `FreeTypeLayouter':
/home/bill/programming/magnum-plugins/src/MagnumPlugins/FreeTypeFont/FreeTypeFont.cpp:187: undefined reference to `Magnum::Text::AbstractLayouter::AbstractLayouter(unsigned int)'
/usr/local/lib/magnum/fonts/libFreeTypeFont-d.a(FreeTypeFont.cpp.o): In function `Magnum::Text::AbstractFont::~AbstractFont()':
/usr/local/include/Magnum/Text/AbstractFont.h:77: undefined reference to `vtable for Magnum::Text::AbstractFont'
/usr/local/lib/magnum/fonts/libFreeTypeFont-d.a(FreeTypeFont.cpp.o):(.rodata._ZTVN6Magnum4Text12FreeTypeFontE[_ZTVN6Magnum4Text12FreeTypeFontE]+0x38): undefined reference to `Magnum::Text::AbstractFont::doOpenData(std::vector<std::pair<std::string, Corrade::Containers::ArrayReference<unsigned char const> >, std::allocator<std::pair<std::string, Corrade::Containers::ArrayReference<unsigned char const> > > > const&, float)'
/usr/local/lib/magnum/fonts/libFreeTypeFont-d.a(FreeTypeFont.cpp.o):(.rodata._ZTVN6Magnum4Text12FreeTypeFontE[_ZTVN6Magnum4Text12FreeTypeFontE]+0x48): undefined reference to `Magnum::Text::AbstractFont::doOpenFile(std::string const&, float)'
/usr/local/lib/magnum/fonts/libFreeTypeFont-d.a(FreeTypeFont.cpp.o):(.rodata._ZTVN6Magnum4Text12FreeTypeFontE[_ZTVN6Magnum4Text12FreeTypeFontE]+0x70): undefined reference to `Magnum::Text::AbstractFont::doCreateGlyphCache()'
/usr/local/lib/magnum/fonts/libFreeTypeFont-d.a(FreeTypeFont.cpp.o):(.rodata._ZTIN6Magnum4Text12FreeTypeFontE[_ZTIN6Magnum4Text12FreeTypeFontE]+0x10): undefined reference to `typeinfo for Magnum::Text::AbstractFont'
collect2: error: ld returned 1 exit status
Contributor

wivlaro commented Jan 6, 2015

Ok. I've tried shuffling these around and I'm kind of stuck in a loop with TextureTools, Text and the core library. So I'm going back to commenting the atlas line out for now.

Here are some variations, each followed by the linker errors I get with it:

${MAGNUM_LIBRARIES}
${MAGNUM_TEXTURETOOLS_LIBRARIES}
${MAGNUM_TEXT_LIBRARIES}
/usr/local/lib/libMagnumText-d.a(GlyphCache.cpp.o): In function `Magnum::Text::GlyphCache::reserve(std::vector<Magnum::Math::Vector2<int>, std::allocator<Magnum::Math::Vector2<int> > > const&)':
/home/bill/programming/magnum/src/Magnum/Text/GlyphCache.cpp:80: undefined reference to `Magnum::TextureTools::atlas(Magnum::Math::Vector2<int> const&, std::vector<Magnum::Math::Vector2<int>, std::allocator<Magnum::Math::Vector2<int> > > const&, Magnum::Math::Vector2<int> const&)'
collect2: error: ld returned 1 exit status
${MAGNUM_TEXT_LIBRARIES}
${MAGNUM_TEXTURETOOLS_LIBRARIES}
${MAGNUM_SHADERS_LIBRARIES}
/usr/local/lib/libMagnumTextureTools-d.a(Atlas.cpp.o): In function `Corrade::Utility::Debug Magnum::Math::operator<< <int>(Corrade::Utility::Debug, Magnum::Math::Vector2<int> const&)':
/home/bill/programming/magnum/src/Magnum/Math/Vector2.h:169: undefined reference to `Corrade::Utility::Debug Magnum::Math::operator<< <2ul, int>(Corrade::Utility::Debug, Magnum::Math::Vector<2ul, int> const&)'
collect2: error: ld returned 1 exit status
${MAGNUM_TEXTURETOOLS_LIBRARIES}
${MAGNUM_LIBRARIES}
${MAGNUM_TEXT_LIBRARIES}
/usr/local/lib/libMagnumText-d.a(GlyphCache.cpp.o): In function `Magnum::Text::GlyphCache::reserve(std::vector<Magnum::Math::Vector2<int>, std::allocator<Magnum::Math::Vector2<int> > > const&)':
/home/bill/programming/magnum/src/Magnum/Text/GlyphCache.cpp:80: undefined reference to `Magnum::TextureTools::atlas(Magnum::Math::Vector2<int> const&, std::vector<Magnum::Math::Vector2<int>, std::allocator<Magnum::Math::Vector2<int> > > const&, Magnum::Math::Vector2<int> const&)'
collect2: error: ld returned 1 exit status
${MAGNUM_TEXT_LIBRARIES}
${MAGNUM_TEXTURETOOLS_LIBRARIES}
${MAGNUM_LIBRARIES}
/usr/local/lib/magnum/fonts/libFreeTypeFont-d.a(FreeTypeFont.cpp.o): In function `Magnum::Text::FreeTypeFont::FreeTypeFont()':
/home/bill/programming/magnum-plugins/src/MagnumPlugins/FreeTypeFont/FreeTypeFont.cpp:72: undefined reference to `Magnum::Text::AbstractFont::AbstractFont()'
/usr/local/lib/magnum/fonts/libFreeTypeFont-d.a(FreeTypeFont.cpp.o): In function `Magnum::Text::FreeTypeFont::FreeTypeFont(Corrade::PluginManager::AbstractManager&, std::string)':
/home/bill/programming/magnum-plugins/src/MagnumPlugins/FreeTypeFont/FreeTypeFont.cpp:74: undefined reference to `Magnum::Text::AbstractFont::AbstractFont(Corrade::PluginManager::AbstractManager&, std::string)'
/usr/local/lib/magnum/fonts/libFreeTypeFont-d.a(FreeTypeFont.cpp.o): In function `Magnum::Text::FreeTypeFont::~FreeTypeFont()':
/home/bill/programming/magnum-plugins/src/MagnumPlugins/FreeTypeFont/FreeTypeFont.cpp:76: undefined reference to `Magnum::Text::AbstractFont::close()'
/usr/local/lib/magnum/fonts/libFreeTypeFont-d.a(FreeTypeFont.cpp.o): In function `Magnum::Text::FreeTypeFont::doFillGlyphCache(Magnum::Text::GlyphCache&, std::basic_string<char32_t, std::char_traits<char32_t>, std::allocator<char32_t> > const&)':
/home/bill/programming/magnum-plugins/src/MagnumPlugins/FreeTypeFont/FreeTypeFont.cpp:136: undefined reference to `Magnum::Text::GlyphCache::reserve(std::vector<Magnum::Math::Vector2<int>, std::allocator<Magnum::Math::Vector2<int> > > const&)'
/home/bill/programming/magnum-plugins/src/MagnumPlugins/FreeTypeFont/FreeTypeFont.cpp:165: undefined reference to `Magnum::Text::GlyphCache::insert(unsigned int, Magnum::Math::Vector2<int> const&, Magnum::Math::Range2D<int> const&)'
/usr/local/lib/magnum/fonts/libFreeTypeFont-d.a(FreeTypeFont.cpp.o): In function `FreeTypeLayouter':
/home/bill/programming/magnum-plugins/src/MagnumPlugins/FreeTypeFont/FreeTypeFont.cpp:187: undefined reference to `Magnum::Text::AbstractLayouter::AbstractLayouter(unsigned int)'
/usr/local/lib/magnum/fonts/libFreeTypeFont-d.a(FreeTypeFont.cpp.o): In function `Magnum::Text::AbstractFont::~AbstractFont()':
/usr/local/include/Magnum/Text/AbstractFont.h:77: undefined reference to `vtable for Magnum::Text::AbstractFont'
/usr/local/lib/magnum/fonts/libFreeTypeFont-d.a(FreeTypeFont.cpp.o):(.rodata._ZTVN6Magnum4Text12FreeTypeFontE[_ZTVN6Magnum4Text12FreeTypeFontE]+0x38): undefined reference to `Magnum::Text::AbstractFont::doOpenData(std::vector<std::pair<std::string, Corrade::Containers::ArrayReference<unsigned char const> >, std::allocator<std::pair<std::string, Corrade::Containers::ArrayReference<unsigned char const> > > > const&, float)'
/usr/local/lib/magnum/fonts/libFreeTypeFont-d.a(FreeTypeFont.cpp.o):(.rodata._ZTVN6Magnum4Text12FreeTypeFontE[_ZTVN6Magnum4Text12FreeTypeFontE]+0x48): undefined reference to `Magnum::Text::AbstractFont::doOpenFile(std::string const&, float)'
/usr/local/lib/magnum/fonts/libFreeTypeFont-d.a(FreeTypeFont.cpp.o):(.rodata._ZTVN6Magnum4Text12FreeTypeFontE[_ZTVN6Magnum4Text12FreeTypeFontE]+0x70): undefined reference to `Magnum::Text::AbstractFont::doCreateGlyphCache()'
/usr/local/lib/magnum/fonts/libFreeTypeFont-d.a(FreeTypeFont.cpp.o):(.rodata._ZTIN6Magnum4Text12FreeTypeFontE[_ZTIN6Magnum4Text12FreeTypeFontE]+0x10): undefined reference to `typeinfo for Magnum::Text::AbstractFont'
collect2: error: ld returned 1 exit status
${MAGNUM_TEXTURETOOLS_LIBRARIES}
${MAGNUM_TEXT_LIBRARIES}
${MAGNUM_LIBRARIES}
/usr/local/lib/magnum/fonts/libFreeTypeFont-d.a(FreeTypeFont.cpp.o): In function `Magnum::Text::FreeTypeFont::FreeTypeFont()':
/home/bill/programming/magnum-plugins/src/MagnumPlugins/FreeTypeFont/FreeTypeFont.cpp:72: undefined reference to `Magnum::Text::AbstractFont::AbstractFont()'
/usr/local/lib/magnum/fonts/libFreeTypeFont-d.a(FreeTypeFont.cpp.o): In function `Magnum::Text::FreeTypeFont::FreeTypeFont(Corrade::PluginManager::AbstractManager&, std::string)':
/home/bill/programming/magnum-plugins/src/MagnumPlugins/FreeTypeFont/FreeTypeFont.cpp:74: undefined reference to `Magnum::Text::AbstractFont::AbstractFont(Corrade::PluginManager::AbstractManager&, std::string)'
/usr/local/lib/magnum/fonts/libFreeTypeFont-d.a(FreeTypeFont.cpp.o): In function `Magnum::Text::FreeTypeFont::~FreeTypeFont()':
/home/bill/programming/magnum-plugins/src/MagnumPlugins/FreeTypeFont/FreeTypeFont.cpp:76: undefined reference to `Magnum::Text::AbstractFont::close()'
/usr/local/lib/magnum/fonts/libFreeTypeFont-d.a(FreeTypeFont.cpp.o): In function `Magnum::Text::FreeTypeFont::doFillGlyphCache(Magnum::Text::GlyphCache&, std::basic_string<char32_t, std::char_traits<char32_t>, std::allocator<char32_t> > const&)':
/home/bill/programming/magnum-plugins/src/MagnumPlugins/FreeTypeFont/FreeTypeFont.cpp:136: undefined reference to `Magnum::Text::GlyphCache::reserve(std::vector<Magnum::Math::Vector2<int>, std::allocator<Magnum::Math::Vector2<int> > > const&)'
/home/bill/programming/magnum-plugins/src/MagnumPlugins/FreeTypeFont/FreeTypeFont.cpp:165: undefined reference to `Magnum::Text::GlyphCache::insert(unsigned int, Magnum::Math::Vector2<int> const&, Magnum::Math::Range2D<int> const&)'
/usr/local/lib/magnum/fonts/libFreeTypeFont-d.a(FreeTypeFont.cpp.o): In function `FreeTypeLayouter':
/home/bill/programming/magnum-plugins/src/MagnumPlugins/FreeTypeFont/FreeTypeFont.cpp:187: undefined reference to `Magnum::Text::AbstractLayouter::AbstractLayouter(unsigned int)'
/usr/local/lib/magnum/fonts/libFreeTypeFont-d.a(FreeTypeFont.cpp.o): In function `Magnum::Text::AbstractFont::~AbstractFont()':
/usr/local/include/Magnum/Text/AbstractFont.h:77: undefined reference to `vtable for Magnum::Text::AbstractFont'
/usr/local/lib/magnum/fonts/libFreeTypeFont-d.a(FreeTypeFont.cpp.o):(.rodata._ZTVN6Magnum4Text12FreeTypeFontE[_ZTVN6Magnum4Text12FreeTypeFontE]+0x38): undefined reference to `Magnum::Text::AbstractFont::doOpenData(std::vector<std::pair<std::string, Corrade::Containers::ArrayReference<unsigned char const> >, std::allocator<std::pair<std::string, Corrade::Containers::ArrayReference<unsigned char const> > > > const&, float)'
/usr/local/lib/magnum/fonts/libFreeTypeFont-d.a(FreeTypeFont.cpp.o):(.rodata._ZTVN6Magnum4Text12FreeTypeFontE[_ZTVN6Magnum4Text12FreeTypeFontE]+0x48): undefined reference to `Magnum::Text::AbstractFont::doOpenFile(std::string const&, float)'
/usr/local/lib/magnum/fonts/libFreeTypeFont-d.a(FreeTypeFont.cpp.o):(.rodata._ZTVN6Magnum4Text12FreeTypeFontE[_ZTVN6Magnum4Text12FreeTypeFontE]+0x70): undefined reference to `Magnum::Text::AbstractFont::doCreateGlyphCache()'
/usr/local/lib/magnum/fonts/libFreeTypeFont-d.a(FreeTypeFont.cpp.o):(.rodata._ZTIN6Magnum4Text12FreeTypeFontE[_ZTIN6Magnum4Text12FreeTypeFontE]+0x10): undefined reference to `typeinfo for Magnum::Text::AbstractFont'
collect2: error: ld returned 1 exit status
${MAGNUM_TEXT_LIBRARIES}
${MAGNUM_LIBRARIES}
${MAGNUM_TEXTURETOOLS_LIBRARIES}
/usr/local/lib/magnum/fonts/libFreeTypeFont-d.a(FreeTypeFont.cpp.o): In function `Magnum::Text::FreeTypeFont::FreeTypeFont()':
/home/bill/programming/magnum-plugins/src/MagnumPlugins/FreeTypeFont/FreeTypeFont.cpp:72: undefined reference to `Magnum::Text::AbstractFont::AbstractFont()'
/usr/local/lib/magnum/fonts/libFreeTypeFont-d.a(FreeTypeFont.cpp.o): In function `Magnum::Text::FreeTypeFont::FreeTypeFont(Corrade::PluginManager::AbstractManager&, std::string)':
/home/bill/programming/magnum-plugins/src/MagnumPlugins/FreeTypeFont/FreeTypeFont.cpp:74: undefined reference to `Magnum::Text::AbstractFont::AbstractFont(Corrade::PluginManager::AbstractManager&, std::string)'
/usr/local/lib/magnum/fonts/libFreeTypeFont-d.a(FreeTypeFont.cpp.o): In function `Magnum::Text::FreeTypeFont::~FreeTypeFont()':
/home/bill/programming/magnum-plugins/src/MagnumPlugins/FreeTypeFont/FreeTypeFont.cpp:76: undefined reference to `Magnum::Text::AbstractFont::close()'
/usr/local/lib/magnum/fonts/libFreeTypeFont-d.a(FreeTypeFont.cpp.o): In function `Magnum::Text::FreeTypeFont::doFillGlyphCache(Magnum::Text::GlyphCache&, std::basic_string<char32_t, std::char_traits<char32_t>, std::allocator<char32_t> > const&)':
/home/bill/programming/magnum-plugins/src/MagnumPlugins/FreeTypeFont/FreeTypeFont.cpp:136: undefined reference to `Magnum::Text::GlyphCache::reserve(std::vector<Magnum::Math::Vector2<int>, std::allocator<Magnum::Math::Vector2<int> > > const&)'
/home/bill/programming/magnum-plugins/src/MagnumPlugins/FreeTypeFont/FreeTypeFont.cpp:165: undefined reference to `Magnum::Text::GlyphCache::insert(unsigned int, Magnum::Math::Vector2<int> const&, Magnum::Math::Range2D<int> const&)'
/usr/local/lib/magnum/fonts/libFreeTypeFont-d.a(FreeTypeFont.cpp.o): In function `FreeTypeLayouter':
/home/bill/programming/magnum-plugins/src/MagnumPlugins/FreeTypeFont/FreeTypeFont.cpp:187: undefined reference to `Magnum::Text::AbstractLayouter::AbstractLayouter(unsigned int)'
/usr/local/lib/magnum/fonts/libFreeTypeFont-d.a(FreeTypeFont.cpp.o): In function `Magnum::Text::AbstractFont::~AbstractFont()':
/usr/local/include/Magnum/Text/AbstractFont.h:77: undefined reference to `vtable for Magnum::Text::AbstractFont'
/usr/local/lib/magnum/fonts/libFreeTypeFont-d.a(FreeTypeFont.cpp.o):(.rodata._ZTVN6Magnum4Text12FreeTypeFontE[_ZTVN6Magnum4Text12FreeTypeFontE]+0x38): undefined reference to `Magnum::Text::AbstractFont::doOpenData(std::vector<std::pair<std::string, Corrade::Containers::ArrayReference<unsigned char const> >, std::allocator<std::pair<std::string, Corrade::Containers::ArrayReference<unsigned char const> > > > const&, float)'
/usr/local/lib/magnum/fonts/libFreeTypeFont-d.a(FreeTypeFont.cpp.o):(.rodata._ZTVN6Magnum4Text12FreeTypeFontE[_ZTVN6Magnum4Text12FreeTypeFontE]+0x48): undefined reference to `Magnum::Text::AbstractFont::doOpenFile(std::string const&, float)'
/usr/local/lib/magnum/fonts/libFreeTypeFont-d.a(FreeTypeFont.cpp.o):(.rodata._ZTVN6Magnum4Text12FreeTypeFontE[_ZTVN6Magnum4Text12FreeTypeFontE]+0x70): undefined reference to `Magnum::Text::AbstractFont::doCreateGlyphCache()'
/usr/local/lib/magnum/fonts/libFreeTypeFont-d.a(FreeTypeFont.cpp.o):(.rodata._ZTIN6Magnum4Text12FreeTypeFontE[_ZTIN6Magnum4Text12FreeTypeFontE]+0x10): undefined reference to `typeinfo for Magnum::Text::AbstractFont'
collect2: error: ld returned 1 exit status
@mosra

This comment has been minimized.

Show comment
Hide comment
@mosra

mosra Jan 7, 2015

Owner

Finally got some time to look into this, hopefully it should be fixed now. Please try the updated FindMagnum.cmake from 60f7ac5 and FindMagnumPlugins.cmake from mosra/magnum-plugins@5574ed4. See the commit messages for details, in short you should now be able to specify only the leaf components and libraries and the inter-project dependencies should be automatically included too. So, for linking to the text library and everything it depends on the following should be enough:

find_package(Magnum REQUIRED Text)

# ...

target_link_libraries(myapp ${MAGNUM_TEXT_LIBRARIES})

Similarly when linking FreeTypeFont plugin:

find_package(MagnumPlugins REQUIRED FreeTypeFont)

# ...

target_link_libraries(myapp ${MAGNUMPLUGINS_FREETYPEFONT_LIBRARIES})

The ${MAGNUM*_LIBRARIES} should now contain everything needed and no longer rely on some random obscure ordering and knowledge about inter-project dependencies. If you find any error with the updated files, please tell me. If that finally works out, I'll update all the copies of the Find*.cmake modules and close this.

Oh, and if everything else fails, it's also possible to specify linked libraries more than once. Sometimes it's necessary evil, especially when doing static linking and the last linker error just doesn't want to go away:

target_link_libraries(myapp ${MAGNUM_TEXT_LIBRARIES} ${MAGNUM_TEXT_LIBRARIES}) # ugh
Owner

mosra commented Jan 7, 2015

Finally got some time to look into this, hopefully it should be fixed now. Please try the updated FindMagnum.cmake from 60f7ac5 and FindMagnumPlugins.cmake from mosra/magnum-plugins@5574ed4. See the commit messages for details, in short you should now be able to specify only the leaf components and libraries and the inter-project dependencies should be automatically included too. So, for linking to the text library and everything it depends on the following should be enough:

find_package(Magnum REQUIRED Text)

# ...

target_link_libraries(myapp ${MAGNUM_TEXT_LIBRARIES})

Similarly when linking FreeTypeFont plugin:

find_package(MagnumPlugins REQUIRED FreeTypeFont)

# ...

target_link_libraries(myapp ${MAGNUMPLUGINS_FREETYPEFONT_LIBRARIES})

The ${MAGNUM*_LIBRARIES} should now contain everything needed and no longer rely on some random obscure ordering and knowledge about inter-project dependencies. If you find any error with the updated files, please tell me. If that finally works out, I'll update all the copies of the Find*.cmake modules and close this.

Oh, and if everything else fails, it's also possible to specify linked libraries more than once. Sometimes it's necessary evil, especially when doing static linking and the last linker error just doesn't want to go away:

target_link_libraries(myapp ${MAGNUM_TEXT_LIBRARIES} ${MAGNUM_TEXT_LIBRARIES}) # ugh
@wivlaro

This comment has been minimized.

Show comment
Hide comment
@wivlaro

wivlaro Jan 7, 2015

Contributor

Great, thanks. Linking now works.

I started getting warnings with all these static libraries being added as include directories:

/usr/lib/ccache/c++   -D_NEWTON_STATIC_LIB -g -std=c++11 -W -Wall -Wuninitialized -ftemplate-backtrace-limit=30 -msse -msse2 -ffast-math -ftree-vectorize -Wall -Wextra -Wold-style-cast -Winit-self -Werror=return-type -Wmissing-declarations -pedantic -fvisibility=hidden -Wzero-as-null-pointer-constant -Wdouble-promotion -Wno-old-style-cast -Wno-unused-parameter -g -fstack-protector-all -DDEBUG -I/home/bill/programming/adust-magnum/build/src -I/usr/local/include -I/usr/local/include/MagnumExternal/OpenGL -I/Corrade/Corrade -I/usr/local/include/Magnum -I/usr/local/include/MagnumExternal -I/usr/include/SDL2 -I/usr/lib/x86_64-linux-gnu/libfreetype.so -I/home/bill/programming/adust-magnum/debug -I/usr/local/lib/libMagnumText-d.a -I/home/bill/programming/adust-magnum/optimized -I/usr/local/lib/libMagnumText.a -I/usr/local/lib/libMagnumTextureTools-d.a -I/usr/local/lib/libMagnumTextureTools.a -I/usr/local/lib/libMagnum-d.a -I/usr/local/lib/libMagnum.a -I/usr/local/lib/libCorradeUtility-d.a -I/usr/local/lib/libCorradeUtility.a -I/usr/local/lib/libCorradePluginManager-d.a -I/usr/local/lib/libCorradePluginManager.a -I/home/bill/programming/adust-magnum/dl -I/usr/lib/x86_64-linux-gnu/libGL.so -I/home/bill/programming/adust-magnum/../newton-dynamics/coreLibrary_300/source/newton    -o CMakeFiles/adust-magnum.dir/src/client/TextureLoader.cpp.o -c /home/bill/programming/adust-magnum/src/client/TextureLoader.cpp
cc1plus: warning: /usr/lib/x86_64-linux-gnu/libfreetype.so: not a directory
cc1plus: warning: /usr/local/lib/libMagnumText-d.a: not a directory
cc1plus: warning: /usr/local/lib/libMagnumText.a: not a directory
cc1plus: warning: /usr/local/lib/libMagnumTextureTools-d.a: not a directory
cc1plus: warning: /usr/local/lib/libMagnumTextureTools.a: not a directory
cc1plus: warning: /usr/local/lib/libMagnum-d.a: not a directory
cc1plus: warning: /usr/local/lib/libMagnum.a: not a directory
cc1plus: warning: /usr/local/lib/libCorradeUtility-d.a: not a directory
cc1plus: warning: /usr/local/lib/libCorradeUtility.a: not a directory
cc1plus: warning: /usr/local/lib/libCorradePluginManager-d.a: not a directory
cc1plus: warning: /usr/local/lib/libCorradePluginManager.a: not a directory
cc1plus: warning: /usr/lib/x86_64-linux-gnu/libGL.so: not a directory

I couldn't work out where they were coming from, but removing these lines in my project's CMakeLists.txt got rid of them:

include_directories(${MAGNUMPLUGINS_COLLADAIMPORTER_DIRS})
include_directories(${MAGNUMPLUGINS_JPEGIMPORTER_DIRS})
include_directories(${MAGNUMPLUGINS_PNGIMPORTER_DIRS})
include_directories(${MAGNUMPLUGINS_FREETYPEFONT_INCLUDE_DIRS})

And everything still works.

Thanks for your efforts. :)

Contributor

wivlaro commented Jan 7, 2015

Great, thanks. Linking now works.

I started getting warnings with all these static libraries being added as include directories:

/usr/lib/ccache/c++   -D_NEWTON_STATIC_LIB -g -std=c++11 -W -Wall -Wuninitialized -ftemplate-backtrace-limit=30 -msse -msse2 -ffast-math -ftree-vectorize -Wall -Wextra -Wold-style-cast -Winit-self -Werror=return-type -Wmissing-declarations -pedantic -fvisibility=hidden -Wzero-as-null-pointer-constant -Wdouble-promotion -Wno-old-style-cast -Wno-unused-parameter -g -fstack-protector-all -DDEBUG -I/home/bill/programming/adust-magnum/build/src -I/usr/local/include -I/usr/local/include/MagnumExternal/OpenGL -I/Corrade/Corrade -I/usr/local/include/Magnum -I/usr/local/include/MagnumExternal -I/usr/include/SDL2 -I/usr/lib/x86_64-linux-gnu/libfreetype.so -I/home/bill/programming/adust-magnum/debug -I/usr/local/lib/libMagnumText-d.a -I/home/bill/programming/adust-magnum/optimized -I/usr/local/lib/libMagnumText.a -I/usr/local/lib/libMagnumTextureTools-d.a -I/usr/local/lib/libMagnumTextureTools.a -I/usr/local/lib/libMagnum-d.a -I/usr/local/lib/libMagnum.a -I/usr/local/lib/libCorradeUtility-d.a -I/usr/local/lib/libCorradeUtility.a -I/usr/local/lib/libCorradePluginManager-d.a -I/usr/local/lib/libCorradePluginManager.a -I/home/bill/programming/adust-magnum/dl -I/usr/lib/x86_64-linux-gnu/libGL.so -I/home/bill/programming/adust-magnum/../newton-dynamics/coreLibrary_300/source/newton    -o CMakeFiles/adust-magnum.dir/src/client/TextureLoader.cpp.o -c /home/bill/programming/adust-magnum/src/client/TextureLoader.cpp
cc1plus: warning: /usr/lib/x86_64-linux-gnu/libfreetype.so: not a directory
cc1plus: warning: /usr/local/lib/libMagnumText-d.a: not a directory
cc1plus: warning: /usr/local/lib/libMagnumText.a: not a directory
cc1plus: warning: /usr/local/lib/libMagnumTextureTools-d.a: not a directory
cc1plus: warning: /usr/local/lib/libMagnumTextureTools.a: not a directory
cc1plus: warning: /usr/local/lib/libMagnum-d.a: not a directory
cc1plus: warning: /usr/local/lib/libMagnum.a: not a directory
cc1plus: warning: /usr/local/lib/libCorradeUtility-d.a: not a directory
cc1plus: warning: /usr/local/lib/libCorradeUtility.a: not a directory
cc1plus: warning: /usr/local/lib/libCorradePluginManager-d.a: not a directory
cc1plus: warning: /usr/local/lib/libCorradePluginManager.a: not a directory
cc1plus: warning: /usr/lib/x86_64-linux-gnu/libGL.so: not a directory

I couldn't work out where they were coming from, but removing these lines in my project's CMakeLists.txt got rid of them:

include_directories(${MAGNUMPLUGINS_COLLADAIMPORTER_DIRS})
include_directories(${MAGNUMPLUGINS_JPEGIMPORTER_DIRS})
include_directories(${MAGNUMPLUGINS_PNGIMPORTER_DIRS})
include_directories(${MAGNUMPLUGINS_FREETYPEFONT_INCLUDE_DIRS})

And everything still works.

Thanks for your efforts. :)

@wivlaro wivlaro closed this Jan 7, 2015

@mosra

This comment has been minimized.

Show comment
Hide comment
@mosra

mosra Jan 7, 2015

Owner

Sorry, that was a copypaste error, should be fixed with mosra/magnum-plugins@b8551b8. Can you check that the warnings disappeared, just to be sure? Thanks.

The ${MAGNUMPLUGINS_*_INCLUDE_DIRS} are needed only when you are directly including the plugin header (e.g. #include "MagnumPlugins/ColladaImporter/ColladaImporter.h", as opposed to just loading and instantiating it through PluginManager). You would include the header when you are using the plugin as direct dependency when developing another plugin, but that's a very rare case.

Owner

mosra commented Jan 7, 2015

Sorry, that was a copypaste error, should be fixed with mosra/magnum-plugins@b8551b8. Can you check that the warnings disappeared, just to be sure? Thanks.

The ${MAGNUMPLUGINS_*_INCLUDE_DIRS} are needed only when you are directly including the plugin header (e.g. #include "MagnumPlugins/ColladaImporter/ColladaImporter.h", as opposed to just loading and instantiating it through PluginManager). You would include the header when you are using the plugin as direct dependency when developing another plugin, but that's a very rare case.

@mosra mosra added the bug label Jan 7, 2015

@mosra mosra added this to the 2015.05 milestone Feb 15, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment