librelist archives

« back to archive

[PATCH] link with -lm

[PATCH] link with -lm

From:
Natanael Copa
Date:
2011-12-19 @ 20:49
The man page for isnan(3) says it should be linked with -lm

This fixes build failure when building on Alpine Linux (with uClibc)

Signed-off-by: Natanael Copa <ncopa@alpinelinux.org>
---
 example/CMakeLists.txt     |    2 +-
 reformatter/CMakeLists.txt |    2 +-
 src/CMakeLists.txt         |    1 +
 test/CMakeLists.txt        |    2 +-
 4 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/example/CMakeLists.txt b/example/CMakeLists.txt
index 29cee35..387366e 100644
--- a/example/CMakeLists.txt
+++ b/example/CMakeLists.txt
@@ -20,4 +20,4 @@ 
LINK_DIRECTORIES(${CMAKE_CURRENT_BINARY_DIR}/../${YAJL_DIST_NAME}/lib)
 
 ADD_EXECUTABLE(parse_config ${SRCS})
 
-TARGET_LINK_LIBRARIES(parse_config yajl_s)
+TARGET_LINK_LIBRARIES(parse_config yajl_s m)
diff --git a/reformatter/CMakeLists.txt b/reformatter/CMakeLists.txt
index da4032b..d48e218 100644
--- a/reformatter/CMakeLists.txt
+++ b/reformatter/CMakeLists.txt
@@ -26,7 +26,7 @@ 
LINK_DIRECTORIES(${CMAKE_CURRENT_BINARY_DIR}/../${YAJL_DIST_NAME}/lib)
 
 ADD_EXECUTABLE(json_reformat ${SRCS})
 
-TARGET_LINK_LIBRARIES(json_reformat yajl_s)
+TARGET_LINK_LIBRARIES(json_reformat yajl_s m)
 
 # copy the binary into the output directory
 GET_TARGET_PROPERTY(binPath json_reformat LOCATION)
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index e36b736..85083bf 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -38,6 +38,7 @@ SET(LIBRARY_OUTPUT_PATH ${libDir})
 ADD_LIBRARY(yajl_s STATIC ${SRCS} ${HDRS} ${PUB_HDRS})
 
 ADD_LIBRARY(yajl SHARED ${SRCS} ${HDRS} ${PUB_HDRS})
