DuaneSkelton opened a new pull request, #6860:
URL: https://github.com/apache/incubator-nuttx/pull/6860

   ## Summary
   Added a call to uname() from a c++ application and got a linker error for 
undefined reference to uname()
   ```bash
   LD: nuttx
   arm-none-eabi-ld: 
/home/local/KYMETA/dskelton/github-forks/nuttx/staging/libapps.a(helloxx_main.cxx.home.local.KYMETA.dskelton.github-forks.apps.examples.helloxx.o):
 in function `helloxx_main':
   helloxx_main.cxx:(.text.helloxx_main+0x42): undefined reference to 
`uname(utsname*)'
   make[1]: *** [Makefile:159: nuttx] Error 1
   make[1]: Leaving directory 
'/home/local/KYMETA/dskelton/github-forks/nuttx/arch/arm/src'
   make: *** [tools/Unix.mk:509: nuttx] Error 2
   ```
   
   Found that the uname() function was part of the libc.a generated by our 
project and investigated this header file and found that it was not set up to 
allow linkage from a c++ file. Also noticed that this was the only header in 
the include/sys folder with no extern C {} wrapper for function prototypes. 
   
   ## Impact
   Unable to call uname() from a c++ program
   
   ## Testing
   This change, when applied to our product code, compiled cleanly and the 
uname() API worked as expected.
   
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to