nicolas71640 opened a new issue, #11863:
URL: https://github.com/apache/nuttx/issues/11863

   I am trying to build my own app using the export target with the simulator. 
And I've run into few issues :
   To be clear, here's the procedure I following : 
    1. ./tools/configure.sh sim:nsh
    2. make export
    3. tar -xf nuttx-export-12.4.0.tar.gz
    4. My CMakeList.txt file : 
   ```
   cmake_minimum_required(VERSION 3.16)
   project(test)
   include(../nuttx-export-12.4.0/scripts/toolchain.cmake)
   add_executable(test main.c)
   ```
    5. cmake . && make and here's the output
    `ld: unrecognized option '-Wl,--gc-sections'`
   
   Indeed in the target.cmake of the export the LDFLAGS are : 
   `"-Wl,--gc-sections -Wl,-Ttext-segment=0x400000 
-Wl,-Map=/home/nuttxspace/nuttx/nuttx.map")`
   
   Which can not work because we passing the -Wl argument directly to the 
linker... First issue. 
   
   6. To go further, I have just modified the target.cmake, removing the -Wl 
before the arguments.
   Then the linker returns this error : 
   `ld: read in flex scanner failed`
   With some research, this error is a the way of the linker to say that it 
can't read some arguments. Some tests showed me that the -T{LINKER_SCRIPT} 
argument (toolchain.cmake) was the culprit. 
   Here's the line where we set the LINKER_SCRIPT variable : 
   `set(LINKER_SCRIPT ${NUTTX_PATH}/scripts/${LDNAME})`
   Problem, in the target.cmake the ${LDNAME} is empty: 
   `set(LDNAME              "")`
   The LDNAME variable is set in the Export.mk file :
   ```
   ifneq ($(ARCHSCRIPT),)
     LDPATH = $(call CONVERT_PATH,$(ARCHSCRIPT))
     LDNAME = ${notdir ${LDPATH}}
     LDDIR = ${dir ${LDPATH}}
   endif
   ```
   
   For now, I've stopped there the investigation, but I will go further in 
this. These errors make me think that the simulator export is bugged. What do 
you think ? Is it possible that it isn't really used and it is now outdated ? 
Or is there something I'm doing wrong ? 
   By the way, without the export, it works perfectly well (tested with nsh).
   ping @leducp 


-- 
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.apache.org

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

Reply via email to