pyavroc编译
编译pyavroc
1 #!/bin/bash 2 avro_dir=$1 3 4 # Copyright 2015 Byhiras (Europe) Limited 5 # 6 # Licensed under the Apache License, Version 2.0 (the "License"); 7 # you may not use this file except in compliance with the License. 8 # You may obtain a copy of the License at 9 # 10 # http://www.apache.org/licenses/LICENSE-2.0 11 # 12 # Unless required by applicable law or agreed to in writing, software 13 # distributed under the License is distributed on an "AS IS" BASIS, 14 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 # See the License for the specific language governing permissions and 16 # limitations under the License. 17 18 set -eux 19 20 STATIC=0 21 [ "${2:-}" = '--static' ] && STATIC=1 22 23 MYDIR=$(dirname $(readlink -f "$0")) 24 25 cd $MYDIR 26 27 28 if [ -z "$avro_dir" ]; then 29 echo "avro is null " 30 exit 1 31 fi 32 33 AVRO=$MYDIR/$avro_dir 34 35 [ -d $AVRO ] || git clone -b patches http://github.com/Byhiras/avro $(basename $AVRO) 36 37 # build avro 38 39 if ! [ -f $AVRO/dist/lib/libavro.a ] && ! [ -f $AVRO/dist/lib/libavro.so ] 40 then 41 # libavro.a must contain PIC 42 mv -n $AVRO/lang/c/src/CMakeLists.txt $AVRO/lang/c/src/orig_CMakeLists 43 cp -v $AVRO/lang/c/src/orig_CMakeLists $AVRO/lang/c/src/CMakeLists.txt 44 echo 'set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${CMAKE_SHARED_LIBRARY_C_FLAGS}")' >>$AVRO/lang/c/src/CMakeLists.txt 45 46 mkdir -p $AVRO/build $AVRO/dist 47 cd $AVRO/build 48 cmake $AVRO/lang/c -DCMAKE_VERBOSE_MAKEFILE=ON -DCMAKE_INSTALL_PREFIX=$AVRO/dist -DCMAKE_BUILD_TYPE=Release -DTHREADSAFE=true 49 make 50 make test 51 # workaround older cmake 52 mv $AVRO/build/avro-c.pc $AVRO/build/src/ || true 53 make install 54 55 # use static lib 56 [ $STATIC -eq 0 ] || rm -f $AVRO/dist/lib/libavro.so* 57 fi 58 59 PYTHON=${PYTHON:-python} 60 61 # build avro python 62 63 case $($PYTHON -c 'import sys; print(sys.version_info.major)') in 64 3) AVROPY=$AVRO/lang/py3 65 ;; 66 *) AVROPY=$AVRO/lang/py 67 ;; 68 esac 69 70 cd $AVROPY 71 72 rm -rf build 73 $PYTHON setup.py build 74 75 # build pyavroc 76 77 cd $MYDIR 78 79 rm -rf build dist 80 81 export PYAVROC_CFLAGS="-I$AVRO/dist/include" 82 if [ $STATIC -ne 0 ] 83 then 84 mkdir -p pyavroc/avro 85 cp -v local_avro/NOTICE.txt pyavroc/avro/ 86 # a bit cheesy: get libraries from the cmake link.txt file 87 export PYAVROC_LIBS=$(tr ' ' '\n' <$AVRO/build/src/CMakeFiles/avro-shared.dir/link.txt | grep '^-l' | cut -c3-) 88 export LDFLAGS="-L$AVRO/dist/lib" 89 else 90 export LDFLAGS="-L$AVRO/dist/lib -Wl,-rpath,$AVRO/dist/lib" 91 fi 92 93 $PYTHON setup.py build 94 95 cd build/lib*/pyavroc 96 97 cd $MYDIR 98 99 export PYTHONPATH=$(readlink -e build/lib*):$(readlink -e $AVROPY/build/lib*) 100 101 cd tests 102 103 $PYTHON -m pytest -sv .
https://github.com/apache/avro/tags
https://github.com/Byhiras/pyavroc/releases
LD_LIBRARY_PATH=/data/xxx/ python reader.py
人生还有意义。那一定是还在找存在的理由
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· Linux系列:如何用 C#调用 C方法造成内存泄露
· AI与.NET技术实操系列(二):开始使用ML.NET
· 记一次.NET内存居高不下排查解决与启示
· 探究高空视频全景AR技术的实现原理
· 理解Rust引用及其生命周期标识(上)
· DeepSeek 开源周回顾「GitHub 热点速览」
· 物流快递公司核心技术能力-地址解析分单基础技术分享
· .NET 10首个预览版发布:重大改进与新特性概览!
· AI与.NET技术实操系列(二):开始使用ML.NET
· 单线程的Redis速度为什么快?