building GNUstep from scratch

classic Classic list List threaded Threaded
9 messages Options
Reply | Threaded
Open this post in threaded view
|

building GNUstep from scratch

Scott Christley
Hello All,

It's awhile since I've built GNUstep from scratch, and I'm having trouble with my initial attempts, so I hope somebody can give me some pointers. I only need to get as far as gnustep-base for my code to work. Some quick background:

* I'm working on a supercomputer which has quite old software and I have little control over it, so I'm going to use docker (and singularity) to get to a somewhat modern level OS.

* I'm also using the Nvidia GPUs on the supercomputer which means I need to use Nvidia's docker image as the base. This image is based upon Ubuntu 14.04, so not too bad. GCC 4.8.4 is available on it.

I played around with ngrewe's GNUstep docker images and they are quite nice, but there is no way to "merge" those with the Nvidia image. I also tried using apt-get to install GNUstep, but the release is too old. My own code didn't compile as I'm using more recent APIs and classes.

I installed a bunch of dependencies which was fine, including libdispatch and libblockruntime which are hope are not too old. Next, I installed clang 6.0.1 binaries, then tried to compile libobjc2 1.8.1 which is where I've run into trouble. I'm following the basic install instructions:

mkdir Build
cd Build
cmake ..
make

and it is failing with error:


[ 30%] Building C object Test/CMakeFiles/ManyManySelectors_optimised.dir/ManyManySelectors.m.o

cc: error: unrecognized command line option '-fobjc-runtime=gnustep-1.7'

cc: error: unrecognized command line option '-fblocks'

make[2]: *** [Test/CMakeFiles/ManyManySelectors_optimised.dir/ManyManySelectors.m.o] Error 1

make[1]: *** [Test/CMakeFiles/ManyManySelectors_optimised.dir/all] Error 2

make: *** [all] Error 2


Any help is appreciated.

thanks
Scott


_______________________________________________
Discuss-gnustep mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/discuss-gnustep
Reply | Threaded
Open this post in threaded view
|

Re: building GNUstep from scratch

Ivan Vučica
Are you sure it’s actually using Clang? Try "make VERBOSE=1” according to https://stackoverflow.com/a/2673355

On 21 August 2018 at 19:30:40, Scott Christley ([hidden email]) wrote:

Hello All,

It's awhile since I've built GNUstep from scratch, and I'm having trouble with my initial attempts, so I hope somebody can give me some pointers. I only need to get as far as gnustep-base for my code to work. Some quick background:

* I'm working on a supercomputer which has quite old software and I have little control over it, so I'm going to use docker (and singularity) to get to a somewhat modern level OS.

* I'm also using the Nvidia GPUs on the supercomputer which means I need to use Nvidia's docker image as the base. This image is based upon Ubuntu 14.04, so not too bad. GCC 4.8.4 is available on it.

I played around with ngrewe's GNUstep docker images and they are quite nice, but there is no way to "merge" those with the Nvidia image. I also tried using apt-get to install GNUstep, but the release is too old. My own code didn't compile as I'm using more recent APIs and classes.

I installed a bunch of dependencies which was fine, including libdispatch and libblockruntime which are hope are not too old. Next, I installed clang 6.0.1 binaries, then tried to compile libobjc2 1.8.1 which is where I've run into trouble. I'm following the basic install instructions:

mkdir Build
cd Build
cmake ..
make

and it is failing with error:


[ 30%] Building C object Test/CMakeFiles/ManyManySelectors_optimised.dir/ManyManySelectors.m.o

cc: error: unrecognized command line option '-fobjc-runtime=gnustep-1.7'

cc: error: unrecognized command line option '-fblocks'

make[2]: *** [Test/CMakeFiles/ManyManySelectors_optimised.dir/ManyManySelectors.m.o] Error 1

make[1]: *** [Test/CMakeFiles/ManyManySelectors_optimised.dir/all] Error 2

make: *** [all] Error 2


Any help is appreciated.

thanks
Scott

_______________________________________________
Discuss-gnustep mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/discuss-gnustep

