[RTEMS Project] #2694: linking issue for htonl, etc when using -std=c99
RTEMS trac
trac at rtems.org
Fri Apr 15 15:17:19 UTC 2016
#2694: linking issue for htonl, etc when using -std=c99
---------------------------+-----------------------------
Reporter: joel.sherrill | Owner: sebastian.huber
Type: defect | Status: new
Priority: normal | Milestone: 4.12
Component: networking | Version: 4.12
Severity: normal | Keywords:
---------------------------+-----------------------------
When -std=c99 is on the compile line, there is a linking error for
undefined references to __htonl, __htons, __ntohl, and __ntohs. This test
case is just for htonl but others should be similar.
This likely impacts the 4.11 branch of rtems-libbsd as well but I was
testing on master.
Test case
======================
#include <arpa/inet.h>
int main(
int argc,
char **argv
)
{
uint32_t v = (uint32_t) argc;
uint32_t rc = htonl(v);
return v;
}
======================
This script was what I used to find what caused the linking error to go
away.
======================
RTEMS_MAKEFILE_PATH=/home/joel/rtems-4.11-work/tools/4.12/i386-rtems4.12/pc586/
i386-rtems4.12-gcc -std=c99 \
-B${RTEMS_MAKEFILE_PATH}/lib -specs bsp_specs -qrtems \
-D_XOPEN_SOURCE=600 -D__USE_SVID main.c -lbsd -lm -lbsd
i386-rtems4.12-gcc -std=c99 \
-B${RTEMS_MAKEFILE_PATH}/lib -specs bsp_specs -qrtems \
-D__USE_SVID main.c -lbsd -lm -lbsd
i386-rtems4.12-gcc -std=c99 \
-B${RTEMS_MAKEFILE_PATH}/lib -specs bsp_specs -qrtems \
main.c -lbsd -lm -lbsd
i386-rtems4.12-gcc \
-B${RTEMS_MAKEFILE_PATH}/lib -specs bsp_specs -qrtems \
main.c -lbsd -lm -lbsd
======================
--
Ticket URL: <http://devel.rtems.org/ticket/2694>
RTEMS Project <http://www.rtems.org/>
RTEMS Project
More information about the bugs
mailing list