I'm trying to get started with MSYS2.
First I was stuck with the symbolic link issue. I've seen the readme.txt section about Make.defs but I don't understand how and where to apply it, as this seems to be a hen-egg problem with the
tools/configure.sh <board-name>/<config-dir>
Then I tried to do a buildroot. Needed to add
1. Is MSYS supposed to work without the MSYS=winsymlinks:nativestrict hack?
2. How does one add the Make.defs DIRLINK DIRUNLINK exactly, so that tools/configure.sh works?
3. Do I really need to add the buildroot/build_arm_hf/staging_dir/bin to PATH manually even if I chose the correct option in make menuconfig?
4. is there a fix for the above error? (With or without the MSYS=winsymlinks:nativestrict)
tools/configure.sh -g <board-name>/<config-dir>
Markus@VANTAGE MSYS ~/nuttxspace/nuttx/tools
$ ./configure.sh –g nucleo-l496zg/nsh
<board/config> defined twice
USAGE: ./configure.sh [-d] [-l|m|c|u|g|n] [-a <app-dir>] <board-name>/<config-name>
Where:
-l selects the Linux (l) host environment.
-m selects the macOS (m) host environment.
-c selects the Windows host and Cygwin (c) environment.
-u selects the Windows host and Ubuntu under Windows 10 (u) environment.
-g selects the Windows host and MinGW/MSYS environment.
-n selects the Windows host and Windows native (n) environment.
Default: Use host setup in the defconfig file
Default Windows: Cygwin
<board-name> is the name of the board in the configs directory
<config-name> is the name of the board configuration sub-directory
<app-dir> is the path to the apps/ directory, relative to the nuttx
directory
Don't know enough about bash to understand why, the code in configure.sh seems correct to me(?)
However guessing it might help, I tried with the -g at the end
$ ./configure.sh nucleo-l496zg/nsh -g
Copy files
Select CONFIG_HOST_WINDOWS=y
Select CONFIG_WINDOWS_MSYS=y
Refreshing...
make: *** [tools/Makefile.unix:361: clean_context] Error 1
At the given line 361 it uses DIRUNLINK and therefore tools/unlink.sh
I tried to make distclean:
include/arch/board already exists but is not a symbolic link
make: *** [tools/Makefile.unix:361: clean_context] Error 1
So I looked at tools/unlink.sh doing step by step what it does, I found out that MSYS2 does not seem to create the .fakelnk marker.
Markus@VANTAGE MSYS ~/nuttxspace/nuttx
$ test -h include/arch/board
Markus@VANTAGE MSYS ~/nuttxspace/nuttx
$ echo $?
1
Markus@VANTAGE MSYS ~/nuttxspace/nuttx
$ test -d include/arch/board
Markus@VANTAGE MSYS ~/nuttxspace/nuttx
$ echo $?
0
Markus@VANTAGE MSYS ~/nuttxspace/nuttx
$ test -f include/arch/board/.fakelnk
Markus@VANTAGE MSYS ~/nuttxspace/nuttx
$ echo $?
1
So link.sh needs to add it. A google search later I saw that I am not the first one to stumble (because it only survived in the Google Cache, I created an archive link)
I fixed the syntax error discussed in the newsgroup post and now all seems to work. I can configure and build for the first time.
tools/link.sh | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/tools/link.sh b/tools/link.sh
index f14e9e5abb..d3672b771d 100755
--- a/tools/link.sh
+++ b/tools/link.sh
@@ -94,3 +94,11 @@ fi
ln -s "${src}" "${dest}" || \
{ echo "Failed to create link: $dest" ; exit 1 ; }
+
+# sebastien lorquet 20140528 for msys, ln will not create a symlink, but a copy
+# so fake the link instead
+os=`shell uname -o`
+if [ "x${os}" == "xMsys" ]; then
+ touch ${dest}/.fakelnk
+fi
+
Do you need a pull request?
_Mark
However guessing it might help, I tried with the -g at the end
$ ./configure.sh nucleo-l496zg/nsh -g
Copy files
Select CONFIG_HOST_WINDOWS=y
Select CONFIG_WINDOWS_MSYS=y
Refreshing...
make: *** [tools/Makefile.unix:361: clean_context] Error 1
Tried as you suggested:tools/configure.sh -g <board-name>/<config-dir>Markus@VANTAGE MSYS ~/nuttxspace/nuttx/tools
$ ./configure.sh –g nucleo-l496zg/nsh
<board/config> defined twice
include/arch/board already exists but is not a symbolic link
make: *** [tools/Makefile.unix:361: clean_context] Error 1
Markus@VANTAGE MSYS ~/nuttxspace
$ mv nuttx nuttx.bak
Markus@VANTAGE MSYS ~/nuttxspace
$ git clone https://bitbucket.org/nuttx/nuttx
Cloning into 'nuttx'...
remote: Counting objects: 375710, done.
remote: Compressing objects: 16% (13201/82505)
remote: Compressing objects: 100% (82505/82505), done.
fsReceiving objects: 8% (30057/375710), 5.25 MiB | 1.74 MiB/s
remote: Total 375710 (delta 292905), reused 355348 (delta 277815)
Receiving objects: 100% (375710/375710), 89.03 MiB | 3.12 MiB/s, done.
Resolving deltas: 100% (292905/292905), done.
Checking out files: 100% (10068/10068), done.
Markus@VANTAGE MSYS ~/nuttxspace
$ cd nuttx
Markus@VANTAGE MSYS ~/nuttxspace/nuttx
$ ls Make.defs
ls: cannot access 'Make.defs': No such file or directory
Markus@VANTAGE MSYS ~/nuttxspace/nuttx
$ git clean -fXd
Removing .config
Removing Make.defs
Removing arch/arm/src/board/
Removing configs/dummy/Kconfig
Removing include/arch/
Markus@VANTAGE MSYS ~/nuttxspace/nuttx
$ echo " DIRLINK = /home/Markus/nuttxspace/nuttx/tools/copydir.sh" > Make.defs
Markus@VANTAGE MSYS ~/nuttxspace/nuttx
$ tools/configure.sh nucleo-l496zg/nsh -g
Copy files
Select CONFIG_HOST_WINDOWS=y
Select CONFIG_WINDOWS_MSYS=y
Refreshing...
make[2]: board: Command not found
make[2]: *** [Makefile:119: board] Error 127
make[1]: *** [Makefile:115: dirlinks] Error 2
make: *** [tools/Makefile.unix:335: dirlinks] Error 2
I committed a change to link.sh based on your recommendation that resolves this. I did not check for uname -o == Msys, instead I added a check after the 'ln'. If a directory was created instead of a symbolic link, then the .fakelnk was added. Should be the same thing, but independent of environment.,
The problem is that Make.defs is not yet there when configuring. And if I add it later, it is too late, the (faulty) links have already been made.