Motif clustering based on snap. (snap.stanford.edu/higher-order)

本文介绍在Ubuntu Linux 12.04环境下成功编译并运行Motif Clustering工具所需的步骤及依赖库安装流程。从安装g++、gfortran开始,到blas、lapack、arpack等库的配置,最后完成Motif Clustering的编译与执行。

1. successful compiling of motif clustering (snap/example/motifcluster/) needs a lot of steps and libraries.

 

Os: Ubuntu linux 12.04 desktop 64bit

 

1> Install g++

 

Sudo get-apt…

 

2>Install gfortran and fortran77

 

Sudo get-apt gfortran

 

Note: fortran77 is optional because gfrotran can complile fortran77 code as well. But you need to modify the ARmake.inc file in the root directory of arpack to specify your complier.

 

3>Install blas

           

            Download from www.netlib.org/blas/

           

            In the BLAS root directory, run make command, get .a files

 

            Mv blas_LINUX.a  libplas.a

 

            Sudo cp libblas.a /usr/lib/

 

            Note: 1. .a is static library while .so is dynamic library

2. After you put a libxxx.a file into /usr/lib/, suffix “-lxxx” can be used while compiling.

 

4>Install lapack

 

            Download from www.netlib.org/lapack/

           

            In the lapack root directory, run make command, get liblapack.a files

 

            Sudo cp liblapack.a /usr/lib/

 

5>Install arpack

            Download: www.caam.rice.edu/software/ARPACK/

            First, modify the ARmake.inc file. Especially “home”, where to generate the lib file, the lib’s name, the complier you want to use (f77 by default) and the directory that make lies in. The default directory of make in the os is different from the default value.

 

            Second, modify the second.f in UTIL if needed. (I haven’t)

 

            Third, run “make lib” in the top directory of arpack to get a libxxxx.a

 

            Fourth, “cp libxxxx.a /usr/lib/”

 

            You are all set.

 

6>Compile motifcluster

 

            Run “make” in the directory “SNAPHOME/example/motifcluter/” to get executable “motifclutermain”.

 

7>Run it

 

            ./motifclustermain -i: C-elegans-frontal.txt -m:bifan

 

            Note: -i: input file, -m: motif pattern

 

            # look the result

            Cat C-elegans-frontal-bifan-cluster.txt

 

            Note: the first group of integers is the cluster of most importance. Can be used to get a group of members that are most interesting.

            Python get_names.py C-elegans-frontal-meta.csv

 

            Note: to get the name of the nodes in the cluster

 

2. about the paper

 

1> I think the explaination of value vol(S) is very misleading. It should be the sum of degrees of all the nodes that reside in S.

 

2>the algorithm is to find one partition of the s list, an ordered list got from the normalized Laplacian of the motif adjacency matrix, so that the conductance of the partition is the smallest. The smaller group is the cluster we need.

 

           

 

