1. 程式人生 > >交叉編譯: undefined reference to `rpl_malloc'

交叉編譯: undefined reference to `rpl_malloc'

今天交叉編譯一個程式時遇到了一個很奇怪的問題,編譯到最後一步連結時,發生了下面的錯誤:

?
1 2 /opt/toolschain/3.4.1/arm-linux/lib/libjson.so: undefined reference to `rpl_realloc' /opt/toolschain/3.4.1/arm-linux/lib/libjson.so: undefined reference to `rpl_malloc'

很顯然,在連結libjson庫時發生了錯誤,libjson不知道為什麼連結了兩個不存在的函式:rpl_realloc和rpl_malloc。因為工具鏈中的所有庫都是自己編譯的,所以只能從自己身上找錯誤==。

遂重新編譯libjson,發現config.h裡有下面的幾句話:

?
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 /* Define to 1 if your system has a GNU libc compatible `malloc' function, and to 0 otherwise. */ #define HAVE_MALLOC 0 /* Define to 1 if your system has a GNU libc compatible `realloc' function, and to 0 otherwise. */
#define HAVE_REALLOC 0 ... /* Define to rpl_malloc if the replacement function should be used. */ #define malloc rpl_malloc /* Define to rpl_realloc if the replacement function should be used. */ #define realloc rpl_realloc

看來是交叉編譯時autotools認為我的工具鏈的libc中不包含malloc和realloc,然後擅自做主張給我替換成了rpl_malloc和rpl_realloc。把上面的幾句話刪掉後重新編譯,就正常了。

相關推薦

交叉編譯: undefined reference to `rpl_malloc'

今天交叉編譯一個程式時遇到了一個很奇怪的問題,編譯到最後一步連結時,發生了下面的錯誤: ? 1 2 /opt/toolschain/3.4.1/arm-linux/lib/libjson.so: undefined reference to `rpl_realloc' /opt/to

json-c 交叉編譯undefined reference to rpl_malloc

(如果有幫助,請點個贊;如果有錯誤,請指出;如果轉載,請註明出處) 關鍵詞: (1)json-c (2)mips、openwrt (3)Relocations in generic ELF 正文

gcc編譯undefined reference to本質原因

專案中的LVS用到keepalived和ipvsadm等三方件,在suse11和suse12上編譯最新版本的過程中遇到的最多的錯誤便是 undefined reference to xxx。由於對背後的原理基本沒啥理解,所以遇到問題的解決辦法就是把錯誤資訊拿去google,baidu搜。當遇

codeBlocks編譯undefined reference to錯誤解決

      codeBlocks它輕巧,強大,跨平臺,是我繼在使用VC6.0之後很歡喜的一個IDE,VC6.0已經很老了,我也很建議大家使用Codeblocks這個優雅清新的C語言程式設計軟體。 codeBlocks編譯undefined reference to錯

linux gcc編譯undefined reference to `stricmp'問題

最近gcc編譯遇到這樣的問題:undefined reference to `stricmp'. 查了下,stricmp是Windows特有函式。 解決方法: stricmp是Microsoft's compilers/libraries.linux下用strcasecm

linux下開發,解決cocos2d-x中編譯出現的一個小問題, undefined reference to symbol 'pthread_create@@GLIBC_2.2.5'

water span x86 code bject data- ace 技術分享 inux 解決cocos2d-x中編譯出現的一個小問題 對於cocos2d-x 2.×中編譯中,若頭文件裏引入了#include "cocos-ext.h",在進行C++編譯的時候會遇到例

[ c++] cmake 編譯undefined reference to `std::cout' 錯誤的解決方案

bin cut () cmake fin epo linking com urn cmake .. 和 make 之後,出現如下錯誤 Linking CXX executable ../../../bin/ModuleTest CMakeFiles/Modu

Linux下運行《UNIX環境高級編程》undefined reference to `err_quit 編譯出錯的處理方法

reg init def bre linux tput linux下 pan termios 錯誤信息: : undefined reference to `err_quit‘: undefined reference to `err_sys‘ 解決方法: 因為err

