← Back to team overview

elementary-dev-community team mailing list archive

Re: -lm and building the terminal

 

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> 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

Follow ups

References