#2694 closed defect (worksforme)

linking issue for htonl, etc when using -std=c99

Reported by: Joel Sherrill Owned by: Sebastian Huber
Priority: low Milestone: 5.1
Component: network/legacy Version: 5
Severity: normal Keywords:
Cc: Chris Johns, Gedare Blocked By:
Blocking:

Description

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 -DUSE_SVID main.c -lbsd -lm -lbsd

i386-rtems4.12-gcc -std=c99 \

-B${RTEMS_MAKEFILE_PATH}/lib -specs bsp_specs -qrtems \
-DUSE_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

======================

Change History (5)

comment:1 Changed on Dec 23, 2016 at 2:10:53 PM by Sebastian Huber

Priority: normallow

comment:2 Changed on Jan 23, 2017 at 7:34:47 AM by Sebastian Huber

I cannot reproduce this problem on the master.

comment:3 Changed on Jan 23, 2017 at 3:42:57 PM by Joel Sherrill

Resolution: worksforme
Status: newclosed

comment:4 Changed on May 11, 2017 at 7:31:02 AM by Sebastian Huber

Milestone: 4.124.12.0

comment:5 Changed on Nov 9, 2017 at 6:27:14 AM by Sebastian Huber

Milestone: 4.12.05.1

Milestone renamed

Note: See TracTickets for help on using tickets.