_______________________________________________
Discuss-gnustep mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/discuss-gnustep
Reply | Threaded
Open this post in threaded view
|

Re: building GNUstep from scratch

Scott Christley
In reply to this post by Scott Christley
No, it isn't using clang when compiling libobjc2. It is calling /usr/bin/cc which is pointing to gcc. I'll figure out how to get that to point to clang and give it another try.

thanks!
Scott

On Aug 21, 2018, at 02:43 PM, Ivan Vučica <[hidden email]> wrote:

Are you sure it’s actually using Clang? Try "make VERBOSE=1” according to https://stackoverflow.com/a/2673355

On 21 August 2018 at 19:30:40, Scott Christley ([hidden email]) wrote:


Hello All,

It's awhile since I've built GNUstep from scratch, and I'm having trouble with my initial attempts, so I hope somebody can give me some pointers. I only need to get as far as gnustep-base for my code to work. Some quick background:

* I'm working on a supercomputer which has quite old software and I have little control over it, so I'm going to use docker (and singularity) to get to a somewhat modern level OS.

* I'm also using the Nvidia GPUs on the supercomputer which means I need to use Nvidia's docker image as the base. This image is based upon Ubuntu 14.04, so not too bad. GCC 4.8.4 is available on it.

I played around with ngrewe's GNUstep docker images and they are quite nice, but there is no way to "merge" those with the Nvidia image. I also tried using apt-get to install GNUstep, but the release is too old. My own code didn't compile as I'm using more recent APIs and classes.

I installed a bunch of dependencies which was fine, including libdispatch and libblockruntime which are hope are not too old. Next, I installed clang 6.0.1 binaries, then tried to compile libobjc2 1.8.1 which is where I've run into trouble. I'm following the basic install instructions:

mkdir Build
cd Build
cmake ..
make

and it is failing with error:


[ 30%] Building C object Test/CMakeFiles/ManyManySelectors_optimised.dir/ManyManySelectors.m.o

cc: error: unrecognized command line option '-fobjc-runtime=gnustep-1.7'

cc: error: unrecognized command line option '-fblocks'

make[2]: *** [Test/CMakeFiles/ManyManySelectors_optimised.dir/ManyManySelectors.m.o] Error 1

make[1]: *** [Test/CMakeFiles/ManyManySelectors_optimised.dir/all] Error 2

make: *** [all] Error 2


Any help is appreciated.

thanks
Scott

_______________________________________________
Discuss-gnustep mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/discuss-gnustep

_______________________________________________
Discuss-gnustep mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/discuss-gnustep
Reply | Threaded
Open this post in threaded view
|

Re: building GNUstep from scratch

Riccardo Mottola-5
In reply to this post by Scott Christley

Hi,


On 21/08/2018 21:29, Scott Christley wrote:
I installed a bunch of dependencies which was fine, including libdispatch and libblockruntime which are hope are not too old. Next, I installed clang 6.0.1 binaries, then tried to compile libobjc2 1.8.1 which is where I've run into trouble. I'm following the basic install instructions:

mkdir Build
cd Build
cmake ..
make

and it is failing with error:


[ 30%] Building C object Test/CMakeFiles/ManyManySelectors_optimised.dir/ManyManySelectors.m.o

cc: error: unrecognized command line option '-fobjc-runtime=gnustep-1.7'

cc: error: unrecognized command line option '-fblocks'

make[2]: *** [Test/CMakeFiles/ManyManySelectors_optimised.dir/ManyManySelectors.m.o] Error 1

make[1]: *** [Test/CMakeFiles/ManyManySelectors_optimised.dir/all] Error 2

make: *** [all] Error 2



Do you actually need the "modern" runtime or do you just need current APIs. In case, just stick with GCC.
If you wish libobjc2, then compile everything with clang (and reconfigure/build also gnustep make and base afterwards).

I am having some difficulties with libobjc2 lately, for others it is fine. If you can, get the latest gnustep-make and configure with --library-combo=ng-gnu-gnu and it should be smooth. Richard recently fixed some stuff there.

