Author Topic: Linux compilation  (Read 21713 times)

Offline gwiezdnik

  • Newbie
  • *
  • Posts: 8
    • View Profile
Linux compilation
« on: July 23, 2009, 10:52:49 PM »
Hi...

I back from vacations and I plan to tire You once again.

At start - easy question I think.

Before I use CodeSourcery and Yagarto on Windows - and I don't have problems with compiling.

But now, I use Linux, and... could You tell me how can I compile uTasker?

Few hours I spent to find why 'make' gives me error. After that few hours I saw backslashes everywhere. I change \ to / in makefile, but then I saw many backslashes in C files, in include statements. And I don't know what to do with this :/

How, how I can do make all???

Greetings,
Damian

Offline mark

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 3243
    • View Profile
    • uTasker
Re: Linux compilation
« Reply #1 on: July 24, 2009, 04:49:28 PM »
Hi Damian

I believe that the make file can use back slashes or forward slashes in paths, however this may be make file dependent (eg. depending on shich compiler chain is being used).

In the case of C-files this is another issue and I wouldn't expect this to be a problem - every compiler should work the same.

In addition, whether the tool chain is running under Windows or under Linux should it "should" work the same.

I personally don't work under Linux (apart from a few experiments now and again) so don't have much experience with real development work using it. Maybe someone else can lend a hand?

Regards

Mark

Offline gwiezdnik

  • Newbie
  • *
  • Posts: 8
    • View Profile
Re: Linux compilation
« Reply #2 on: July 25, 2009, 01:39:24 PM »
Bad news :(

Look at this:

ISO/IEC 9899:TC2

http://www.open-std.org/JTC1/SC22/WG14/www/docs/n1124.pdf

Point 6.4.7.3:

Quote
If the characters ', \, ", //, or /* occur in the sequence between the < and > delimiters, the behavior is undefined. Similarly, if the characters ', \, //, or /* occur in the sequence between the " delimiters, the behavior is undefined.69) A header name preprocessing token is recognized only within a #include preprocessing directive.

Now I will try to change \ to / in sources, but I think that would be great if all sources will be modified for the others. In "free time" :)

Damian


Offline mark

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 3243
    • View Profile
    • uTasker
Re: Linux compilation
« Reply #3 on: July 25, 2009, 03:27:04 PM »
Hi Damian

If I understand correctly, includes such as the following are causing problems:

#include "..\..\stack\tcpip.h"

When compiling under Linux they need to be written differently? Such as

#include "../../stack/tcpip.h"

There are in fact not many such includes within the project (mostly in config.h) so you could try making thsi conditional:

#if defined _LINUX_BUILD
    #include "../../stack/tcpip.h"
#else
    #include "..\..\stack\tcpip.h"
#endif


However I am not sure whether this is a general issue. In the extract from the document there is reference to < and > delimiters, but these are not being used in these includes.

Could you see whether you can really cure the problem by changing such syntax?

Regards

Mark


Offline gwiezdnik

  • Newbie
  • *
  • Posts: 8
    • View Profile
Re: Linux compilation
« Reply #4 on: July 25, 2009, 04:18:04 PM »
Hi Mark!

I don't put this conditional syntax, but simply change \ to / and I have another problems:

1) In:
* Applications/uTaskerBoot/types.h
* Applications/uTaskerBoot/config.h
* Applications/uTaskerV1.3/types.h
* Applications/uTaskerV1.3/config.h

i have found "hardware" with first lower letter, but on file system You put this directory with first upper letter. I have changed it.

2) In sources I have found "watchdog.c" with again - with first lower letter. I have change it everywhere to first upper letter and it's looks like ok!

Compilation successful, now I try this conditional syntax for You.

Damian

Offline gwiezdnik

  • Newbie
  • *
  • Posts: 8
    • View Profile
Re: Linux compilation
« Reply #5 on: July 25, 2009, 04:29:34 PM »
And of course this conditional syntax works (if You of course define earlier _LINUX_BUILD).

But I think that if ISO says, that between < > and  "" we should use / instead of \, it's better to replace this back slashes. In conditional syntax You have to earlier another configure point and everyone should do this before compilation.

Ok, now I will check this my first problem with uTasker. I hope that will be ok.

Damian

Offline mark

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 3243
    • View Profile
    • uTasker
Re: Linux compilation
« Reply #6 on: July 25, 2009, 04:32:08 PM »
Hi Damian

I know that Linux tends to be case sensitive for file names but Windows doesn't.

The lower-case/upper-case correction in the names are however useful - I didn't realise this before.

I will also try changing the use of slashes - it Windows is tolerant it will then also help on a Linux box. Thanks.

Regards

Mark


Offline mark

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 3243
    • View Profile
    • uTasker
Re: Linux compilation
« Reply #7 on: July 25, 2009, 04:54:17 PM »
Hi Damian

I have changed all uses of \ to / in my projects. The only place where Windows didn't like this was at
STRCPY(cPort, "\\\\.\\COM"); in fnConfigureSerialInterface() in WinSimMain.cpp.

Here it is preparing the COM port to be opened when simulating UARTS. It needed to be left as it was otherwise it failed - the rest seems OK so this modification will be ready for future versions.

Regards

Mark