elementary-dev-community team mailing list archive
-
elementary-dev-community team
-
Mailing list archive
-
Message #01156
Re: -lm and building the terminal
Thank you Xapantu, that fixed it!
On Fri, Sep 14, 2012 at 6:37 PM, xapantu <xapantu@xxxxxxxxx> wrote:
> Hey,
>
>
> On 14/09/2012 00:12, David Gomes wrote:
>
> target_link_libraries gives me:
>
> /usr/bin/ld: CMakeFiles/pantheon-terminal.dir/src/TerminalWidget.c.o:
> undefined reference to symbol 'floor@@GLIBC_2.2.5'
> /usr/bin/ld: note: 'floor@@GLIBC_2.2.5' is defined in DSO
> /usr/lib/libm.so.6 so try adding it to the linker command line
> /usr/lib/libm.so.6: could not read symbols: Invalid operation
> collect2: error: ld returned 1 exit status
>
> So I tried:
>
> find_library (M_LIB m)
> target_link_libraries (pantheon-terminal ${M_LIB})
> add_subdirectory (po)
>
> add_executable (pantheon-terminal ${VALA_C})
>
> You need to put the target_link_libraries under add_executable. With
> add_executable, you define a new target, you can't use it before it is
> defined.
>
> Lucas
>
>
> But I get:
>
> CMake Error at CMakeLists.txt:66 (target_link_libraries):
> Cannot specify link libraries for target "pantheon-terminal" which is not
> built by this project.
>
> Any ideas?
>
> On Thu, Sep 13, 2012 at 8:25 PM, xapantu <xapantu@xxxxxxxxx> wrote:
>
>> « l » is only here to tell gcc it is a lib, the lib name is actually «
>> m ».
>> Just remember that link_libraries is deprecated, please use
>> target_link_libraries :P (well, I don't think it will be removed from CMake
>> before a lot of time, but it is useless to keep writing code with it.)
>>
>> Lucas
>>
>>
>> On 13/09/2012 14:28, Darcy Brás da Silva wrote:
>>
>> Humm, if the fix was passing m, i guess cmake passes l prefix for us...
>> Nice!
>> On Thu, 2012-09-13 at 11:23 +0100, David Gomes wrote:
>>
>> Well Darcy, that email was @voldyman ;)
>>
>> Regarding the general issue, I found a way to fix it, thanks to
>> devidfil's Github link, I just added:
>>
>> link_libraries (m)
>>
>> Right before the add_subdirectory call and it's working for everybody
>> now.
>>
>> On Thu, Sep 13, 2012 at 11:16 AM, Darcy Brás da Silva<dardevelin@xxxxxxxxxxxxxx> <dardevelin@xxxxxxxxxxxxxx> wrote:
>> I'm not saying to implement it ourselves. I'm saying to make a
>> vapi to
>> have access of it from C <math.h> library in Vala, which is a
>> very
>> different thing :)
>> On Thu, 2012-09-13 at 09:50 +0100, David Gomes wrote:
>> > Implementing Math.floor and Math.ceil ourselves would work,
>> but I'm
>> > trying to avoid that for obvious reasons :)
>> >
>> > On Thu, Sep 13, 2012 at 4:22 AM, Voldyman
>> <voldyman666@xxxxxxxxx> <voldyman666@xxxxxxxxx>
>> > wrote:
>> > If we implement Math.floor function in pantheon
>> terminal
>> > source wouldn't that work?
>> >
>> >
>> > On 13-Sep-2012, at 3:29 AM, David Gomes
>> > <david@xxxxxxxxxxxxxxxx> <david@xxxxxxxxxxxxxxxx> wrote:
>> >
>> >
>> >
>> > > On the terminal we now need Math.floor and
>> Math.ceil for
>> > > zooming in and out using Ctrl-+ and Ctrl--.
>> > >
>> > > This brought along an issue when building the
>> termina:
>> > >
>> > > /usr/bin/ld:
>> > >
>> CMakeFiles/pantheon-terminal.dir/src/TerminalWidget.c.o:
>> > > undefined reference to symbol 'floor@@GLIBC_2.2.5'
>> > > /usr/bin/ld: note: 'floor@@GLIBC_2.2.5' is defined
>> in
>> > > DSO /usr/lib/libm.so.6 so try adding it to the
>> linker
>> > > command line
>> > > /usr/lib/libm.so.6: could not read symbols:
>> Invalid
>> > > operation
>> > > collect2: error: ld returned 1 exit status
>> > > make[2]: *** [pantheon-terminal] Error 1
>> > >
>> > > In order to fix this, Ricotz suggested using the
>> "-lm" flag
>> > > on the linker. I tried to do it and then it worked
>> just
>> > > fine. However, for Victored and Eshat on Ubuntu
>> (Luna), that
>> > > made it stop working.
>> > >
>> > > It seems that on Ubuntu the linker includes lm by
>> default,
>> > > and on Arch it doesn't, and reincluding it causes
>> troubles
>> > > on Ubuntu.
>> > >
>> > > On CMakeLists.txt I just added the following to
>> make it
>> > > compile:
>> > >
>> > > set (CMAKE_EXE_LINKER_FLAGS "-lm")
>> > >
>> > > Either way, I want Pantheon Terminal to compile
>> across all
>> > > GNU/Linux distributions, so I need a way to solve
>> this.
>> > >
>> > > === modified file 'CMakeLists.txt'
>> > > --- CMakeLists.txt 2012-07-26 20:23:31 +0000
>> > > +++ CMakeLists.txt 2012-09-12 19:18:34 +0000
>> > > @@ -30,6 +30,7 @@
>> > > find_package(PkgConfig)
>> > > pkg_check_modules(DEPS REQUIRED gthread-2.0 gtk
>> +-3.0
>> > > granite vte-2.90 libnotify gdk-3.0)
>> > >
>> > > +set (DEPS_LADD "${DEPS_LADD} -lm")
>> > > add_definitions(${DEPS_CFLAGS})
>> > >
>> > > link_libraries(${DEPS_LIBRARIES})
>> > >
>> > > Ricotz suggesting the avobe path to fix the issue.
>> I applied
>> > > that patch and my patched CMakeLists.txt is
>> attached.
>> > > However, with this patch I can't build it on Arch,
>> but
>> > > Victored managed to built it on Ubuntu. I get the
>> same good
>> > > old error:
>> > >
>> > > /usr/bin/ld:
>> > >
>> CMakeFiles/pantheon-terminal.dir/src/TerminalWidget.c.o:
>> > > undefined reference to symbol 'floor@@GLIBC_2.2.5'
>> > > /usr/bin/ld: note: 'floor@@GLIBC_2.2.5' is defined
>> in
>> > > DSO /usr/lib/libm.so.6 so try adding it to the
>> linker
>> > > command line
>> > > /usr/lib/libm.so.6: could not read symbols:
>> Invalid
>> > > operation
>> > > collect2: error: ld returned 1 exit status
>> > >
>> > > So I'd appreciate some help guys, since I'm fairly
>> new to
>> > > CMake. Oh, and this is the branch we're working
>> on:
>> > >
>> > >
>> https://code.launchpad.net/~elementary-dev-community/pantheon-terminal/zoom-in-out
>> > >
>> > > Thank you.
>> > >
>> > > <CMakeLists.txt>
>> > > --
>> > > Mailing list:
>> > > https://launchpad.net/~elementary-dev-community
>> > > Post to :
>> elementary-dev-community@xxxxxxxxxxxxxxxxxxx
>> > > Unsubscribe :
>> > > https://launchpad.net/~elementary-dev-community
>> > > More help : https://help.launchpad.net/ListHelp
>> > >
>> >
>>
>>
>> --
>> Darcy Brás da Silva <dardevelin@xxxxxxxxxxxxxx> <dardevelin@xxxxxxxxxxxxxx>
>>
>>
>>
>>
>>
>> --
>> Mailing list: https://launchpad.net/~elementary-dev-community
>> Post to : elementary-dev-community@xxxxxxxxxxxxxxxxxxx
>> Unsubscribe : https://launchpad.net/~elementary-dev-community
>> More help : https://help.launchpad.net/ListHelp
>>
>>
>
>
References