Sony Spresense SDK -VS code Extension - Invalid argument # include <arch/types.h> on fresh Build of HelloWorld - windows

Well as life tends to be frustrating, i have found yet another interesting bug in the great conglomerate of which makes up VS-Code and it's list of 'useful' extensions...
Back Story:
To begin - i purchased a new Sony - Spresense Main Board and Expansion Board for development and testing purposes. Everything arrived in great shape with the highest quality of product and packaging.
The First Step:
As with every micro-controller purchased, I always test every aspect offered with the device when it comes to programming. I used the well known Arduino ide to throw a few basic examples on the Spresense main board. They all flashed correctly, worked properly and i was happy to see the device works!
The Problem:
At this point i had gotten my fill of using the arduino ide... I decided to download the vscode extension , following the vscode setup guide provided by Sony Spresense Web Site.
I noted the "setup guide" was using out of date versions from the most up to date available versions.
I tried using the both older and most recent version with same issues.
Every step was followed perfectly and matches the setup guide to the T.
VsCode installs and loads the extension, workspace and workspace configuration properly.
I also followed the instruction for installing the MSYS2 on windows and verified it was working correctly
The All Stop Error:
Excited to see my first hello world printf statment cruise thru the serial terminal i began the project spresense application build.
The Makefile proceeds thru the steps checking directories and performing required duties.
Suddenly towards the end of the make build i get --- BUILD ERROR
make[3]: Entering directory '/c/msys64/home/Anon/spresense/sdk/apps/builtin'
In file included from C:/msys64/home/Anon/spresense/nuttx/include/sys/types.h:47:0,
from C:/msys64/home/Anon/spresense/nuttx/include/nuttx/lib/builtin.h:51,
from ./builtin_list.c:44:
C:/msys64/home/Anon/spresense/nuttx/include/stdint.h:49:12: fatal error: C:/msys64/home/Anon/spresense/nuttx/include/arch/types.h: Invalid argument
include <arch/types.h>
compilation terminated.
ERROR: arm-none-eabi-gcc failed: 1
command: arm-none-eabi-gcc -M -fno-builtin -mabi=aapcs -ffunction-sections -fdata-sections -Wall -Wstrict-prototypes -Wshadow -Wundef -g -Os -fno-strict-aliasing -fno-strength-reduce -fomit-frame-pointer -mcpu=cortex-m4 -mthumb -mfpu=fpv4-sp-d16 -mfloat-abi=hard -I. -isystem /c/msys64/home/Anon/spresense/nuttx/include -isystem /c/msys64/home/Anon/spresense/nuttx/../sdk/include -D__KERNEL__ -pipe -gdwarf-3 -I /c/msys64/home/Anon/spresense/sdk/apps/include ./builtin_list.c
make[3]: *** [/c/msys64/home/Anon/spresense/sdk/apps/Application.mk:209: .depend] Error 1
make[3]: Leaving directory '/c/msys64/home/Anon/spresense/sdk/apps/builtin'
The Make proceeds to throw 10 or so more errors of the same variety, all invalid argument..
I feel like this should be working... I mean with all the fan fair behind this product line one would think the basic setup guide and IDE should work out of the box...
I think i am figuring out why this product line is failing miserably in the public realm...
The Most Basic of Code
#include <sdk/config.h>
#include <stdio.h>
int myAppS_main(int argc, char *argv[])
{
printf("Hello Spresense!!!");
return 0;
}
I have spent a few days trying to make heads or tails of this but from what i can tell, Sony has a broken extension offered thru vscode.
I have to admit i am a bit stumped....
Developing under win10, may try using linux as this appears to be an issue with Win10 using MSYS2 terminal.

I did a same steps with my spresense board, lastweek.
But I did not face this problem...
And I interested of this.
So, if you provide more information, I will investigate it!
Does the file C:/msys64/home/Anon/spresense/nuttx/include/arch/types.h exist? And can you open the file?
What did you choice in SDK Config? (Nothing as default?) If you OK to provide a "sdk.config", could you share it in this page?
Did you use your spresense sdk (/c/msys64/home/Anon/spresense) for another things?(Build check, or configuration or etc...)
What is your MSYS2 version?
And I think, you might can recover your environment with next command, could you try it?
$ cd /c/msys64/home/Anon/spresense/sdk
$ make distclean

