You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@thrift.apache.org by "James Clarke (JIRA)" <ji...@apache.org> on 2010/08/17 04:59:18 UTC

[jira] Created: (THRIFT-856) Building cpp library fails on OS X with malloc and free not being declared in scope

Building cpp library fails on OS X with malloc and free not being declared in scope
-----------------------------------------------------------------------------------

                 Key: THRIFT-856
                 URL: https://issues.apache.org/jira/browse/THRIFT-856
             Project: Thrift
          Issue Type: Bug
          Components: Library (C++)
    Affects Versions: 0.4
         Environment: Mac OS X 10.6.4, g++ (GCC) 4.4.4
            Reporter: James Clarke
             Fix For: 0.4


Building cpp library fails for me on OS X with the following error:
{quote}
Making all in cpp
/bin/sh ../../libtool  --tag=CXX   --mode=compile g++ -DHAVE_CONFIG_H -I. -I../..  -I/opt/local/include -I./src  -Wall -g -O2 -MT Thrift.lo -MD -MP -MF .deps/Thrift.Tpo -c -o Thrift.lo `test -f 'src/Thrift.cpp' || echo './'`src/Thrift.cpp
libtool: compile:  g++ -DHAVE_CONFIG_H -I. -I../.. -I/opt/local/include -I./src -Wall -g -O2 -MT Thrift.lo -MD -MP -MF .deps/Thrift.Tpo -c src/Thrift.cpp  -fno-common -DPIC -o .libs/Thrift.o
src/Thrift.cpp: In member function 'void apache::thrift::TOutput::printf(const char*, ...)':
src/Thrift.cpp:45: error: 'malloc' was not declared in this scope
src/Thrift.cpp:59: error: 'free' was not declared in this scope
make[3]: *** [Thrift.lo] Error 1
make[2]: *** [all-recursive] Error 1
make[1]: *** [all-recursive] Error 1
make: *** [all] Error 2
{quote}

Adding cstdlib to the includes in Thrift.cpp fixes this problem. 

I'm not a C++ guy so I have no idea why this only failed for me.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (THRIFT-856) Building cpp library fails on OS X with malloc and free not being declared in scope

Posted by "James Clarke (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/THRIFT-856?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

James Clarke updated THRIFT-856:
--------------------------------

    Attachment: thrift-856-add-cstdlib-thrift-cpp-lib.patch

> Building cpp library fails on OS X with malloc and free not being declared in scope
> -----------------------------------------------------------------------------------
>
>                 Key: THRIFT-856
>                 URL: https://issues.apache.org/jira/browse/THRIFT-856
>             Project: Thrift
>          Issue Type: Bug
>          Components: Library (C++)
>    Affects Versions: 0.4
>         Environment: Mac OS X 10.6.4, g++ (GCC) 4.4.4
>            Reporter: James Clarke
>             Fix For: 0.4
>
>         Attachments: thrift-856-add-cstdlib-thrift-cpp-lib.patch
>
>
> Building cpp library fails for me on OS X with the following error:
> {quote}
> Making all in cpp
> /bin/sh ../../libtool  --tag=CXX   --mode=compile g++ -DHAVE_CONFIG_H -I. -I../..  -I/opt/local/include -I./src  -Wall -g -O2 -MT Thrift.lo -MD -MP -MF .deps/Thrift.Tpo -c -o Thrift.lo `test -f 'src/Thrift.cpp' || echo './'`src/Thrift.cpp
> libtool: compile:  g++ -DHAVE_CONFIG_H -I. -I../.. -I/opt/local/include -I./src -Wall -g -O2 -MT Thrift.lo -MD -MP -MF .deps/Thrift.Tpo -c src/Thrift.cpp  -fno-common -DPIC -o .libs/Thrift.o
> src/Thrift.cpp: In member function 'void apache::thrift::TOutput::printf(const char*, ...)':
> src/Thrift.cpp:45: error: 'malloc' was not declared in this scope
> src/Thrift.cpp:59: error: 'free' was not declared in this scope
> make[3]: *** [Thrift.lo] Error 1
> make[2]: *** [all-recursive] Error 1
> make[1]: *** [all-recursive] Error 1
> make: *** [all] Error 2
> {quote}
> Adding cstdlib to the includes in Thrift.cpp fixes this problem. 
> I'm not a C++ guy so I have no idea why this only failed for me.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (THRIFT-856) Building cpp library fails on OS X with malloc and free not being declared in scope