minigui:解決gvfb編譯報錯undefined reference to symbol 'XkbGetIndicatorState'

minigui在linux PC平臺建立開發環境時,需要Virtual Frame Buffer 支援(gvfb,qvfb),minigui官網提供了這兩個程式的原始碼,需要自己下載編譯並安裝到自己的PC上。 我用的是gvfb,minigui下載地址:http://www.minig

C++編譯提示“undefined reference to...”

編寫的一個簡單C++時鐘Clock類,放入了標頭檔案中,主函式在呼叫標頭檔案進行編譯時出現上述錯誤,具體程式碼如下: clock.h: #include <iostream> using namespace std; class Clock { private:

「caffe編譯bug」.build_release/lib/libcaffe.so: undefined reference to cv::imread

轉自:https://www.douban.com/note/568788483/ CXX/LD -o .build_release/tools/convert_imageset.bin.build_release/lib/libcaffe.so: undefined reference to cv::im

「caffe編譯bug」 undefined reference to `boost::match_results<__gnu_cxx::__normal_iterator<char const*, std::__cxx11

CXX/LD -o .build_release/tools/test_net.binCXX/LD -o .build_release/tools/convert_annoset.binCXX/LD -o .build_release/tools/device_query.binCXX/LD -o .buil

ubuntu16.04下編譯caffe出現.build_release/lib/libcaffe.so: undefined reference to google ::protobuf…的問題

人工智慧/機器學習/深度學習交流QQ群:811460433 程式設計師深度學習微信公眾號: ubuntu16.04下編譯caffe出現.build_release/lib/libcaffe.so: undefined reference to google ::protobuf…的

Clion lua 編譯報錯: undefined reference to `lual_newstate' 在win10上面編譯lua5.3.5以及解決方法

在CmakeLists.txt裡面新增:  ``` include_directories("D:\\lua\\lua-5.3.5\\lua-5.3.5\\dist\\include") link_directories("D:\\lua\\lua-5.3.5\\lua-5.3.5

ubuntu 下 make 編譯錯誤:undefined reference to cv::line

在編譯一個專案時候出現 “undefined reference to cv::line” 的錯誤,是在連結其中一個靜態庫的時候出現的錯誤,錯誤如下: /home/build/lib/libapriltags.a(TagDetection.cc.o): In function `AprilTag

關於移植jSON編譯時報錯sbrkr.c:(.text+0xc): undefined reference to `_sbrk'處理

最近有個專案需要用到jSON函式,在移植了jSON後編譯報錯如下:sbrkr.c:(.text+0xc): undefined reference to `_sbrk'。 通過百度查詢知道原來是GCC編譯器不支援malloc、free、memcpy、strlen等函式導致的,正常在嵌入式系統

Linux程式設計時使用gcc編譯.c出現以下問題,pthread.c:(.text+0x29): undefined reference to `pthread_create'collect2: err

Linux程式設計時使用gcc編譯.c出現以下問題 client.c:(.text+0x13e): undefined reference to `pthread_create' collect2: ld 返回 1   解決方法如下: 只需在用gcc編譯時加上-pthread選項即

win10 QtCreator5.10 編譯opengl出現 error: undefined reference to `
Qt 編譯出錯:undefined reference to vtable XXX

  在Qt編譯的過程中,程序會出現 error: undefined reference to `vtable for 類名'的問題,對於不經常使用QT的人來說甚是頭疼,其實這類問題發生的主要原因在於,一般我們定義了一個類以後,如果他是繼承了其他類的話 就比如說我們

Windows編譯OpenCV4Android解決undefined reference to std錯誤

OpenCV4Android支援三種使用方式 1.Java層呼叫 2.NDK呼叫動態庫(方便,但是會包含整個.so庫) 3.NDK呼叫靜態庫(靈活,比如沒有用到機器學習模組,libopencv_ml.a裡的程式碼是不會打包到動態庫裡的) 通過連結靜態庫的方式使用