Euphoria
Ticket #724:
Most options don't work inside specified configuration files
-
Reported by
SDPringle
Nov 14, 2011
Parameters in *specified* configuration files are not affecting the behavior of the front end.
Easiest way to see this is to run "configure --plat LINUX" under WIndows or "configure --plat WINDOWS" under something other than Windows. Then issue this command:
make source
Do a search for Windows in main-.c and you will only find it if you are currently using windows. If you are using Windows and you followed the instructions, you specified Linux. So, Windows.h shouldn't be there but it will. However if you are using Linux and you followed these instructions, then you specified Windows and the line should be there but it wont be.
You will be to see OS specific features for your current platform in the sources and you will not be able to compile the sources when you attempt to compile on the new platform because the sources will be for your current platform.
However, you can hard code -plat into the Makefile itself ( or type all parameters at the command line for translation ) and you will get sources that wil work fine for the target platform.
Details
1. Comment by mattlewis
Nov 14, 2011
I don't see anything here that implies that it isn't reading the config file. In fact, I tested this by adding a print statement in pathopen.e:add_include_directory(). Then, I created a config file called shawn.cfg:
-i some/random/directory
Then, from my source directory, I ran:
$ eui ec.ex -c shawn.cfg shawn.cfg
Adding: /home/matt/eu/oe/source/some/random/directory/
Adding: /home/matt/eu/oe/include/
Adding: /usr/local/share/euphoria/include/
Adding: /home/matt/eu/
Build directory: build-205802/
/home/matt/eu/oe/source/shawn.cfg:1
<0117>:: Not expecting to see ''-'' here
-i some/random/directory
^
As you can see, it clearly read the config file that I specified. The more obvious conclusion is that the plat switch does not affect the line endings of translated files. Indeed, I found the following:
$ grep -n open c_decl.e
1130: c_code = open(output_dir & name & ".c", "w")
So, we're opening the files in regular text mode, which results in CRLF line endings on Windows.
I've marked this ticket as invalid, since the -c option works.
2. Comment by SDPringle
Nov 14, 2011
It is not only the Translator. It is any EUPHORIA program built with a recent 4.0.4 development or 4.1 development version:
cat > cmd.e
sequence cmd = command_line()
if find("-c",cmd) != 0 then
puts(1,"-c is present.\n")
else
puts(1,"-c is not detected.\n")
end if
3. Comment by SDPringle
Nov 14, 2011
Excellent, I will now move '-nobuild' to the eu.cfg from the explicit command line passing for 4.0.
4. Comment by mattlewis
Nov 15, 2011
I still don't see any evidence that config files aren't being read. Re-marking as invalid.
5. Comment by SDPringle
Nov 15, 2011
Here is your evidence:
C:\Users\Shawn\Documents\development\hg\4.0\source>..\bin\eui.exe ..\tests\cmd.e -c foo
-c is not detected.
C:\Users\Shawn\Documents\development\hg\4.0\source>..\bin\eui.exe -v
Euphoria Interpreter v4.0.4 development
Windows, Using System Memory
Revision Date: 2011-10-30 03:35:46, Id: 5209:b82a0de10af8
I will bookmark this for when your build stops working.
6. Comment by mattlewis
Nov 15, 2011
OK, so the problem isn't that -c doesn't work, because it does. The problem is that we're too aggressive in pulling out commands that occur only before the file to run or translate. For instance:
$ eui cmd.e -c
-c is present.
$ eui cmd.e -c foo
-c is not detected.
And, BTW, my build already doesn't work, but it's not because of this issue.
7. Comment by mattlewis
Nov 15, 2011
Closing this ticket, and opening new ticket:725 with the actual issue found here.
8. Comment by SDPringle
Nov 17, 2011
If it is reading the config file the options are later being discarded if they are ever counted. Please follow the command line session below. This was done on a MINGW command line.
> $ configure --plat FREEBSD --build build-freebsd
> Writing eu.cfg to c:/Users/Shawn/Documents/development/hg/4.0/source/build-freeb
> sd/eu.cfg
> $ make source
> mkdir -p c:/Users/Shawn/Documents/development/hg/4.0/source/build-freebsd/intobj
> /back/ c:/Users/Shawn/Documents/development/hg/4.0/source/build-freebsd/transobj
> /back/ c:/Users/Shawn/Documents/development/hg/4.0/source/build-freebsd/libobj/b
> ack/ c:/Users/Shawn/Documents/development/hg/4.0/source/build-freebsd/libobjdbg
> c:/Users/Shawn/Documents/development/hg/4.0/source/build-freebsd/libobjdbg/back/
> c:/Users/Shawn/Documents/development/hg/4.0/source/build-freebsd/backobj/back/
> c:/Users/Shawn/Documents/development/hg/4.0/source/build-freebsd/intobj/ c:/User
> s/Shawn/Documents/development/hg/4.0/source/build-freebsd/transobj/ c:/Users/Sha
> wn/Documents/development/hg/4.0/source/build-freebsd/libobj/ c:/Users/Shawn/Docu
> ments/development/hg/4.0/source/build-freebsd/backobj/ c:/Users/Shawn/Documents/
> development/hg/4.0/source/build-freebsd/include/
> make euisource OBJDIR=intobj EBSD= CONFIG=config.gnu EDEBUG= EPROFILE=
...
much later
> $ cd build-freebsd
>
> Shawn@Joy-PC /c/Users/
> $ cd intobj
> $ grep Windows main-.c
> #include <Windows.h>
> /** version_name = "Windows"*/
note:
$ build/eui.exe -v
Euphoria Interpreter v4.0.4 development
Windows, Using System Memory
Revision Date: 2011-11-15 16:36:10, Id: 5242:0b55602b9d41
If I modify the Makefile and hard code '-plat LINUX' in the translation line:
$ make clean source
.. much omitted
> (cd c:/Users/Shawn/Documents/development/hg/4.0/source/build-freebsd/intobj;/c/U
> sers/Shawn/Documents/development/hg/4.0/source/build/eui.exe -i c:/Users/Shawn/D
> ocuments/development/hg/4.0/include c:/Users/Shawn/Documents/development/hg/4.0
> /source/ec.ex -plat LINUX -nobuild \
> -c c:/Users/Shawn/Documents/development/hg/4.0/source/build-free
> bsd/eu.cfg c:/Users/Shawn/Documents/development/hg/4.0/source/int.ex )
No complaint about two -plat options. After the translation of the translator begins and in another Ming Window:
> $ cd source/build-freebsd
>
> $ grep Windows intobj/main-.c
> $
However:
$ ./build/eui.exe ../tests/cmd.e
-c is not detected.
Shawn@Joy-PC /c/Users/Shawn/Documents/develop
$ ./build/eui.exe ../tests/cmd.e -c
-c is present.
Shawn@Joy-PC /c/Users/Shawn/Documents/develop
$ ./build/eui.exe ../tests/cmd.e -c foo
-c is present.
Okay ticket 725 is fixed...
Source listing of cmd.e:
> sequence cmd = command_line()
>
> if find("-c",cmd) != 0 then
> puts(1,"-c is present.\n")
> else
> puts(1,"-c is not detected.\n")
> end if
9. Comment by mattlewis
Nov 17, 2011
That was really rambling. I haven't tried cross compiling on Windows at all, but I also haven't noticed these problems when cross comiling on Linux, which I do a lot.
10. Comment by SDPringle
Nov 21, 2011
Specified configuration files are not overriding default searched configuration files.
On Linux, make a '.eu.cfg' file in your home directory with the contents:
[translate]
-plat WINDOWS
Create another file called build.cfg in the tests directory:
[translate]
-plat FREEBSD
Then from the tests directory run the following:
euc -con -c build.cfg -nobuild -build-dir bd t_stats.e
Then issue (careful with the case of 'Windows')
grep Windows bd/main-.c
You will see an include line for Windows.h.
Now, remove /.eu.cfg and repeat the translation command, the #include Windows line is gone, but although we specified FREEBSD in build.cfg, you will see there are ifdef LINUX comments in the C code.
11. Comment by SDPringle
Nov 21, 2011
Renaming this for including directories from inside named configuration works.
12. Comment by SDPringle
Nov 21, 2011
I have a solution. Testing.
13. Comment by mattlewis
Nov 21, 2011
I still believe that this ticket is mistaking symptoms for the cause. I believe that my fix for ticket:725 was incorrect. It scans the command line incorrectly. I believe that we also need to add merging logic to expand_config_options().
14. Comment by mattlewis
Nov 21, 2011
The real problem is reading and merging command line options. See ticket:725.
15. Comment by jimcbrown
Nov 21, 2011
If this is the case then we should open
ticket:725
again, as the issue is not fixed there.
16. Comment by mattlewis
Nov 21, 2011
It should be fixed now in 725. Unfortunately, I committed before writing the entire commit message. I need to update it to put in a link to the additional changeset where the new fix is applied.
17. Comment by SDPringle
Nov 21, 2011
This is not fixed. Stop marking this as invalid.
18. Comment by mattlewis
Nov 22, 2011
Your test works now that ticket:725 is fixed.
19. Comment by SDPringle
Nov 22, 2011
See: hg:euphoria/rev/87f8e1084f0b
changeset: 5266:87f8e1084f0b branch: 4.0 tag: tip parent: 5264:b1e3058ac542 user: Shawn Pringle <shawn.pringle@gmail.com> date: Tue Nov 22 15:05:50 2011 -0300 files: tests/definenum.cfg tests/runnum.ex tests/t_eucfg.e description:
- ticket 724/725 : tests for eu cfg file