Posted by "Bryan Duxbury (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/THRIFT-856?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Bryan Duxbury updated THRIFT-856:
---------------------------------

    Fix Version/s: 0.5
                       (was: 0.4)

> Building cpp library fails on OS X with malloc and free not being declared in scope
> -----------------------------------------------------------------------------------
>
>                 Key: THRIFT-856
>                 URL: https://issues.apache.org/jira/browse/THRIFT-856
>             Project: Thrift
>          Issue Type: Bug
>          Components: C++ - Library
>    Affects Versions: 0.4
>         Environment: Mac OS X 10.6.4, g++ (GCC) 4.4.4
>            Reporter: James Clarke
>             Fix For: 0.5
>
>         Attachments: thrift-856-add-cstdlib-thrift-cpp-lib.patch
>
>
> Building cpp library fails for me on OS X with the following error:
> {quote}
> Making all in cpp
> /bin/sh ../../libtool  --tag=CXX   --mode=compile g++ -DHAVE_CONFIG_H -I. -I../..  -I/opt/local/include -I./src  -Wall -g -O2 -MT Thrift.lo -MD -MP -MF .deps/Thrift.Tpo -c -o Thrift.lo `test -f 'src/Thrift.cpp' || echo './'`src/Thrift.cpp
> libtool: compile:  g++ -DHAVE_CONFIG_H -I. -I../.. -I/opt/local/include -I./src -Wall -g -O2 -MT Thrift.lo -MD -MP -MF .deps/Thrift.Tpo -c src/Thrift.cpp  -fno-common -DPIC -o .libs/Thrift.o
> src/Thrift.cpp: In member function 'void apache::thrift::TOutput::printf(const char*, ...)':
> src/Thrift.cpp:45: error: 'malloc' was not declared in this scope
> src/Thrift.cpp:59: error: 'free' was not declared in this scope
> make[3]: *** [Thrift.lo] Error 1
> make[2]: *** [all-recursive] Error 1
> make[1]: *** [all-recursive] Error 1
> make: *** [all] Error 2
> {quote}
> Adding cstdlib to the includes in Thrift.cpp fixes this problem. 
> I'm not a C++ guy so I have no idea why this only failed for me.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (THRIFT-856) Building cpp library fails on OS X with malloc and free not being declared in scope

Posted by "Bryan Duxbury (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/THRIFT-856?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12905337#action_12905337 ] 

Bryan Duxbury commented on THRIFT-856:
--------------------------------------

When I do "make -C lib/cpp", I get an error with or without the attached patch applied, so I don't feel comfortable applying this patch. Anyone with CPP experience want to weigh in on whether this should be committed?

