Ecere SDK/eC Forums • View topic - Compiling Ecere on Alpine Linux (musl libc)




Ecere SDK/eC Forums

Ecere Developers Community

Compiling Ecere on Alpine Linux (musl libc)

General help: new users, installing the Ecere SDK, using the IDE to compile and run applications.

Compiling Ecere on Alpine Linux (musl libc)

Postby sjps » Mon Feb 27, 2017 3:14 pm

Hi all,

I am trying to compile Ecere against musl-libc on Alpine linux.

Firstly I run into the following error:

Bootstrapping eC compiling tools...
Building ecere...
Building ec...
Building ecp...
Building ecc...
Building ecs...
All done!
Building 2nd stage ecere...

../compiler/bootstrap/obj/bin.linux/ecc -fmessage-length=0 -DECERE_NOSSL -cpp gcc -module ecere -nolinenumbers -defaultns ecere -I/usr/include/freetype2 -O2 -ffast-math -fPIC -w -DBUILDING_ECERE_COM -Isrc/gfx/drivers/gl3/ -Isrc/gfx/drivers/harfbuzz -I/usr/X11R6/include -I/usr/X11R6/include/freetype2 -fvisibility=hidden -c src/sys/EARArchive.ec -o obj/release.linux/EARArchive.c -symbols obj/release.linux/

/usr/include/unistd.h:92:11: error: syntax error

/usr/include/unistd.h:92:
_Noreturn void _exit(int);

/usr/include/features.h:32:
#if __STDC_VERSION__ >= 201112L
#elif defined(__GNUC__)
#define _Noreturn __attribute__((__noreturn__))
#else
#define _Noreturn
#endif


If I change that (which is not something I want to do):
void _exit(int);

Then it gets past that problem.


The next one then is:
../compiler/bootstrap/obj/bin.linux/ecc -fmessage-length=0 -DECERE_NOSSL -cpp gcc -module ecere -nolinenumbers -defaultns ecere -I/usr/include/freetype2 -O2 -ffast-math -fPIC -w -DBUILDING_ECERE_COM -Isrc/gfx/drivers/gl3/ -Isrc/gfx/drivers/harfbuzz -I/usr/X11R6/include -I/usr/X11R6/include/freetype2 -fvisibility=hidden -c src/gfx/bitmaps/GIFFormat.ec -o obj/release.linux/GIFFormat.c -symbols obj/release.linux/
/usr/include/bits/alltypes.h:71:30: error: syntax error

/usr/include/bits/alltype,h:71:
typedef struct { _Alignas(8) long long __ll; long double __ld; } max_align_t;

I don't know how to get past this.


Regards
Paul
It seems that ecc has issues with some underscores, but I am not sure exactly what the cause is.
sjps
 
Posts: 10
Joined: Sun Feb 26, 2017 10:22 am

Re: Compiling Ecere on Alpine Linux (musl libc)

Postby jerome » Mon Feb 27, 2017 4:58 pm

Hi Paul,

I've ran into problems with _Noreturn before, I believe that's the cause of the first error.

Is features.h which is defining it properly included before it hits that line in unistd.h?

You can confirm that _Noreturn is the issue by doing a:
#undef _Noreturn
#define _Noreturn

either directly in the system header or in the file including it.

If '#define _Noreturn' doesn't give you a re-definition warning then it might not be defined.

As for the latter error, my guess would be on '_Alignas(8)' causing the error.

Is _Alignas defined as a macro? If so, what is it defined to?

Would you be able to link me up to a tarball of all the system headers or alternatively a distro image that I could install in a VM and try out when I have chance?

Any help figuring out the specifics is much welcome and will likely help us to provide a fix sooner. Thank you.

Best regards,

-Jerome
jerome
Site Admin
 
Posts: 615
Joined: Sat Jan 16, 2010 11:16 pm

Re: Compiling Ecere on Alpine Linux (musl libc)

Postby sjps » Tue Feb 28, 2017 4:45 am

Hi Jerome,

Yes, features.h is being included from unistd.h

You can get the musl tar bal with all the headers here:
https://www.musl-libc.org/download.html

Alpine Linux can be found here: https://alpinelinux.org/downloads/

I can send you login details to a machine via email if that would help ?

Regards
Paul
sjps
 
Posts: 10
Joined: Sun Feb 26, 2017 10:22 am

Re: Compiling Ecere on Alpine Linux (musl libc)

Postby jerome » Tue Feb 28, 2017 6:55 am

