我在这里是因为我不能解决我的问题;事实上,我正在用Eclipse CDT C/C+IDE(它是STM32嵌入式卡)的ARM EABI GCC编译器做一个C项目,并且我已经实现了Pul极SSL来创建一个HTTPS服务器:
我在很多论坛上看到我需要删除printfmallocfilepath来避免这个错误(事实上我是在一个嵌入式项目上,所以这些功能是被禁止的!)。但即使删除了所有这些函数,这些错误仍然存在所以现在我不知道如何解决这些错误,所以你能帮我吗?
谢谢你的帮助。

'Building file: ../.metadata/.plugins/org.eclipse.cdt.make.core/specs.c'
'Invoking: Cross GCC Compiler'
arm-none-eabi-gcc -DARP_CACHE_SIZE=4 -D_kill -D_getpid -D_cert -DUSE_IPV4 -DUSE_IPV6 -DNDP_CACHE_SIZE=4 -DHARDWARE_ETH_TX_CRC -DHARDWARE_ETH_RX_CRC -DUSE_STDPERIPH_DRIVER -DUSE_TCP -DHSE_VALUE=25000000 -DSTM32F2XX -DUSE_MII -I"C:\Sebastien\Sujet_1_ServeurWeb\Projet_1/test_serverweb_v0/src" -I"C:\Sebastien\Sujet_1_ServeurWeb\Projet_1/test_serverweb_v0/src/Library_StackIP/Driver_phyter_f2" -I"C:\Sebastien\Sujet_1_ServeurWeb\Projet_1/test_serverweb_v0/src/stm32f2xx" -I"C:\Sebastien\Sujet_1_ServeurWeb\Projet_1/test_serverweb_v0/src/urts" -I"C:\Sebastien\Sujet_1_ServeurWeb\Projet_1/test_serverweb_v0/src/ethernet" -I"C:\Sebastien\Sujet_1_ServeurWeb\Projet_1/test_serverweb_v0/src/agilia" -I"C:\Sebastien\Sujet_1_ServeurWeb\Projet_1/test_serverweb_v0/src/Service_HttpServeur" -I"C:\Sebastien\Sujet_1_ServeurWeb\Projet_1/test_serverweb_v0/src/Library_StackIP" -I"C:\Sebastien\Sujet_1_ServeurWeb\Projet_1/test_serverweb_v0/src/include/polarssl" -I"C:\Sebastien\Sujet_1_ServeurWeb\Projet_1/test_serverweb_v0/src/include" -I"C:\Sebastien\Sujet_1_ServeurWeb\Projet_1/test_serverweb_v0/src/library" -I"C:\Program Files\AIM\uOne\Tools\eclipse\..\..\CMSIS_V3P00\CMSIS\Include" -I"C:\Program Files\AIM\uOne\Tools\eclipse\..\..\CMSIS_V3P00\Device\ST\STM32F2xx\Include" -I"C:\Program Files\AIM\uOne\Tools\eclipse\..\..\F2\inc" -I"C:\Sebastien\Sujet_1_ServeurWeb\Projet_1\test_serverweb\src\LibrarySSL" -I"C:\Program Files\AIM\uOne\Tools\eclipse\..\..\F2\StdPeriph_Driver\inc" -I"C:\Program Files\AIM\uOne\Tools\eclipse\..\..\F2\STM32_Ethernet\inc" -I"C:\AIM\uOne\F2\inc" -I"C:\AIM\uOne\F2\StdPeriph_Driver\inc" -O2 -g3 -Wall -c -fmessage-length=0 -mthumb -mcpu=cortex-m3 -mfix-cortex-m3-ldrd -mfloat-abi=softfp -fsigned-char -ffunction-sections -fdata-sections -fomit-frame-pointer -MMD -MP -MF".metadata/.plugins/org.eclipse.cdt.make.core/specs.d" -MT".metadata/.plugins/org.eclipse.cdt.make.core/specs.d" -o ".metadata/.plugins/org.eclipse.cdt.make.core/specs.o" "../.metadata/.plugins/org.eclipse.cdt.make.core/specs.c"
'Finished building: ../.metadata/.plugins/org.eclipse.cdt.make.core/specs.c'