Riccardo

_______________________________________________
Discuss-gnustep mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/discuss-gnustep
Reply | Threaded
Open this post in threaded view
|

Re: building GNUstep from scratch

Scott Christley
In reply to this post by Scott Christley
Thanks Riccardo, after awhile I had the same thought. I tried using GCC and everything seemed to go well, though I haven't tried my code yet but will soon.

Honestly, I'm not sure if I need the modern runtime or not. I do use NSInvocation stuff quite a bit but I don't think this code base needs the runtime introspection stuff...

I did get further and was able to compile libobjc2 completely after setting cc and c++ to clang. However, two tests failed so maybe that's the recent difficulties you were mentioning.

The following tests FAILED:

25 - PropertyIntrospectionTest2 (OTHER_FAULT)

26 - PropertyIntrospectionTest2_optimised (OTHER_FAULT)


thanks
Scott

On Aug 21, 2018, at 04:46 PM, Riccardo Mottola <[hidden email]> wrote:


Do you actually need the "modern" runtime or do you just need current APIs. In case, just stick with GCC.
If you wish libobjc2, then compile everything with clang (and reconfigure/build also gnustep make and base afterwards).

I am having some difficulties with libobjc2 lately, for others it is fine. If you can, get the latest gnustep-make and configure with --library-combo=ng-gnu-gnu and it should be smooth. Richard recently fixed some stuff there.

Riccardo

_______________________________________________
Discuss-gnustep mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/discuss-gnustep
Reply | Threaded
Open this post in threaded view
|

Re: building GNUstep from scratch

Ivan Vučica
In reply to this post by Scott Christley
For reference, this is one way to do it:
cmake .. -DCMAKE_CXX_COMPILER=clang -DCMAKE_C_COMPILER=clang

Though it should, I think, default to clang if installed.
On Tue, Aug 21, 2018 at 9:24 PM Scott Christley <[hidden email]> wrote:

>
> No, it isn't using clang when compiling libobjc2. It is calling /usr/bin/cc which is pointing to gcc. I'll figure out how to get that to point to clang and give it another try.
>
> thanks!
> Scott
>
> On Aug 21, 2018, at 02:43 PM, Ivan Vučica <[hidden email]> wrote:
>
> Are you sure it’s actually using Clang? Try "make VERBOSE=1” according to https://stackoverflow.com/a/2673355
>
> On 21 August 2018 at 19:30:40, Scott Christley ([hidden email]) wrote:
>
>
> Hello All,
>
> It's awhile since I've built GNUstep from scratch, and I'm having trouble with my initial attempts, so I hope somebody can give me some pointers. I only need to get as far as gnustep-base for my code to work. Some quick background:
>
> * I'm working on a supercomputer which has quite old software and I have little control over it, so I'm going to use docker (and singularity) to get to a somewhat modern level OS.
>
> * I'm also using the Nvidia GPUs on the supercomputer which means I need to use Nvidia's docker image as the base. This image is based upon Ubuntu 14.04, so not too bad. GCC 4.8.4 is available on it.
>
> I played around with ngrewe's GNUstep docker images and they are quite nice, but there is no way to "merge" those with the Nvidia image. I also tried using apt-get to install GNUstep, but the release is too old. My own code didn't compile as I'm using more recent APIs and classes.
>
> I installed a bunch of dependencies which was fine, including libdispatch and libblockruntime which are hope are not too old. Next, I installed clang 6.0.1 binaries, then tried to compile libobjc2 1.8.1 which is where I've run into trouble. I'm following the basic install instructions:
>
> mkdir Build
> cd Build
> cmake ..
> make
>
> and it is failing with error:
>
>
> [ 30%] Building C object Test/CMakeFiles/ManyManySelectors_optimised.dir/ManyManySelectors.m.o
>
> cc: error: unrecognized command line option '-fobjc-runtime=gnustep-1.7'
>
> cc: error: unrecognized command line option '-fblocks'
>
> make[2]: *** [Test/CMakeFiles/ManyManySelectors_optimised.dir/ManyManySelectors.m.o] Error 1
>
> make[1]: *** [Test/CMakeFiles/ManyManySelectors_optimised.dir/all] Error 2
>
> make: *** [all] Error 2
>
>
> Any help is appreciated.
>
> thanks
> Scott
>
> _______________________________________________
> Discuss-gnustep mailing list
> [hidden email]
> https://lists.gnu.org/mailman/listinfo/discuss-gnustep