> Building cpp library fails on OS X with malloc and free not being declared in scope
> -----------------------------------------------------------------------------------
>
>                 Key: THRIFT-856
>                 URL: https://issues.apache.org/jira/browse/THRIFT-856
>             Project: Thrift
>          Issue Type: Bug
>          Components: C++ - Library
>    Affects Versions: 0.4
>         Environment: Mac OS X 10.6.4, g++ (GCC) 4.4.4
>            Reporter: James Clarke
>             Fix For: 0.5
>
>         Attachments: thrift-856-add-cstdlib-thrift-cpp-lib.patch
>
>
> Building cpp library fails for me on OS X with the following error:
> {quote}
> Making all in cpp
> /bin/sh ../../libtool  --tag=CXX   --mode=compile g++ -DHAVE_CONFIG_H -I. -I../..  -I/opt/local/include -I./src  -Wall -g -O2 -MT Thrift.lo -MD -MP -MF .deps/Thrift.Tpo -c -o Thrift.lo `test -f 'src/Thrift.cpp' || echo './'`src/Thrift.cpp
> libtool: compile:  g++ -DHAVE_CONFIG_H -I. -I../.. -I/opt/local/include -I./src -Wall -g -O2 -MT Thrift.lo -MD -MP -MF .deps/Thrift.Tpo -c src/Thrift.cpp  -fno-common -DPIC -o .libs/Thrift.o
> src/Thrift.cpp: In member function 'void apache::thrift::TOutput::printf(const char*, ...)':
> src/Thrift.cpp:45: error: 'malloc' was not declared in this scope
> src/Thrift.cpp:59: error: 'free' was not declared in this scope
> make[3]: *** [Thrift.lo] Error 1
> make[2]: *** [all-recursive] Error 1
> make[1]: *** [all-recursive] Error 1
> make: *** [all] Error 2
> {quote}
> Adding cstdlib to the includes in Thrift.cpp fixes this problem. 
> I'm not a C++ guy so I have no idea why this only failed for me.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Closed: (THRIFT-856) Building cpp library fails on OS X with malloc and free not being declared in scope

Posted by "Bryan Duxbury (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/THRIFT-856?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Bryan Duxbury closed THRIFT-856.
--------------------------------

      Assignee: James Clarke
    Resolution: Fixed

I just committed this. (If we want to make the changes David suggested, we can apply on a follow-on patch.)

> Building cpp library fails on OS X with malloc and free not being declared in scope
> -----------------------------------------------------------------------------------
>
>                 Key: THRIFT-856
>                 URL: https://issues.apache.org/jira/browse/THRIFT-856
>             Project: Thrift
>          Issue Type: Bug
>          Components: C++ - Library
>    Affects Versions: 0.4
>         Environment: Mac OS X 10.6.4, g++ (GCC) 4.4.4
>            Reporter: James Clarke
>            Assignee: James Clarke
>             Fix For: 0.5
>
>         Attachments: thrift-856-add-cstdlib-thrift-cpp-lib.patch
>
>
> Building cpp library fails for me on OS X with the following error:
> {quote}
> Making all in cpp
> /bin/sh ../../libtool  --tag=CXX   --mode=compile g++ -DHAVE_CONFIG_H -I. -I../..  -I/opt/local/include -I./src  -Wall -g -O2 -MT Thrift.lo -MD -MP -MF .deps/Thrift.Tpo -c -o Thrift.lo `test -f 'src/Thrift.cpp' || echo './'`src/Thrift.cpp
> libtool: compile:  g++ -DHAVE_CONFIG_H -I. -I../.. -I/opt/local/include -I./src -Wall -g -O2 -MT Thrift.lo -MD -MP -MF .deps/Thrift.Tpo -c src/Thrift.cpp  -fno-common -DPIC -o .libs/Thrift.o
> src/Thrift.cpp: In member function 'void apache::thrift::TOutput::printf(const char*, ...)':
> src/Thrift.cpp:45: error: 'malloc' was not declared in this scope
> src/Thrift.cpp:59: error: 'free' was not declared in this scope
> make[3]: *** [Thrift.lo] Error 1
> make[2]: *** [all-recursive] Error 1
> make[1]: *** [all-recursive] Error 1
> make: *** [all] Error 2
> {quote}
> Adding cstdlib to the includes in Thrift.cpp fixes this problem. 
> I'm not a C++ guy so I have no idea why this only failed for me.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (THRIFT-856) Building cpp library fails on OS X with malloc and free not being declared in scope

Posted by "Ju Chen (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/THRIFT-856?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12899354#action_12899354 ] 

Ju Chen commented on THRIFT-856:
--------------------------------

using gcc4.3+ ?