Well,
Thanks to #cmm for the confirmation on the build integrity.
I was able to install the dev stack on another windows 10 computer, without the latest feature update. Just to be sure that was not creating an issue.
In my great quest for knowledge, i feel i may have found a solution to my problem after researching this in great length.
What I could verify:
VS Code was fully updated
MSYS2 was properly installed and updated fully from terminal
VS Code extension version is 1.20 updated to current release
Terminal was set in VS Code to MSYS directory and accepted for changes
SDK configuration was default with no additional config options
Project folder location and SDK location are properly set in workspace config
Every step was completed as per the Getting Started with SDK guide described
What I Think Happened
...... Internet Security Program........
During the install of MSYS2 and Vs Code ext i was not paying close attention to the install process. I simply let it run as i went about my work. During this process unbeknownst to me a number of attempts were made and blocked by my firewall and internet security protocols.. I really cannot believe how stupid this whole issue might actually be...
It appears certain sub modules are fetched from different server locations. I checked my firewall logs and for some reason these connection attempts are flagged and blocked.
Always Watch Your INSTALL!!
After whitelisting the flagged connection attempts and full dev stack refresh/re install i was able to build past the issues that plagued me so intensively...
To anyone that encounters this issue, i believe the issue lies in the install process and ensuring proper connections to external servers during MSYS install.
I have to say... This one threw me for one heck of a loop.... :P

Related

CodeBlocks not finding wxWidgets

