cross compile mono for windows.

on ubuntu

 

prerequisities:

 

1 build-essential

2 autoconf

3 libtool

4 gettext

5 gcc-mingw32

 

download the latest source package.

 

and run

 

./build-mingw32.sh -d /usr/i586-mingw32msvc -m i586-mingw32msvc

 

done.

 

 

compiling mono on windows is painful. The easiest way is to compile it on Linux for windows. 

If we don't have a linux at hand, simply download a virtualbox,install it and get your jod done there.

 

forget about cygwin..

 

ubuntu is a great tool for development..easy to get all dependencies.

 

x@pi:/tmp $ git clone https://github.com/WiringPi/WiringPi.git cd WiringPi ./build Cloning into 'WiringPi'... remote: Enumerating objects: 3352, done. remote: Counting objects: 100% (1516/1516), done. remote: Compressing objects: 100% (392/392), done. remote: Total 3352 (delta 1310), reused 1137 (delta 1123), pack-reused 1836 (from 3) Receiving objects: 100% (3352/3352), 1.39 MiB | 2.17 MiB/s, done. Resolving deltas: 100% (2157/2157), done. wiringPi Build script ===================== WiringPi Library [UnInstall] [Compile] wiringPi.c [Compile] wiringSerial.c [Compile] wiringShift.c [Compile] piHiPri.c [Compile] piThread.c [Compile] wiringPiSPI.c [Compile] wiringPiI2C.c [Compile] softPwm.c [Compile] softTone.c [Compile] mcp23008.c [Compile] mcp23016.c [Compile] mcp23017.c [Compile] mcp23s08.c [Compile] mcp23s17.c [Compile] sr595.c [Compile] pcf8574.c [Compile] pcf8591.c [Compile] mcp3002.c [Compile] mcp3004.c [Compile] mcp4802.c [Compile] mcp3422.c [Compile] max31855.c [Compile] max5322.c [Compile] ads1115.c [Compile] sn3218.c [Compile] bmp180.c [Compile] htu21d.c [Compile] ds18b20.c [Compile] rht03.c [Compile] drcSerial.c [Compile] drcNet.c [Compile] pseudoPins.c [Compile] wpiExtensions.c [Compile] wiringPiLegacy.c [Link (Dynamic)] [Install Headers] [Install Dynamic Lib] WiringPi Devices Library [UnInstall] [Compile] ds1302.c [Compile] maxdetect.c [Compile] piNes.c [Compile] gertboard.c [Compile] piFace.c [Compile] lcd128x64.c [Compile] lcd.c [Compile] scrollPhat.c [Compile] piGlow.c [Link (Dynamic)] [Install Headers] [Install Dynamic Lib] GPIO Utility [Compile] gpio.c [Compile] readall.c [Link] [Install] All Done. NOTE: To compile programs with wiringPi, you need to add: -lwiringPi to your compile line(s) To use the Gertboard, MaxDetect, etc. code (the devLib), you need to also add: -lwiringPiDev to your compile line(s). x@pi:/tmp/WiringPi $ gpio readall gpio: Symbol `piModelNames' has different size in shared object, consider re-linking Oops - unable to determine board type... model: 23
06-27
### WiringPi 中 `gpio readall` 报错 `Symbol 'piModelNames' has different size in shared object` 的解决方法 当用户运行 `gpio readall` 时出现错误提示 `Symbol 'piModelNames' has different size in shared object`,通常表明当前使用的 WiringPi 动态库与程序期望的结构不一致。这种问题可能源于多个方面:版本冲突、动态链接库未更新、系统架构变更或库文件损坏。 WiringPi 是一个用于操作树莓派 GPIO 的 C 库,其核心功能依赖于共享对象(`.so` 文件)的正确加载[^1]。如果该库在编译后没有被正确安装,或者系统中存在多个不同版本的 `libwiringPi.so`,就可能导致符号表中的某些结构大小不匹配,从而引发上述错误。 #### 清理旧版本并重新编译安装 WiringPi 为了解决这一问题,建议完全卸载已有的 WiringPi 安装包,并从源码重新构建: ```bash sudo apt purge wiringpi rm -rf /usr/local/include/WiringPi rm -rf /usr/local/lib/libwiringPi* ``` 随后克隆官方仓库并进行干净编译: ```bash git clone https://github.com/WiringPi/WiringPi.git cd WiringPi ./build clean ./build ``` 此过程将确保所有中间对象文件和最终生成的 `.so` 文件都基于最新的源代码重建,避免因残留旧文件导致的结构不一致问题。安装完成后,通过以下命令验证是否仍然报错: ```bash gpio -v gpio readall ``` #### 检查动态链接器缓存与运行时路径 即使成功编译安装了 WiringPi,也可能由于动态链接器使用了旧的 `.so` 文件而继续报错。此时应检查 `/etc/ld.so.conf.d/` 目录下的配置文件是否包含 `/usr/local/lib` 路径,并执行: ```bash sudo ldconfig ``` 以更新系统对共享库的索引信息。此外,可以使用 `LD_LIBRARY_PATH` 显式指定运行时查找路径: ```bash export LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH gpio readall ``` 这样可确保运行 `gpio` 命令时优先加载最新安装的库文件。 #### 使用 `readelf` 分析符号冲突 若问题依旧存在,可以通过 `readelf` 工具查看 `piModelNames` 符号在不同 `.so` 文件中的定义情况: ```bash find / -name "libwiringPi*" -exec readelf -s {} \; | grep piModelNames ``` 该命令将列出所有涉及 `piModelNames` 的符号条目及其所在库文件。若发现多个定义且大小不一致,则说明存在版本冲突。此时应删除多余版本,仅保留最新构建的 `.so` 文件。 #### 验证硬件识别能力 部分新设备(如 Raspberry Pi Model B Rev 1.0)可能因 `/proc/cpuinfo` 缺少完整字段而导致 WiringPi 无法识别板型。可通过以下命令确认硬件信息是否完整: ```bash cat /proc/cpuinfo | grep Hardware ``` 若输出为空或格式异常,需更新固件或内核模块以确保 `/proc` 接口提供完整的硬件描述信息。 ---
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值