Yes that would be much helpful! Thank you.
jerome
Site Admin
 
Posts: 615
Joined: Sat Jan 16, 2010 11:16 pm

Re: Compiling Ecere on Alpine Linux (musl libc)

Postby sjps » Tue Feb 28, 2017 8:35 am

Hi Jerome,

I have send you the details and thank you so much for looking at this.

I am really impressed with ecere. The apps that have been written with Ecere is amazing.
To write something like the ide is testament at how powerful eC/Ecere is.

It is a pity that eC/Ecere doesnt have a bigger following. I suspect its because the documentation is a bit incomplete.

I read the Tao and it was a very nice refresher on plain C and easy to understand.
Pity that the meat of eC/Ecere is still missing from it.

I still have many questions, but will ask them one by one in other posts.
sjps
 
Posts: 10
Joined: Sun Feb 26, 2017 10:22 am

Re: Compiling Ecere on Alpine Linux (musl libc)

Postby sjps » Wed Mar 01, 2017 2:15 pm

I managed to get ecere complled on Alpine against musl libc.
I am not sure what the performance implication is of not having the correct alignment.

The changes I needed was the following:

In /usr/include/features.h
#if __STDC_VERSION__ >= 201112L
#define _Noreturn <---- Added this
#elif defined(__GNUC__)
//#define _Noreturn __attribute__((__noreturn__))
#else
//#define _Noreturn
#endif


In /usr/include/bits/alltypes.h
typedef struct { alignas(8) long long __ll; long double __ld; } max_align_t;
to
typedef struct { long long __ll; long double __ld; } max_align_t;

Made the following symlink as I dont know what the proper way is to let ecere now that its not in the default path
ln -s /usr/lib/libffi-3.2.1/include/ffi.h /usr/include
ln -s /usr/lib/libffi-3.2.1/include/ffitarget.h /usr/include
sjps
 
Posts: 10
Joined: Sun Feb 26, 2017 10:22 am

Re: Compiling Ecere on Alpine Linux (musl libc)

Postby jerome » Sat Mar 04, 2017 1:49 am

Hi Paul,

Glad to know you managed to compile libecere against musl libc!

For the _Noreturn thing, in libecere eC source files I currently have a lot of

#define _Noreturn all over the place...

I'm not sure why __STDC_VERSION__ would not be defined when preprocessing eC source files?

For the alignment thing, it would seem that alignas(8) is a new way to specify alignment, that perhaps is now defined as a new compiler feature rather than __attribute__ as it was done before?

You should be able to write a define like so if there is not one defined:

#define alignas(x) __attribute__((aligned(x)))

These must all be new C language features that eC is not aware of (eC was actually defined as a superset of C89, but we do our best to catch up with features found in system headers that prevent modern C headers from being included).

In any case I imagine neither of these problems are specific to musl libc and we will likely encounter those issues again so we would like to get to the bottom of it eventually. If you think this warrants further action from us at this time, please file an issue on our Mantis bug tracker ( http://ecere.org/mantis ). But am I correct that you have things working / usable for now?

Regarding the ffi headers, ffi include paths seem to vary wildly from one distribution to another, surely partly because they are architecture specific. The symlink way is surely the easiest thing to do. The other way you could build the Ecere tarball would be by tweaking the 'default.cf' file and adding a:
CFLAGS += -I/usr/lib/libffi-3.2.1/include/

As you can imagine that's not a very standard path that we could include by default, especially with a version number in there. I suggest you look with your distribution as to where the FFI headers should be installed. Ecere does not use pkginfo to query installation paths however as we feel this is an overly complicated process and an unneeded tool to rely on, so hopefully there's a simpler / more standard path for where libffi resides.

I apologize again for the late reply. I'm glad you enjoyed the Tao, and thank you for all your kind appreciation of the SDK. I think the essential notions of the eC languages are still well explained in the Tao, though it's certainly dated and I hope to find time to improve / complete the work at some point. As for guidance on using the Ecere API, the samples are the best resource, and asking questions on our #ecere IRC channel on FreeNode or the forums here. We also have started to document the API Reference (F1 in the IDE) and hope to improve on that in the months to come. Hopefully one day I can complete the book with all the intended sections!

Best regards,

-Jerome
jerome
Site Admin
 
Posts: 615
Joined: Sat Jan 16, 2010 11:16 pm


Return to General Help

Who is online

Users browsing this forum: No registered users and 1 guest

cron