+TARGET_LINK_LIBRARIES(yajl m)
 
 #### setup shared library version number
 SET_TARGET_PROPERTIES(yajl PROPERTIES
diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt
index 153288c..c5fa974 100644
--- a/test/CMakeLists.txt
+++ b/test/CMakeLists.txt
@@ -20,4 +20,4 @@ 
LINK_DIRECTORIES(${CMAKE_CURRENT_BINARY_DIR}/../${YAJL_DIST_NAME}/lib)
 
 ADD_EXECUTABLE(yajl_test ${SRCS})
 
-TARGET_LINK_LIBRARIES(yajl_test yajl_s)
+TARGET_LINK_LIBRARIES(yajl_test yajl_s m)
-- 
1.7.8

Re: [yajl] [PATCH] link with -lm

From:
Brian Lopez
Date:
2011-12-19 @ 21:27
You guys might have better luck sending the project a pull request at 
https://github.com/lloyd/yajl.
And just in case: http://help.github.com/send-pull-requests/


On Monday, December 19, 2011 at 12:49 PM, Natanael Copa wrote:

> The man page for isnan(3) says it should be linked with -lm
> 
> This fixes build failure when building on Alpine Linux (with uClibc)
> 
> Signed-off-by: Natanael Copa <ncopa@alpinelinux.org 
(mailto:ncopa@alpinelinux.org)>
> ---
> example/CMakeLists.txt | 2 +-
> reformatter/CMakeLists.txt | 2 +-
> src/CMakeLists.txt | 1 +
> test/CMakeLists.txt | 2 +-
> 4 files changed, 4 insertions(+), 3 deletions(-)
> 
> diff --git a/example/CMakeLists.txt b/example/CMakeLists.txt
> index 29cee35..387366e 100644
> --- a/example/CMakeLists.txt
> +++ b/example/CMakeLists.txt
> @@ -20,4 +20,4 @@ 
LINK_DIRECTORIES(${CMAKE_CURRENT_BINARY_DIR}/../${YAJL_DIST_NAME}/lib)
> 
> ADD_EXECUTABLE(parse_config ${SRCS})
> 
> -TARGET_LINK_LIBRARIES(parse_config yajl_s)
> +TARGET_LINK_LIBRARIES(parse_config yajl_s m)
> diff --git a/reformatter/CMakeLists.txt b/reformatter/CMakeLists.txt
> index da4032b..d48e218 100644
> --- a/reformatter/CMakeLists.txt
> +++ b/reformatter/CMakeLists.txt
> @@ -26,7 +26,7 @@ 
LINK_DIRECTORIES(${CMAKE_CURRENT_BINARY_DIR}/../${YAJL_DIST_NAME}/lib)
> 
> ADD_EXECUTABLE(json_reformat ${SRCS})
> 
> -TARGET_LINK_LIBRARIES(json_reformat yajl_s)
> +TARGET_LINK_LIBRARIES(json_reformat yajl_s m)
> 
> # copy the binary into the output directory
> GET_TARGET_PROPERTY(binPath json_reformat LOCATION)
> diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
> index e36b736..85083bf 100644
> --- a/src/CMakeLists.txt
> +++ b/src/CMakeLists.txt
> @@ -38,6 +38,7 @@ SET(LIBRARY_OUTPUT_PATH ${libDir})
> ADD_LIBRARY(yajl_s STATIC ${SRCS} ${HDRS} ${PUB_HDRS})
> 
> ADD_LIBRARY(yajl SHARED ${SRCS} ${HDRS} ${PUB_HDRS})
> +TARGET_LINK_LIBRARIES(yajl m)
> 
> #### setup shared library version number
> SET_TARGET_PROPERTIES(yajl PROPERTIES
> diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt
> index 153288c..c5fa974 100644
> --- a/test/CMakeLists.txt
> +++ b/test/CMakeLists.txt
> @@ -20,4 +20,4 @@ 
LINK_DIRECTORIES(${CMAKE_CURRENT_BINARY_DIR}/../${YAJL_DIST_NAME}/lib)
> 
> ADD_EXECUTABLE(yajl_test ${SRCS})
> 
> -TARGET_LINK_LIBRARIES(yajl_test yajl_s)
> +TARGET_LINK_LIBRARIES(yajl_test yajl_s m)
> -- 
> 1.7.8
> 
> 

Re: [yajl] [PATCH] link with -lm

From:
Natanael Copa
Date:
2011-12-20 @ 08:14
On Mon, Dec 19, 2011 at 10:27 PM, Brian Lopez <seniorlopez@gmail.com> wrote:
> You guys might have better luck sending the project a pull request
> at https://github.com/lloyd/yajl.
> And just in case: http://help.github.com/send-pull-requests/

Pull requests for a single commit? I would have done a pull request if
I had various commits but for single commits 'git am' is the right
tool IMHO.

-nc

Re: [yajl] [PATCH] link with -lm

From:
Peter Korsgaard
Date:
2011-12-19 @ 21:15
>>>>> "Natanael" == Natanael Copa <natanael.copa@gmail.com> writes:

 Natanael> The man page for isnan(3) says it should be linked with -lm
 Natanael> This fixes build failure when building on Alpine Linux (with uClibc)

 Natanael> Signed-off-by: Natanael Copa <ncopa@alpinelinux.org>

Acked-by: Peter Korsgaard <jacmet@sunsite.dk>

We've been carrying a similar patch for 6 months or so in Buildroot:

http://git.buildroot.net/buildroot/tree/package/yajl/yajl-2.0.2-math-link.patch

I submitted it to this list as well, but so far no response.

-- 
Bye, Peter Korsgaard

Re: [yajl] [PATCH] link with -lm

From:
Natanael Copa
Date:
2011-12-20 @ 08:17
On Mon, Dec 19, 2011 at 10:15 PM, Peter Korsgaard <jacmet@sunsite.dk> wrote:
>>>>>> "Natanael" == Natanael Copa <natanael.copa@gmail.com> writes:
>
>  Natanael> The man page for isnan(3) says it should be linked with -lm
>  Natanael> This fixes build failure when building on Alpine Linux (with uClibc)
>
>  Natanael> Signed-off-by: Natanael Copa <ncopa@alpinelinux.org>
>
> Acked-by: Peter Korsgaard <jacmet@sunsite.dk>
>
> We've been carrying a similar patch for 6 months or so in Buildroot:
>
> http://git.buildroot.net/buildroot/tree/package/yajl/yajl-2.0.2-math-link.patch

btw... I think the yajl.pc needs a "Libs.private: -lm" as well.

> I submitted it to this list as well, but so far no response.

Any archive for this list? I wouldn't have reinvented this wheel if i
knew someone else had a solution.

-- 
Natanael Copa