_______________________________________________
Discuss-gnustep mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/discuss-gnustep
Reply | Threaded
Open this post in threaded view
|

Re: building GNUstep from scratch

Riccardo Mottola-5
In reply to this post by Scott Christley

Hi,


On 08/22/18 00:34, Scott Christley wrote:
Honestly, I'm not sure if I need the modern runtime or not. I do use NSInvocation stuff quite a bit but I don't think this code base needs the runtime introspection stuff...

you need he modern runtime if you need modern features like blocks. Also properties are better supported.
The modern runtime gives you also the modern @try @catch exception handling.

Performance wise it may be better or worse, depending on your code. If your code "compiles" with gcc, it should also run - barren bugs.

In theory libobjc2 supports both "gnu" and "ng" runtimes and did so for a long time, but latest release are buggy for me, either they crash the code or they fail to catch exceptions


I did get further and was able to compile libobjc2 completely after setting cc and c++ to clang. However, two tests failed so maybe that's the recent difficulties you were mentioning.

The following tests FAILED:

25 - PropertyIntrospectionTest2 (OTHER_FAULT)

26 - PropertyIntrospectionTest2_optimised (OTHER_FAULT)


No that's different, I hope others will help you or maybe David himself.

Riccardo

_______________________________________________
Discuss-gnustep mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/discuss-gnustep
Reply | Threaded
Open this post in threaded view
|

Re: building GNUstep from scratch

Andreas Fink-2
I had good success with libojbc/clang under debian9 (stretch). I wouldn't want to go back to gcc due to non support of certain stuff I use every day (the stuff which apple introduced in what they called objc2.0). Part is working in recent gcc's though but I like clangs error reporting and better support for objc.

For clang, the debian shipped clang 3.8 was long my standard compiler. With newer versions of clang and latest libobjc2 I've run into an incompatibility with very weird side effects.
I had cases where something like this:


-(void)somemethod
{
_intProperty = 123;
NSLog(@"%d", _intProperty);


was printing out a value of 0 instead of 123, and of course this makes very strange things much later in your code.

According to David Chisnall this is fixed in clang after r339128 and was due to how the compiler aligns structs/object properties in memory (compilers tend to optimize this in some way and all compilers used for individual parts have to use the same optimisation to come to the same order which wasn't the case if I understood correctly).


this is how I build the latest clang8 from source



This takes quite some time and lots of memory. If you forget -DCMAKE_BUILD_TYPE=Release you end up with 32 gigabytes of RAM not being sufficient (constantly swapping) and compile times of hours to days. On 32bit machines its even worse due to the 4GB memory limit.

Then I install gnustep like this:

Setting some defaults
------------------------------------------------


    export CC=clang
    export CXX=clang++
    export PATH=/usr/local/bin:$PATH
    export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig/


Download the sourcecode of gnustep and dependencies
---------------------------------------------------

    
    mkdir gnustep
    cd gnustep
    ./scripts/install-dependencies

Build dependencies
---------------------------------------------------

    tar -xvzf libiconv-1.15.tar.gz
    cd libiconv-1.15
    ./configure
    make CFLAGS=-g
    make CFLAGS=-g install
    cd ..

    cd swift-corelibs-libdispatch
    mkdir build
    cd build
    cmake .. -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ -DCMAKE_CXX_FLAGS=-g -DCMAKE_C_FLAGS=-g
    make
    make install
    

Install gnustep-make
---------------------------------------------------

    cd make
    export CC=/usr/bin/clang
    export CXX=/usr/bin/clang++
    export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig/
    export OBJCFLAGS="-DEXPOSE_classname_IVARS=1"
    ./configure --with-layout=fhs \
            --disable-importing-config-file \
            --enable-native-objc-exceptions \
            --enable-objc-arc \
            --enable-install-ld-so-conf \
            --with-library-combo=ng-gnu-gnu
     make install
     source /usr/local/etc/GNUstep/GNUstep.conf
     cd ..
     

Install libobjc2 runtime
---------------------------------------------------

    cd libobjc2
    mkdir Build
    cd Build
    cmake .. -DBUILD_STATIC_LIBOBJC=1  -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ -DCMAKE_CXX_FLAGS=-g -DCMAKE_C_FLAGS=-g
    make
    make install
    cd ..
    ldconfig


install gnustep-base
---------------------------------------------------

    cd base
    ./configure CFLAGS="-DEXPOSE_classname_IVARS=1 -g " --with-config-file=/usr/local/etc/GNUstep/GNUstep.conf --disable-libdispatch

    make -j8
    make install
    cd ../..
    ldconfig

(for debug version use "make debug=yes" instead of "make")


and then the other gnustep libraries with simple ./configure; make;make install


On 22 Aug 2018, at 06:47, Riccardo Mottola <[hidden email]> wrote:

Hi,


On 08/22/18 00:34, Scott Christley wrote:
Honestly, I'm not sure if I need the modern runtime or not. I do use NSInvocation stuff quite a bit but I don't think this code base needs the runtime introspection stuff...

you need he modern runtime if you need modern features like blocks. Also properties are better supported.
The modern runtime gives you also the modern @try @catch exception handling.

Performance wise it may be better or worse, depending on your code. If your code "compiles" with gcc, it should also run - barren bugs.

In theory libobjc2 supports both "gnu" and "ng" runtimes and did so for a long time, but latest release are buggy for me, either they crash the code or they fail to catch exceptions


I did get further and was able to compile libobjc2 completely after setting cc and c++ to clang. However, two tests failed so maybe that's the recent difficulties you were mentioning.

The following tests FAILED:
25 - PropertyIntrospectionTest2 (OTHER_FAULT)
26 - PropertyIntrospectionTest2_optimised (OTHER_FAULT)

No that's different, I hope others will help you or maybe David himself.

Riccardo
_______________________________________________
Discuss-gnustep mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/discuss-gnustep


_______________________________________________
Discuss-gnustep mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/discuss-gnustep
Reply | Threaded
Open this post in threaded view
|

Re: building GNUstep from scratch

David Chisnall-7
On 22 Aug 2018, at 11:07, Andreas Fink <[hidden email]> wrote:

>
> git clone https://git.llvm.org/git/llvm.git/
> cd llvm/tools
> git clone https://git.llvm.org/git/clang.git/
> cd ../projects
> git clone https://git.llvm.org/git/compiler-rt.git/
> git clone https://git.llvm.org/git/openmp.git/
> git clone https://git.llvm.org/git/libcxx.git/
> git clone https://git.llvm.org/git/libcxxabi.git/
> git clone https://git.llvm.org/git/test-suite.git/
> cmake .. -DCMAKE_BUILD_TYPE=Release
> make -j8 install
>
>
> This takes quite some time and lots of memory. If you forget -DCMAKE_BUILD_TYPE=Release you end up with 32 gigabytes of RAM not being sufficient (constantly swapping) and compile times of hours to days. On 32bit machines its even worse due to the 4GB memory limit.

The only bits of this that you need are llvm and clang.  There is no point building any of the other bits, because you won’t be using them.  If you really want to build them, then it’s a good idea to:

1) Use Ninja, not Make (-G Ninja to cmake, ninja instead of make -j8 for the build)
2) Set the maximum number of link jobs to something small (I forget the exact flag for this.  Run ccmake . and find it in the GUI)
3) Use lld as the linker (uses vastly less RAM than GNU BFD ld, not tried Gold)

That said, if you’re on Debian then you can just go to apt.llvm.org and download the latest nightly build, or wait until 7.0 is released and then use that.

David


_______________________________________________
Discuss-gnustep mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/discuss-gnustep