[ 
https://issues.apache.org/jira/browse/ARROW-15209?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Rob Ambalu updated ARROW-15209:
-------------------------------
    Description: 
When trying to extend parquet::StreamWriter so that I can support nanosecond 
timestamps, I ran into a strange link error.  It seems to have to do with 
invoking the StreamWriter::Write<>template method from the derived class.  If I 
comment out the invocation it links fine.

The Write<> method accesses the static constexpr  kDefLevelOne, and 
kRepLevelZero, which is what the linker ends up complaining about.  I'm not 
entirely sure, perhaps its a compiler bug.

 

Sample code to repro:

 
{code:java}
#include <parquet/stream_writer.h>class StreamWriter : public 
parquet::StreamWriter
{
public:
    StreamWriter & operator<<(int64_t v )
    { 
        CheckColumn(parquet::Type::INT64, parquet::ConvertedType::NONE);
        StreamWriter::Write<parquet::Int64Writer>( v );
        return *this;
    }
};

int main()
{
    StreamWriter writer;
    writer << int64_t( 0 );
}
 {code}
Link Error:

 

 
{code:java}
binutils/binutils-2.31/bin/ld: 
Python-3.6.4/lib/python3.6/site-packages/pyarrow/libparquet.a(stream_writer.cc.o):(.rodata+0x78):
 multiple definition of `parquet::StreamWriter::kRepLevelZero'; 
binutils/binutils-2.31/bin/ld: DWARF error: can't find .debug_ranges section.
CMakeFiles/link_error.dir/link_error.cpp.o:(.rodata._ZN7parquet12StreamWriter13kRepLevelZeroE[_ZN7parquet12StreamWriter13kRepLevelZeroE]+0x0):
 first defined here
binutils-2.31/bin/ld: 
Python-3.6.4/lib/python3.6/site-packages/pyarrow/libparquet.a(stream_writer.cc.o):(.rodata+0x7a):
 multiple definition of `parquet::StreamWriter::kDefLevelOne'; 
CMakeFiles/link_error.dir/link_error.cpp.o:(.rodata._ZN7parquet12StreamWriter12kDefLevelOneE[_ZN7parquet12StreamWriter12kDefLevelOneE]+0x0):
 first defined here
 {code}
 

 

  was:
When trying to extend parquet::StreamWriter so that I can support nanosecond 
timestamps, I ran into a strange link error.  It seems to have to do with 
invoking the StreamWriter::Write<>template method from the derived class.  If I 
comment out the invocation it links fine.

The Write<> method accesses the static constexpr  kDefLevelOne, and 
kRepLevelZero, which is what the linker ends up complaining about.  I'm not 
entirely sure, perhaps its a compiler bug.

 

Sample code to repro:

 
{code:java}
#include <parquet/stream_writer.h>class StreamWriter : public 
parquet::StreamWriter
{
public:
    StreamWriter & operator<<(int64_t v )
    { 
        CheckColumn(parquet::Type::INT64, parquet::ConvertedType::NONE);
        StreamWriter::Write<parquet::Int64Writer>( v );
        return *this;
    }
};int main()
{
    StreamWriter writer;
    writer << int64_t( 0 );
}
 {code}
Link Error:

 

 
{code:java}
binutils/binutils-2.31/bin/ld: 
Python-3.6.4/lib/python3.6/site-packages/pyarrow/libparquet.a(stream_writer.cc.o):(.rodata+0x78):
 multiple definition of `parquet::StreamWriter::kRepLevelZero'; 
binutils/binutils-2.31/bin/ld: DWARF error: can't find .debug_ranges section.
CMakeFiles/link_error.dir/link_error.cpp.o:(.rodata._ZN7parquet12StreamWriter13kRepLevelZeroE[_ZN7parquet12StreamWriter13kRepLevelZeroE]+0x0):
 first defined here
binutils-2.31/bin/ld: 
Python-3.6.4/lib/python3.6/site-packages/pyarrow/libparquet.a(stream_writer.cc.o):(.rodata+0x7a):
 multiple definition of `parquet::StreamWriter::kDefLevelOne'; 
CMakeFiles/link_error.dir/link_error.cpp.o:(.rodata._ZN7parquet12StreamWriter12kDefLevelOneE[_ZN7parquet12StreamWriter12kDefLevelOneE]+0x0):
 first defined here
 {code}
 

 


> link error when extending parquet::StreamWriter
> -----------------------------------------------
>
>                 Key: ARROW-15209
>                 URL: https://issues.apache.org/jira/browse/ARROW-15209
>             Project: Apache Arrow
>          Issue Type: Improvement
>          Components: C++
>    Affects Versions: 5.0.0
>         Environment: Linux CentOS, compiled with gcc-11.2 and binutils-2.31
>            Reporter: Rob Ambalu
>            Priority: Minor
>
> When trying to extend parquet::StreamWriter so that I can support nanosecond 
> timestamps, I ran into a strange link error.  It seems to have to do with 
> invoking the StreamWriter::Write<>template method from the derived class.  If 
> I comment out the invocation it links fine.
> The Write<> method accesses the static constexpr  kDefLevelOne, and 
> kRepLevelZero, which is what the linker ends up complaining about.  I'm not 
> entirely sure, perhaps its a compiler bug.
>  
> Sample code to repro:
>  
> {code:java}
> #include <parquet/stream_writer.h>class StreamWriter : public 
> parquet::StreamWriter
> {
> public:
>     StreamWriter & operator<<(int64_t v )
>     { 
>         CheckColumn(parquet::Type::INT64, parquet::ConvertedType::NONE);
>         StreamWriter::Write<parquet::Int64Writer>( v );
>         return *this;
>     }
> };
> int main()
> {
>     StreamWriter writer;
>     writer << int64_t( 0 );
> }
>  {code}
> Link Error:
>  
>  
> {code:java}
> binutils/binutils-2.31/bin/ld: 
> Python-3.6.4/lib/python3.6/site-packages/pyarrow/libparquet.a(stream_writer.cc.o):(.rodata+0x78):
>  multiple definition of `parquet::StreamWriter::kRepLevelZero'; 
> binutils/binutils-2.31/bin/ld: DWARF error: can't find .debug_ranges section.
> CMakeFiles/link_error.dir/link_error.cpp.o:(.rodata._ZN7parquet12StreamWriter13kRepLevelZeroE[_ZN7parquet12StreamWriter13kRepLevelZeroE]+0x0):
>  first defined here
> binutils-2.31/bin/ld: 
> Python-3.6.4/lib/python3.6/site-packages/pyarrow/libparquet.a(stream_writer.cc.o):(.rodata+0x7a):
>  multiple definition of `parquet::StreamWriter::kDefLevelOne'; 
> CMakeFiles/link_error.dir/link_error.cpp.o:(.rodata._ZN7parquet12StreamWriter12kDefLevelOneE[_ZN7parquet12StreamWriter12kDefLevelOneE]+0x0):
>  first defined here
>  {code}
>  
>  



--
This message was sent by Atlassian Jira
(v8.20.1#820001)

Reply via email to