Sysprogs forums › Forums › VisualGDB › Use "–defsym" in LDFLAGS
- This topic has 11 replies, 2 voices, and was last updated 8 years ago by support.
-
AuthorPosts
-
June 15, 2016 at 10:07 #8424christoph.pParticipant
Hi!
I’m trying to insert a timestamp in my linker Call. I modified the call to
But the check says:
i586-poky-linux-gcc.exe: error: +%s`: No such file or directory
How to define the symbol with the date?
Thx!
- This topic was modified 8 years, 5 months ago by christoph.p.
- This topic was modified 8 years, 5 months ago by christoph.p.
- This topic was modified 8 years, 5 months ago by christoph.p.
- This topic was modified 8 years, 5 months ago by christoph.p.
June 15, 2016 at 16:20 #8434supportKeymasterIf you are building on Windows, please install MinGW/msys to use the Unix-style commands like ‘date’ and then specify the absolute path to the ‘date.exe’ from the msys directory so that it’s not confused with the Windows ‘date’ command.
June 16, 2016 at 09:25 #8440christoph.pParticipantOk. I’ve check the command in the windows commandline with
C:\date.exe +%s
which outputs
1466065030
But I don’t know how to specify the LDFLAGS line…
I tried
- -Wl,-gc-sections,–defsym,TIMESTAMP=$(C:\date.exe +%s)
- -Wl,-gc-sections,–defsym,TIMESTAMP=
C:\date.exe +%s
- -Wl,-gc-sections,–defsym,TIMESTAMP=$(“C:\date.exe” +%s)
- -Wl,-gc-sections,–defsym,TIMESTAMP=$(“C:\date.exe +%s”)
But nothing worked. I always get
- collect2.exe: error: ld returned 1 exit status
- i586-poky-linux-gcc.exe: error: +%s): No such file or directory
- i586-poky-linux-gcc.exe: error: +%s`: No such file or directory
June 17, 2016 at 21:25 #8448supportKeymasterHi,
Please try this syntax:
$(shell C:/date.exe +%s)
June 20, 2016 at 15:26 #8461christoph.pParticipantReturns:
[…]
i586-poky-linux-gcc.exe: error: +%s): No such file or directoryJune 20, 2016 at 17:15 #8463supportKeymasterHi,
OK, please try the following Makefile from the command line:
test: gcc -DTIMESTAMP=$(shell C:/mingw/msys/1.0/bin/date.exe +%s) -E test.c -o test.E
You can use it with the following test.c file:
int timestamp = TIMESTAMP;
If this does not work, please let us know the error you get with this simple file. If it does, please compare the syntax here with your Makefile.
June 21, 2016 at 11:10 #8465christoph.pParticipantThat gives me:
i586-poky-linux-gcc.exe: error: +%s): No such file or directory
June 21, 2016 at 18:32 #8470supportKeymasterLooks like you are still trying to use your Makefile with i586-poky-linux-gcc.exe.
In order to isolate the problem please try using the minimal Makefile we provided (with the normal GCC from the MinGW toolchain and make.exe from MinGW as well). If it works, please try explicitly using the make.exe from the MinGW toolchain instead of make.exe from the i586-poky-linux toolchain.
September 13, 2016 at 10:32 #9048christoph.pParticipantSorry I’m a little bit overwhelmed. Which paramters in the Config of the makefile do I have to change and how?</span></span>
- This reply was modified 8 years, 2 months ago by christoph.p.
September 13, 2016 at 19:29 #9053supportKeymasterPlease start with trying this Makefile literally:
test: <TAB>gcc -DTIMESTAMP=$(shell C:/mingw/msys/1.0/bin/date.exe +%s) -E test.c -o test.E
If it works, with your make.exe, please compare the syntax in it with your Makefile that is broken. If it does not, please download a clean MinGW toolchain from here and try using make.exe and mingw-make.exe from it.
November 18, 2016 at 11:21 #9537christoph.pParticipantI have created a bat file in windows with the following command:
C:\Intel\iotdk-ide-win\devkit-x86\sysroots\x86_64-pokysdk-mingw32\usr\libexec\i586-poky-linux\gcc\i586-poky-linux\4.9.1\gcc.exe -DTIMESTAMP=$(shell C:/mingw/msys/1.0/bin/date.exe +%s) -E helloworld.c -o test.E
This gives me also the error:
>C:\Intel\iotdk-ide-win\devkit-x86\sysroots\x86_64-pokysdk-mingw32\usr\libexec\i586-poky-linux\gcc\i586-poky-linux\4.9.1\gcc.exe -DTIMESTAMP=$(shell C:/mingw/msys/1.0/bin/date.exe +s) -E helloworld.c -o test.E
gcc.exe: error: +s): No such file or directoryI think something with the part “$(shell C:/mingw/msys/1.0/bin/date.exe +s)” doesn’t work in Windows.
Any hints?
November 19, 2016 at 05:01 #9538supportKeymasterHi,
The “$(shell)” expansion is specific to GNU Make. I.e. if you just put it into a .bat file, Windows won’t expand it, however if you put it into a Makefile as shown in the previous post and run make.exe from your toolchain, it should get substituted properly.
-
AuthorPosts
- You must be logged in to reply to this topic.