> Building cpp library fails on OS X with malloc and free not being declared in scope
> -----------------------------------------------------------------------------------
>
>                 Key: THRIFT-856
>                 URL: https://issues.apache.org/jira/browse/THRIFT-856
>             Project: Thrift
>          Issue Type: Bug
>          Components: Library (C++)
>    Affects Versions: 0.4
>         Environment: Mac OS X 10.6.4, g++ (GCC) 4.4.4
>            Reporter: James Clarke
>             Fix For: 0.4
>
>         Attachments: thrift-856-add-cstdlib-thrift-cpp-lib.patch
>
>
> Building cpp library fails for me on OS X with the following error:
> {quote}
> Making all in cpp
> /bin/sh ../../libtool  --tag=CXX   --mode=compile g++ -DHAVE_CONFIG_H -I. -I../..  -I/opt/local/include -I./src  -Wall -g -O2 -MT Thrift.lo -MD -MP -MF .deps/Thrift.Tpo -c -o Thrift.lo `test -f 'src/Thrift.cpp' || echo './'`src/Thrift.cpp
> libtool: compile:  g++ -DHAVE_CONFIG_H -I. -I../.. -I/opt/local/include -I./src -Wall -g -O2 -MT Thrift.lo -MD -MP -MF .deps/Thrift.Tpo -c src/Thrift.cpp  -fno-common -DPIC -o .libs/Thrift.o
> src/Thrift.cpp: In member function 'void apache::thrift::TOutput::printf(const char*, ...)':
> src/Thrift.cpp:45: error: 'malloc' was not declared in this scope
> src/Thrift.cpp:59: error: 'free' was not declared in this scope
> make[3]: *** [Thrift.lo] Error 1
> make[2]: *** [all-recursive] Error 1
> make[1]: *** [all-recursive] Error 1
> make: *** [all] Error 2
> {quote}
> Adding cstdlib to the includes in Thrift.cpp fixes this problem. 
> I'm not a C++ guy so I have no idea why this only failed for me.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (THRIFT-856) Building cpp library fails on OS X with malloc and free not being declared in scope

Posted by "David Reiss (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/THRIFT-856?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12905544#action_12905544 ] 

David Reiss commented on THRIFT-856:
------------------------------------

It's definitely an improvement.  We might also need to change "malloc" and "free" to "std::malloc" and "std::free" for maximum compatibility.  (Or add "using std::malloc;").

> Building cpp library fails on OS X with malloc and free not being declared in scope
> -----------------------------------------------------------------------------------
>
>                 Key: THRIFT-856
>                 URL: https://issues.apache.org/jira/browse/THRIFT-856
>             Project: Thrift
>          Issue Type: Bug
>          Components: C++ - Library
>    Affects Versions: 0.4
>         Environment: Mac OS X 10.6.4, g++ (GCC) 4.4.4
>            Reporter: James Clarke
>             Fix For: 0.5
>
>         Attachments: thrift-856-add-cstdlib-thrift-cpp-lib.patch
>
>
> Building cpp library fails for me on OS X with the following error:
> {quote}
> Making all in cpp
> /bin/sh ../../libtool  --tag=CXX   --mode=compile g++ -DHAVE_CONFIG_H -I. -I../..  -I/opt/local/include -I./src  -Wall -g -O2 -MT Thrift.lo -MD -MP -MF .deps/Thrift.Tpo -c -o Thrift.lo `test -f 'src/Thrift.cpp' || echo './'`src/Thrift.cpp
> libtool: compile:  g++ -DHAVE_CONFIG_H -I. -I../.. -I/opt/local/include -I./src -Wall -g -O2 -MT Thrift.lo -MD -MP -MF .deps/Thrift.Tpo -c src/Thrift.cpp  -fno-common -DPIC -o .libs/Thrift.o
> src/Thrift.cpp: In member function 'void apache::thrift::TOutput::printf(const char*, ...)':
> src/Thrift.cpp:45: error: 'malloc' was not declared in this scope
> src/Thrift.cpp:59: error: 'free' was not declared in this scope
> make[3]: *** [Thrift.lo] Error 1
> make[2]: *** [all-recursive] Error 1
> make[1]: *** [all-recursive] Error 1
> make: *** [all] Error 2
> {quote}
> Adding cstdlib to the includes in Thrift.cpp fixes this problem. 
> I'm not a C++ guy so I have no idea why this only failed for me.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.