I'm on PopOS and installed wxWidgets via the terminal when I first got the error error: wx/wxprec.h: No such file or directory as said by the user "oBFusCATed". I did not manually compile from source.
wx-config --version outputs 3.0.5
wx-config --cxxflags outputs:
-I/usr/lib/x86_64-linux-gnu/wx/include/gtk3-unicode-3.0 -I/usr/include/wx-3.0 -D_FILE_OFFSET_BITS=64 -DWXUSINGDLL -D__WXGTK__ -pthread
wx-config --libs outputs:
-L/usr/lib/x86_64-linux-gnu -pthread -lwx_gtk3u_xrc-3.0 -lwx_gtk3u_html-3.0 -lwx_gtk3u_qa-3.0 -lwx_gtk3u_adv-3.0 -lwx_gtk3u_core-3.0 -lwx_baseu_xml-3.0 -lwx_baseu_net-3.0 -lwx_baseu-3.0
I created my project via the wizard and made sure I selected the same version (wxWidgets 3.0.x).
In the step that says "Please select your favorite GUI Builder to use.", I chose wxSmith and Frame based options.
In the next step, which prompts me to choose a compiler, I left it as it was (see image below).
In the next step, which prompts me to select the wxWidgets configuration I selected the following options:
Though, I also tried using the Use default wxWidgets configuration and without any Other Options selected.
And last, I clicked Finish.
In Code::Blocks I've added the `wx-config --cxxflags` and `wx-config --libs` (even two additional ones but with the full path which the commands above return in the terminal), as you can see in the image below.
In the Other compiler options, I have these two lines (which I did not add myself - must've been the wizard):
-Winvalid-pch
-include wx_pch.h
I even added the output of wx-config --cxxflags to Other resource compiler options.
I also added a Global Variable wx with this base path /usr/lib/x86_64-linux-gnu/wx (copy/pasted), as mentioned in step #7 here. If I put the name of the variable exactly as $(#wx), it appears as set___wx__ instead of just wx, as seen in some other instructions I've found here and on other forums/guides.
Interestingly enough, if I click the button on the right to navigate to it, there is no wx folder. Like, it's nowhere to be found. If I were to use my normal file manager, I can navigate to it (terminal works as well). Could this have something to do with it?
In the Linker Settings tab, I've added these two libraries:
At the end of it all, I still get the error mentioned at the beginning. If I were to comment out that line, I get the same error but for wx/app.h and wx/frame.h, which made me think that it's just not finding the wxWidgets, but I can't figure out why.
This is the first time I'm using C++/Code::Blocks/wxWidgets, so if you give me any instructions where I need to put stuff, please, try to be specific.
P.S. Many of the guides on how to set this up seem to be for Windows and the only one I found for Ubuntu (since PopOS is based on it) is this one. Where he even gets the same error, but his solution did not work (add the output of wx-config --cxxflags to Other resource compiler options - which I've already tried - though, he does build from source).
P.S.2. I found this setup build which uses the binary download option, but it's for Windows. Would something mess up if I were to attempt it?
P.S.3. I know a lot of people have similar issues, but the stuff I've already tried seem to have solved their problem and since for me it didn't, I figured I'd ask.
Son of a motherless goat >_<
The moment I ask, an idea popped into my head from another issue I had recently.
I had installed Code::Blocks via the PopShop (i.e. flatpak) and that flatpak had no access to the wx folder, which is why it wouldn't show up when trying to navigate to it via Code::Blocks.
I uninstalled it and installed it again via sudo apt install codeblocks. I created a new project via the wizard (it wouldn't let me select wxSmith because it doesn't seem to come with it - wxSmith plugin is not loaded can not continue) with the same wizard settings mentioned in my original post.
Then I only added the wx-config --cxxflags and wx-config --libs compiler flags and it built!
Darn it, Flatpak...
Anyway, for people that are interested in adding wxSmith plugin, the person in this video shows how.
Run sudo apt install codeblocks-contrib in your terminal and if you had Code::Blocks open, make sure to restart it - and perhaps give the dude a like if the video is still up! :3

How do I create projects on Xcode 7 using wxWidgets?

My specifications are up to date (OS X El Capitan, 10.11). Here are details on what I've tried so far.
I've followed the (Terminal) installation steps included in the wxWidgets download:
mkdir build-cocoa-debug
cd build-cocoa-debug
../configure --enable-debug
make
cd samples; make;cd ..
cd demos; make;cd ..
Then, I followed the wxWidgets wiki guide for creating Xcode projects.
Of course, there were plenty of compilation errors. After taking care of an incorrectly typed include, there were still issues. For the most part, they were undeclared identifiers and incomplete types, but my attention went to one in particular:
"No Target! You should use wx-config program for compilation flags!"
After researching, I believe I need to use wx-config to find what flags to input into the "Other Linker Flags" option in Xcode. However, I can't seem to utilize wx-config in Terminal.
I'm not sure if I'm dealing with the core issue. If I am, how do I use wx-config? And if I'm not, please steer me in the right direction.
Thank you.
*** EDIT: ***
I've used wx-config to find which flags I needed to input into "Other Linker Flags" and "Preprocessor Macros" in Xcode. This significantly reduced the amount of errors and warnings that I was facing.
Unfortunately, these new errors are esoteric to me:
Error/Warning Log
How do I remove these errors so I can run this project?
I'm finally able to compile and run wxWidgets programs using Xcode 7. I've found and followed this awesome guide (of which step 3 seems to now be irrelevant).
In case the link breaks, here is a summary of the steps that helped me:
* * * * * *
Open Terminal and install Homebrew by inputting:
ruby -e "$(curl -fsSkL raw.github.com/mxcl/homebrew/go)"
Then, input:
brew install wxmac
Open Xcode and create a Command Line Tool C++ project.
Back in Terminal, input:
wx-config --libs
Once inputted, copy everything outputted by the Terminal and place it into Other Linker Flags (found in Build Settings of your Xcode project).
At Terminal, input:
wx-config -–cxxflags
Again, copy everything outputted except this time place it into Other C++ Flags (do not erase what is currently in that section).
Then, of course don't forget to include wx/wx.h and don't forget to have at least an empty main function if you want it to run.
* * * * * *
I'm not at a place where I can create Cocoa projects/products, but that's totally fine. I simply wanted a canvas to familiarize myself with the wxWidgets library.
I hope this post will be helpful to others.
Arman,
First couple of questions:
What OS are you trying to compile?
What is your requirements for the minimal OSX version?
I presume you are trying to compile the latest Git HEAD. Please correct me if its not the case.
Now, couple of recommendations:
Try to run "../configure --help" and see at all the different options you can set.
Try to run "../configure --enable-debug --with-mac-osx-version-min=10.x --with-cocoa". This command has to be run after removing the build directory completely and pretending you are starting over.
Try to open the "minimal.xcode" project in the samples/minimnal directory, add the minimal.cpp file to it and compile. If it compiles and runs fine, then you made a mistake setting up the project of your own.
Let us know how it goes.

Could not configure a C compiler (Windows)

On a Windows system, currently I'm trying a waf configure on a directory of code, and it spits out the error "could not configure a C compiler."
Now, I'm 100% certain that I have gcc and g++ installed and in my path because when I type gcc --version, it gives me the current version information. (I'm using mingw and the gcc/g++ are in the /bin subdirectory).
In the author's code directory there is a wscript file which looks like
C_COMPILER = 'gcc-4.7'
CPLUSPLUS_COMPILER = 'g++-4.7'
Now, I have tried changing the strings to simply gcc as well as gcc-4.8.1 (since my current version is 4.8.1), but it still says could not configure compiler.
I tried reading one solution on this same site that looks related, but the solution was on ubuntu and trying to work through those commands didn't help
could not configure a c compiler
I'm at the end of my common sense here after making sure I have gcc and g++ installed, trying different strings in the wscript file trying to get it to recognize I have them installed, and could use some help, thanks.
Edit: I've now tried simply deleting the lines in the wscript file where it changes the compiler name, and suddenly waf configure goes through, but the waf build fails saying things like it can't find really basic things like include vector. The output says it's defaulting to msvs (microsoft visual studio) whereas the author says gcc/g++ is needed; maybe this is the issue but how do I get waf configure/build to use g++/gcc as default?

Why is the compilation of my (x86->64) windows cross compiler failing?

I'm trying to build a cross-compiler (x86->64) on my windows system, with the aim of targetting windows 64, however my software currently relies on open source libraries which also have open source dependencies for which there are no prebuilt binaries available with which I can compile. This means that if I want the 64 bit versions I need to compile them.
I've installed MSYS and mingw, I'm also in the process of adding mingw-w64 to the mix so that I can finally compile the libraries in 64 bit form for use with my software. I'm following the steps as closely as I can using these instructions and in the order listed on that page, I'm currently at the step titled "Building the GCC core cross-compiler(s)", but when I try to compile with the line:
$ ../gcc-4.6.1/configure --target=x86_64-w64-mingw32 --enable-targets=all && make -j 6 all-gcc && make -j 6 install-gcc
I get the output pasted here. I should note that I of course snipped the previously executed commands and that last command was the last one listed before all the errors were displayed. Also, I have no idea if it's the cause of all the errors due to the '-j 6' argument, but everything prior to it at least looked successful.
What's the problem and how can I fix it?
Oh, in anticipation of one potential suggestion; no I can't just switch to cygwin.
Edit: Okay after executing them individually, here's the output of the configure command, the output produced by make all-gcc (no -j argument), and config.log. Note, I didn't run a make clean beforehand which may explain the different ending, I didn't do it in the interest of time to write this update, but I suppose I'll just make a different compile folder and re-execute it cleanly to hopefully see the same error as before while I wait for a response.
Edit 2: The make all-gcc failed again as expected, this time the output should help a little more I hope.
Thanks very much for your help.
Your config.log shows that the build process will use the binaries in x86_64-w64-mingw32/bin for stuff like ar, as etc... These are for internal compiler use only, and they should all be available in your /mingw/bin directory. I would strongly suggest asking on the mingw-w64-public mailing list for help.

Getting MPFR to build on cygwin

I spent the whole day setting up GCC as per
http://cygwin.wikia.com/wiki/How_to_install_GCC_4.3.0
On the gcc make step, it told me it needed a c++ compiler to continue for whatever reason,
So I updated Cygwin in the usual fashion and got gcc-c++.
After that, cgywin did me the courtesy of deleting the 3 prereq libraries that I had installed previously,
So I went about remaking them. GMP worked fine, and then I got to MPFR. For whatever reason MPFR is throwing this error:
configure: error: libgmp not found or uses a different ABI.
The resources mention this error here.
I’m pretty sure its finding GMP alright as cygcheck shows it up no problem, and the config even mentions it finds it.
When I try:
./configure --with-gmp-build=/gmp/,
it throws:
error: header files gmp-impl.h and longlong.h not found
So far I have not been able to get MPFR working, despite googling and trying for hours.
MPC also fails to find GMP in the usual manner.
I've also tried just handing the libraries to GCC in a subdirectory and letting it compile them.
When I try that, it gets to the make step, then throws a stage1-bubble error and fails. No description of the error or anything.
I have no idea what else to try.
After compiling and installing gmp, I had the same problem building mpfr until I set correctly the library search path:
export LD_LIBRARY_PATH=/usr/local/lib
export LIBRARY_PATH=/usr/local/lib
export CPATH=/usr/local/include
as it is explained in the http://cygwin.wikia.com/wiki/How_to_install_GCC_4.3.0
Instead of this:
./configure --with-gmp-build=/gmp/
USE THIS:
./configure --with-gmp-build=/gmp
It doesn't like having the "/" at the end.
I know this post is a bit dated, but I was looking for an answer or results to a similar situation but with much more current versions of the same libraries. While reading this post as for some suggestions as well as other online material I was able to piece everything together. So for anyone who may be working with the newest releases here it goes:
First you will probably want to configure, make and install GMP first for both C and C++ as static libs; also make note of the architecture x86 or x64. Once you run make, make check, make install; and you are confidant that you have no errors, then when you go to configure MPFR you will want to run it as such:
./configure --with-gmp-build=/path/to/gmp --enable-static --disable-shared
and if the paths are set properly this should give you the needed generated make file.
I'm brand new to Unix-Posix environments and commands and new to Cygwin. I've mostly used Windows platforms and very few Macs or Apples. Matter of fact I've only been working at this for a little less than a week as I'm trying to do the same thing. So now I'm venturing into a whole new world of Unix... but it's sort of simulated through Cygwin as I'm still running windows.
I'm trying to build GMP, MPIR, MPFR & MPFRC++ all from the latest original distributions and eventually will try to integrate them into Visual Studio 2017.
I had actually found this post because I was able to build MPIR through visual studio with the help of python and vyasm, but as for GMP I needed Cygwin with GCC. It took me a little while to figure out how to get GMP to build properly but once I did and ran the tests I was able to have all pass with 0 failures. I then started to work with MPFR the same as you.
My similar issue was after I ran ./configure as default, it was giving me the message that the libgmp wasn't found. Also if I tried to call make, it would do nothing as the make file didn't exist. This led me back to doing google searches... While searching for tips, suggestions etc. I came across this Q/A. While I was reading this Q/A, the install files, some other FAQ and even another website, I was kind of able to piece everything together and what I have found that works is what I suggested above.
Not only do you need to set the flag --with-gmp-build but you also need to set the appropriate library types that gmp was built as and you need to make sure that the architecture types match too. They need to have the same matching ABIs.
Ah, just as I was about to finish up typing this answer, make check just finished running through Cygwin and I have a result of:
Testsuite summary for MPFR 4.0.1
============================================================================
# TOTAL: 180
# PASS: 180
# SKIP: 0
# XFAIL: 0
# FAIL: 0
# XPASS: 0
# ERROR: 0
============================================================================
I hope this helps you out. The only thing is for myself; I'll have to go back and probably run all of this again from the beginning including GMP only because I believe I only did GCC and not G++ and my next step is to try and build MPFRC++.
Then I might try to do some related libraries from here afterwards. My first phase is to try to build them all through Cygwin and GCC/G++. The next step will be to try and port them over to Visual Studio 2017.
You might want to use --with-gmp-lib=/path/to/gmp/lib/dir

Resources