'Building target: test_serverweb_v0'
'Invoking: Cross GCC Linker'
arm-none-eabi-gcc -static -L"C:\Program Files\AIM\uOne\Tools\eclipse\..\..\F2\lib" -L"C:\AIM\uOne\F2\lib" -L"C:\Program Files\AIM\uOne\Tools\eclipse\..\..\F2\StdPeriph_Driver\lib" -L"C:\Program Files\AIM\uOne\Tools\eclipse\..\..\F2\STM32_Ethernet\lib" -L"C:\AIM\uOne\F2\STM32_Ethernet\lib" -L"C:\AIM\uOne\F2\StdPeriph_Driver\lib" -mthumb -mcpu=cortex-m3 -fsigned-char -ffunction-sections -fdata-sections -Wl,-T,../ldscripts/flash.ld,-Map,Debug.map,--gc-sections -o "test_serverweb_v0"  ./src/urts/urts_init.o  ./src/stm32f2xx/startup_stm32f2xx.o ./src/stm32f2xx/system_stm32f2xx.o  ./src/library/aes.o ./src/library/aesni.o ./src/library/arc4.o ./src/library/asn1parse.o ./src/library/asn1write.o ./src/library/base64.o ./src/library/bignum.o ./src/library/blowfish.o ./src/library/camellia.o ./src/library/certs.o ./src/library/cipher.o ./src/library/cipher_wrap.o ./src/library/ctr_drbg.o ./src/library/debug.o ./src/library/des.o ./src/library/dhm.o ./src/library/ecdh.o ./src/library/ecdsa.o ./src/library/ecp.o ./src/library/ecp_curves.o ./src/library/entropy.o ./src/library/entropy_poll.o ./src/library/error.o ./src/library/gcm.o ./src/library/havege.o ./src/library/md.o ./src/library/md2.o ./src/library/md4.o ./src/library/md5.o ./src/library/md_wrap.o ./src/library/memory.o ./src/library/memory_buffer_alloc.o ./src/library/net.o ./src/library/oid.o ./src/library/padlock.o ./src/library/pbkdf2.o ./src/library/pem.o ./src/library/pk.o ./src/library/pk_wrap.o ./src/library/pkcs11.o ./src/library/pkcs12.o ./src/library/pkcs5.o ./src/library/pkparse.o ./src/library/pkwrite.o ./src/library/ripemd160.o ./src/library/rsa.o ./src/library/sha1.o ./src/library/sha256.o ./src/library/sha512.o ./src/library/ssl_cache.o ./src/library/ssl_ciphersuites.o ./src/library/ssl_cli.o ./src/library/ssl_srv.o ./src/library/ssl_tls.o ./src/library/threading.o ./src/library/timing.o ./src/library/version.o ./src/library/x509.o ./src/library/x509_create.o ./src/library/x509_crl.o ./src/library/x509_crt.o ./src/library/x509_csr.o ./src/library/x509write_crt.o ./src/library/x509write_csr.o ./src/library/xtea.o  ./src/agilia/agilia_VC.o ./src/agilia/agilia_VS.o ./src/agilia/agilia_init_uRTS.o ./src/agilia/agilia_login_sha1.o ./src/agilia/agilia_moteur_info.o ./src/agilia/agilia_targetId.o ./src/agilia/agilia_xbin_mem.o  ./src/Service_HttpServeur/AFS.o ./src/Service_HttpServeur/AgiliaGV.o ./src/Service_HttpServeur/Base64.o ./src/Service_HttpServeur/HtmlPage.o ./src/Service_HttpServeur/HtmlPageDynamic.o ./src/Service_HttpServeur/Http.o ./src/Service_HttpServeur/HttpServer.o ./src/Service_HttpServeur/HttpUsers.o ./src/Service_HttpServeur/MoteurHTTP.o ./src/Service_HttpServeur/StdAfx.o ./src/Service_HttpServeur/UTF8.o ./src/Service_HttpServeur/WebSite.o ./src/Service_HttpServeur/divers.o ./src/Service_HttpServeur/httpd.o ./src/Service_HttpServeur/mime.o ./src/Service_HttpServeur/sgf_sdcard.o  ./src/Library_StackIP/Driver_phyter_f2/drv_buffer.o ./src/Library_StackIP/Driver_phyter_f2/drv_mac.o ./src/Library_StackIP/Driver_phyter_f2/drv_phyter_f2.o ./src/Library_StackIP/Driver_phyter_f2/drv_stats.o  ./src/Library_StackIP/arp.o ./src/Library_StackIP/hntonh.o ./src/Library_StackIP/icmp.o ./src/Library_StackIP/icmpv6.o ./src/Library_StackIP/interface_ethernet.o ./src/Library_StackIP/ipv4.o ./src/Library_StackIP/ipv6.o ./src/Library_StackIP/sck_api.o ./src/Library_StackIP/tcp.o ./src/Library_StackIP/udp.o  ./src/config_user.o ./src/ethernet_init.o ./src/hardware_init.o ./src/main.o ./src/peripherals_config.o ./src/ressources.o ./src/ssl_init_uRTS.o ./src/systickDelay.o ./src/timer_uRTS.o  ./.metadata/.plugins/org.eclipse.cdt.make.core/specs.o    -lservice_strformat -lagcomethernet -ltest_syscalls_v2 -lagcore -lagstr -lagtrycatch -lagvariables -lcrc16_soft -lcrc32_f2 -lsha1_soft -lagmetadebug -lflash_f2 -ldrv_phyter_f2 -lservice_horodateur -lservice_httpServeur -lservice_socket -lservice_STM32 -lsysirq -lsysrtc_f2 -lurts -lurtscore -ltrap12 -ltrap12core -lsystime -lsystick -lstm32_stdperiph_driver -lstm32_ethernet -lRessources
c:/program files/aim/uone/tools/bin/../lib/gcc/arm-none-eabi/4.6.2/../../../../arm-none-eabi/lib/armv7-m\libc.a(lib_a-signalr.o): In function `_kill_r':
signalr.c:(.text._kill_r+0xe): undefined reference to `_kill'
c:/program files/aim/uone/tools/bin/../lib/gcc/arm-none-eabi/4.6.2/../../../../arm-none-eabi/lib/armv7-m\libc.a(lib_a-signalr.o): In function `_getpid_r':
signalr.c:(.text._getpid_r+0x0): undefined reference to `_getpid'
c:/program files/aim/uone/tools/bin/../lib/gcc/arm-none-eabi/4.6.2/../../../../arm-none-eabi/lib/armv7-m\libc.a(lib_a-sbrkr.o): In function `_sbrk_r':
sbrkr.c:(.text._sbrk_r+0xc): undefined reference to `_sbrk'
collect2: ld returned 1 exit status
aim-make: *** [test_serverweb_v0] Error 1

**** Build Finished ****

最佳答案

你不需要“删除”Newlib中的任何内容,你也不应该-我认为这不会有帮助-我想知道你在哪里读到的?
您需要提供syscall存根,尽管其中许多存根可以是空函数,或者至少返回错误状态,以防有人或某事无意中调用它们-它们与进程控制、内存分配和流I/O有关。这些几乎肯定是由您正在使用的第三方代码间接引用的。
如果将Newlib构建为静态库,它将只链接解析代码中符号所需的代码,因此,如果获得未定义的引用,则调用依赖于这些引用的内容。
不应该做的是编译Newlib代码并将其直接链接到应用程序代码,这将链接大量未使用的代码,并要求您提供其他未使用的存根。

关于c - 对_kill,_getpid和_sbrk的 undefined reference ,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/22660011/

10-12 20:35