<think> 我们面对的问题是:在银河麒麟ARM系统上运行x86_64程序时,BOX64报错提示找不到`libXm.so.4`(路径为`/usr/lib/x86_64-linux-gnu/libXm.so.4`)。根据引用[2]的启示,可以通过安装OpenMotif并创建符号链接来解决类似问题。但需注意,当前系统是ARM架构,而程序需要x86_64库,因此不能直接使用ARM版的Motif库,必须使用x86_64版本。 ### 解决方法 #### 1. 安装x86_64架构的OpenMotif库 由于银河麒麟ARM系统无法直接安装x86_64的deb包,需手动下载并解压x86_64架构的Motif库: ```bash # 下载x86_64架构的Motif库 wget http://archive.ubuntu.com/ubuntu/pool/universe/m/motif/libmotif-common_2.3.8-2_all.deb wget http://archive.ubuntu.com/ubuntu/pool/universe/m/motif/libxm4_2.3.8-2_amd64.deb # 创建解压目录 mkdir motif_x86_64 cd motif_x86_64 # 解压deb包 ar x ../libxm4_2.3.8-2_amd64.deb tar xvf data.tar.xz # 注意:实际压缩格式可能是data.tar.gz或data.tar.xz,根据情况调整 # 将x86_64库文件复制到BOX64专用目录 sudo mkdir -p /opt/box64-libs/x86_64 sudo cp usr/lib/x86_64-linux-gnu/libXm.so.4.0.4 /opt/box64-libs/x86_64/ ``` #### 2. 创建符号链接 在BOX64的库目录中创建必要的符号链接,模拟`/usr/lib/x86_64-linux-gnu`的结构: ```bash cd /opt/box64-libs/x86_64 sudo ln -s libXm.so.4.0.4 libXm.so.4 sudo ln -s libXm.so.4 libXm.so # 可选,部分程序可能直接查找libXm.so ``` #### 3. 配置BOX64环境变量 将自定义库目录加入BOX64的搜索路径: ```bash # 临时生效(测试用) export BOX64_LD_LIBRARY_PATH="/opt/box64-libs/x86_64:$BOX64_LD_LIBRARY_PATH" # 永久生效(添加到~/.bashrc或/etc/profile) echo 'export BOX64_LD_LIBRARY_PATH="/opt/box64-libs/x86_64:$BOX64_LD_LIBRARY_PATH"' >> ~/.bashrc source ~/.bashrc ``` #### 4. 验证库加载 使用BOX64的ldd功能检查依赖解析: ```bash box64 ldd /media/test/DATA/soft_DMG/Soft/Soft_dmg/lib/libpcl_visualization.so.1.8 | grep libXm ``` 预期输出应显示: ``` libXm.so.4 => /opt/box64-libs/x86_64/libXm.so.4 (0x0000007f8a1d4000) ``` ### 技术原理 - **动态链接重定位**:程序运行时通过`R_X86_64_GLOB_DAT`等重定位类型解析全局符号[^4]。当依赖库缺失时,符号地址$S$无法计算,导致重定位失败。 - **BOX64路径模拟**:通过`BOX64_LD_LIBRARY_PATH`优先加载x86_64库,覆盖系统默认路径。 - **符号链接兼容性**:创建`libXm.so.4→libXm.so.4.0.4`的链接,满足ELF文件的`DT_NEEDED`条目要求(指定了`libXm.so.4`)。 ### 相关问题 1. 如何在银河麒麟ARM系统下管理多个架构的动态库? 2. BOX64环境变量`BOX64_LD_LIBRARY_PATH`与系统`LD_LIBRARY_PATH`有何区别? 3. 如何为其他x86_64依赖库(如OpenGL)创建兼容层? 4. 当遇到`undefined symbol`错误时,如何快速定位缺失的库版本? [^1]: RPM资源库提供历史版本库文件下载 [^2]: CentOS系统中通过符号链接解决库版本兼容问题 [^3]: 第三方技术论坛分享的类似问题解决方案 </think> ### 解决找不到 `/usr/lib/x86_64-linux-gnu/libXm.so.4` 的方法 #### 解决方案(ARM架构系统适用) 1. **安装ARM原生Motif库** ```bash sudo apt update sudo apt install libmotif-dev -y ``` 2. **创建符号链接**(参考引用[2]) ```bash # 验证已安装的库版本 ls /usr/lib/$(uname -m)-linux-gnu/libXm.so* # 创建兼容链接(以下路径需根据实际安装位置调整) sudo ln -s /usr/lib/aarch64-linux-gnu/libXm.so.4 /usr/lib/x86_64-linux-gnu/libXm.so.4 ``` 3. **配置动态链接器** ```bash # 更新链接器缓存 sudo ldconfig # 验证链接 ldconfig -p | grep libXm.so.4 ``` 预期输出: ``` libXm.so.4 (libc6,AArch64) => /usr/lib/aarch64-linux-gnu/libXm.so.4 libXm.so.4 (libc6,x86-64) => /usr/lib/x86_64-linux-gnu/libXm.so.4 ``` #### 容器化解决方案(推荐) 若符号链接不生效,使用Docker容器隔离x86环境: ```bash # 创建Dockerfile cat > Dockerfile <<EOF FROM ubuntu:20.04 RUN apt update && apt install -y \ libxm4:amd64 \ libmotif-common:amd64 EOF # 构建并运行容器 docker build -t x86_motif . docker run -v /path/to/your/app:/app -it x86_motif /app/your_program ``` #### 技术原理 1. **动态链接机制**: Linux通过动态链接器(`ld.so`)解析共享库依赖,满足关系: $$\text{实际地址} = \text{基址} + \text{偏移量}$$ 当路径不匹配时导致加载失败 2. **符号链接作用**: 创建`/usr/lib/x86_64-linux-gnu/libXm.so.4 → ../aarch64-linux-gnu/libXm.so.4`的链接 使x86_64路径请求重定向到ARM库的实际位置 3. **ABI兼容性**: Motif库的C接口在ARM/x86_64架构间二进制兼容,前提是: $$ \texttt{sizeof(long)} = 8 \quad \text{且} \quad \texttt{__ARM_PCS_AAPCS64} $$ 银河麒麟ARMv8满足此条件 ### 相关问题 1. 如何检查动态库的架构兼容性? 2. Docker容器中如何保持GUI程序显示能力? 3. 银河麒麟系统下`ldconfig`的工作原理是什么? 4. 当遇到`GLIBC版本不匹配`时该如何解决? > 提示:若使用BOX64运行x86程序,需额外配置`BOX64_LD_LIBRARY_PATH=/opt/box64-libs/x86_64`指向x86库目录(参考之前方案)[^2]
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值