jsoftware / jsource

J engine source mirror
Other
645 stars 91 forks source link

Compiling libj runs into problem with gcc -W switches #119

Closed brickviking closed 2 years ago

brickviking commented 2 years ago

I thought I'd compile J, but while I can compile jconsole fine, I ran into a problem when trying to compile libj. I did manage to compile some files, but I'll include some pertinent information here:

    ~ $ uname -a
Linux mymachine.my-host.nowhere 5.0.16-100.fc28.x86_64 #1 SMP Tue May 14 18:22:28 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux
    ~ $ cd src/c/hosts/github/jsoftware/jsource/make2

make2 $ gcc --version
gcc (GCC) 8.3.1 20190223 (Red Hat 8.3.1-2)
Copyright (C) 2018 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

make2$ git --no-pager branch
* master

make2$ git describe --tags
j903-beta-v-actual-9-geb680592

make2$ ls obj/linux/j64avx
ab.o
aes-c.o
aes-sse2.o
af.o
ai.o
a.o
jconsole.o
jeload.o
linenoise.o
makefile-jconsole
makefile-jnative
makefile-libj
makefile-tsdll
tsdll.o

make2$ ./build_libj.sh

======= build_libj.sh output =======
entering /home/viking/src/c/hosts/github/jsoftware/jsource/make2
CC=cc
compiler=/usr/bin/gcc
CFLAGS= -fPIC -O2 -fvisibility=hidden -fno-strict-aliasing -fno-stack-protector   -Werror -Wextra  -Wno-cast-function-type  -Wno-clobbered  -Wno-empty-body  -Wno-format-overflow  -Wno-implicit-fallthrough  -Wno-int-to-pointer-cast  -Wno-maybe-uninitialized  -Wno-missing-field-initializers  -Wno-parentheses  -Wno-pointer-sign  -Wno-shift-negative-value  -Wno-sign-compare  -Wno-type-limits  -Wno-uninitialized  -Wno-unused-parameter  -Wno-unused-value  -DSLEEF=1 -DEMU_AVX=1 -DC_AVX=1 
cc -c -o am.o ../../../../jsrc/am.c  -fPIC -O2 -fvisibility=hidden -fno-strict-aliasing -fno-stack-protector   -Werror -Wextra  -Wno-cast-function-type  -Wno-clobbered  -Wno-empty-body  -Wno-format-overflow  -Wno-implicit-fallthrough  -Wno-int-to-pointer-cast  -Wno-maybe-uninitialized  -Wno-missing-field-initializers  -Wno-parentheses  -Wno-pointer-sign  -Wno-shift-negative-value  -Wno-sign-compare  -Wno-type-limits  -Wno-uninitialized  -Wno-unused-parameter  -Wno-unused-value  -DSLEEF=1 -DEMU_AVX=1 -DC_AVX=1   -mavx      
../../../../jsrc/am.c: In function 'jtmerge2':
../../../../jsrc/am.c:291:54: error: cast from pointer to integer of different size [-Werror=pointer-to-int-cast]
  case (4+CTTZI(sizeof(t)))*8+0: ((t*)base)[scan0[0]]=(t)av; case (4+CTTZI(sizeof(t)))*8+1: ((t*)base)[scan0[1]]=(t)av;  /* copy cells */ \
                                                      ^
../../../../jsrc/am.c:315:52: note: in expansion of macro 'CP1n'
    CP11(B) break; CP11(US) break; CP11(UI4) break; CP1n(B) break; CP1n(US) break; CP1n(UI4) break;
                                                    ^~~~
../../../../jsrc/am.c:291:113: error: cast from pointer to integer of different size [-Werror=pointer-to-int-cast]
  case (4+CTTZI(sizeof(t)))*8+0: ((t*)base)[scan0[0]]=(t)av; case (4+CTTZI(sizeof(t)))*8+1: ((t*)base)[scan0[1]]=(t)av;  /* copy cells */ \
                                                                                                                 ^
../../../../jsrc/am.c:315:52: note: in expansion of macro 'CP1n'
    CP11(B) break; CP11(US) break; CP11(UI4) break; CP1n(B) break; CP1n(US) break; CP1n(UI4) break;
                                                    ^~~~
../../../../jsrc/am.c:292:54: error: cast from pointer to integer of different size [-Werror=pointer-to-int-cast]
  case (4+CTTZI(sizeof(t)))*8+2: ((t*)base)[scan0[2]]=(t)av; case (4+CTTZI(sizeof(t)))*8+3: ((t*)base)[scan0[3]]=(t)av; \
                                                      ^
../../../../jsrc/am.c:315:52: note: in expansion of macro 'CP1n'
    CP11(B) break; CP11(US) break; CP11(UI4) break; CP1n(B) break; CP1n(US) break; CP1n(UI4) break;
                                                    ^~~~
../../../../jsrc/am.c:292:113: error: cast from pointer to integer of different size [-Werror=pointer-to-int-cast]
  case (4+CTTZI(sizeof(t)))*8+2: ((t*)base)[scan0[2]]=(t)av; case (4+CTTZI(sizeof(t)))*8+3: ((t*)base)[scan0[3]]=(t)av; \
                                                                                                                 ^
../../../../jsrc/am.c:315:52: note: in expansion of macro 'CP1n'
    CP11(B) break; CP11(US) break; CP11(UI4) break; CP1n(B) break; CP1n(US) break; CP1n(UI4) break;
                                                    ^~~~
../../../../jsrc/am.c:291:54: error: cast from pointer to integer of different size [-Werror=pointer-to-int-cast]
  case (4+CTTZI(sizeof(t)))*8+0: ((t*)base)[scan0[0]]=(t)av; case (4+CTTZI(sizeof(t)))*8+1: ((t*)base)[scan0[1]]=(t)av;  /* copy cells */ \
                                                      ^
../../../../jsrc/am.c:315:67: note: in expansion of macro 'CP1n'
    CP11(B) break; CP11(US) break; CP11(UI4) break; CP1n(B) break; CP1n(US) break; CP1n(UI4) break;
                                                                   ^~~~
../../../../jsrc/am.c:291:113: error: cast from pointer to integer of different size [-Werror=pointer-to-int-cast]
  case (4+CTTZI(sizeof(t)))*8+0: ((t*)base)[scan0[0]]=(t)av; case (4+CTTZI(sizeof(t)))*8+1: ((t*)base)[scan0[1]]=(t)av;  /* copy cells */ \
                                                                                                                 ^
../../../../jsrc/am.c:315:67: note: in expansion of macro 'CP1n'
    CP11(B) break; CP11(US) break; CP11(UI4) break; CP1n(B) break; CP1n(US) break; CP1n(UI4) break;
                                                                   ^~~~
../../../../jsrc/am.c:292:54: error: cast from pointer to integer of different size [-Werror=pointer-to-int-cast]
  case (4+CTTZI(sizeof(t)))*8+2: ((t*)base)[scan0[2]]=(t)av; case (4+CTTZI(sizeof(t)))*8+3: ((t*)base)[scan0[3]]=(t)av; \
                                                      ^
../../../../jsrc/am.c:315:67: note: in expansion of macro 'CP1n'
    CP11(B) break; CP11(US) break; CP11(UI4) break; CP1n(B) break; CP1n(US) break; CP1n(UI4) break;
                                                                   ^~~~
../../../../jsrc/am.c:292:113: error: cast from pointer to integer of different size [-Werror=pointer-to-int-cast]
  case (4+CTTZI(sizeof(t)))*8+2: ((t*)base)[scan0[2]]=(t)av; case (4+CTTZI(sizeof(t)))*8+3: ((t*)base)[scan0[3]]=(t)av; \
                                                                                                                 ^
../../../../jsrc/am.c:315:67: note: in expansion of macro 'CP1n'
    CP11(B) break; CP11(US) break; CP11(UI4) break; CP1n(B) break; CP1n(US) break; CP1n(UI4) break;
                                                                   ^~~~
../../../../jsrc/am.c:291:54: error: cast from pointer to integer of different size [-Werror=pointer-to-int-cast]
  case (4+CTTZI(sizeof(t)))*8+0: ((t*)base)[scan0[0]]=(t)av; case (4+CTTZI(sizeof(t)))*8+1: ((t*)base)[scan0[1]]=(t)av;  /* copy cells */ \
                                                      ^
../../../../jsrc/am.c:315:83: note: in expansion of macro 'CP1n'
    CP11(B) break; CP11(US) break; CP11(UI4) break; CP1n(B) break; CP1n(US) break; CP1n(UI4) break;
                                                                                   ^~~~
../../../../jsrc/am.c:291:113: error: cast from pointer to integer of different size [-Werror=pointer-to-int-cast]
  case (4+CTTZI(sizeof(t)))*8+0: ((t*)base)[scan0[0]]=(t)av; case (4+CTTZI(sizeof(t)))*8+1: ((t*)base)[scan0[1]]=(t)av;  /* copy cells */ \
                                                                                                                 ^
../../../../jsrc/am.c:315:83: note: in expansion of macro 'CP1n'
    CP11(B) break; CP11(US) break; CP11(UI4) break; CP1n(B) break; CP1n(US) break; CP1n(UI4) break;
                                                                                   ^~~~
../../../../jsrc/am.c:292:54: error: cast from pointer to integer of different size [-Werror=pointer-to-int-cast]
  case (4+CTTZI(sizeof(t)))*8+2: ((t*)base)[scan0[2]]=(t)av; case (4+CTTZI(sizeof(t)))*8+3: ((t*)base)[scan0[3]]=(t)av; \
                                                      ^
../../../../jsrc/am.c:315:83: note: in expansion of macro 'CP1n'
    CP11(B) break; CP11(US) break; CP11(UI4) break; CP1n(B) break; CP1n(US) break; CP1n(UI4) break;
                                                                                   ^~~~
../../../../jsrc/am.c:292:113: error: cast from pointer to integer of different size [-Werror=pointer-to-int-cast]
  case (4+CTTZI(sizeof(t)))*8+2: ((t*)base)[scan0[2]]=(t)av; case (4+CTTZI(sizeof(t)))*8+3: ((t*)base)[scan0[3]]=(t)av; \
                                                                                                                 ^
../../../../jsrc/am.c:315:83: note: in expansion of macro 'CP1n'
    CP11(B) break; CP11(US) break; CP11(UI4) break; CP1n(B) break; CP1n(US) break; CP1n(UI4) break;
                                                                                   ^~~~
cc1: all warnings being treated as errors
make: *** [makefile-libj:167: am.o] Error 1
/home/viking/src/c/hosts/github/jsoftware/jsource/make2

So, where do I go from here? I'm not really a good programmer, so I'm lost as to where to start. I rather hope I haven't flooded you with information, but it's all the info I thought might have been relevant, except for memory/cpu/hard drive space etc.

Hopefully, brickviking

bilam commented 2 years ago

fixed. please try again.

brickviking commented 2 years ago

Thank you. I'm left with another error, I'll get that into here in a mo.

======= build_libj.sh output =======
entering /home/viking/src/c/hosts/github/jsoftware/jsource/make2
CC=cc
compiler=/usr/bin/gcc
CFLAGS= -fPIC -O2 -fvisibility=hidden -fno-strict-aliasing -fno-stack-protector   -Werror -Wextra -Wno-unknown-warning-option  -Wno-cast-function-type  -Wno-clobbered  -Wno-empty-body  -Wno-format-overflow  -Wno-implicit-fallthrough  -Wno-int-to-pointer-cast  -Wno-maybe-uninitialized  -Wno-missing-field-initializers  -Wno-overflow  -Wno-parentheses  -Wno-pointer-sign  -Wno-pointer-to-int-cast  -Wno-shift-count-overflow  -Wno-shift-negative-value  -Wno-sign-compare  -Wno-type-limits  -Wno-uninitialized  -Wno-unused-parameter  -Wno-unused-value  -DSLEEF=1 -DEMU_AVX=1 -DC_AVX=1 
cc -c -o vcat.o ../../../../jsrc/vcat.c  -fPIC -O2 -fvisibility=hidden -fno-strict-aliasing -fno-stack-protector   -Werror -Wextra -Wno-unknown-warning-option  -Wno-cast-function-type  -Wno-clobbered  -Wno-empty-body  -Wno-format-overflow  -Wno-implicit-fallthrough  -Wno-int-to-pointer-cast  -Wno-maybe-uninitialized  -Wno-missing-field-initializers  -Wno-overflow  -Wno-parentheses  -Wno-pointer-sign  -Wno-pointer-to-int-cast  -Wno-shift-count-overflow  -Wno-shift-negative-value  -Wno-sign-compare  -Wno-type-limits  -Wno-uninitialized  -Wno-unused-parameter  -Wno-unused-value  -DSLEEF=1 -DEMU_AVX=1 -DC_AVX=1   -mavx      
In file included from /usr/lib/gcc/x86_64-redhat-linux/8/include/immintrin.h:43,
                 from ../../../../jsrc/j.h:78,
                 from ../../../../jsrc/vcat.c:6:
../../../../jsrc/avx2intrin-emu.h: In function '__emu_mm256_permute4x64_epi64':
/usr/lib/gcc/x86_64-redhat-linux/8/include/avx2intrin.h:1049:1: error: inlining failed in call to always_inline '_mm256_permute4x64_pd': target specific option mismatch
 _mm256_permute4x64_pd (__m256d __X, const int __M)
 ^~~~~~~~~~~~~~~~~~~~~
In file included from ../../../../jsrc/j.h:91,
                 from ../../../../jsrc/vcat.c:6:
../../../../jsrc/avx2intrin-emu.h:303:11: note: called from here
    return _mm256_castpd_si256(_mm256_permute4x64_pd(_mm256_castsi256_pd(a),control));
           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/lib/gcc/x86_64-redhat-linux/8/include/immintrin.h:43,
                 from ../../../../jsrc/j.h:78,
                 from ../../../../jsrc/vcat.c:6:
/usr/lib/gcc/x86_64-redhat-linux/8/include/avx2intrin.h:1049:1: error: inlining failed in call to always_inline '_mm256_permute4x64_pd': target specific option mismatch
 _mm256_permute4x64_pd (__m256d __X, const int __M)
 ^~~~~~~~~~~~~~~~~~~~~
In file included from ../../../../jsrc/j.h:91,
                 from ../../../../jsrc/vcat.c:6:
../../../../jsrc/avx2intrin-emu.h:303:11: note: called from here
    return _mm256_castpd_si256(_mm256_permute4x64_pd(_mm256_castsi256_pd(a),control));
           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../../../../jsrc/vcat.c: At top level:
cc1: error: unrecognized command line option '-Wno-unknown-warning-option' [-Werror]
cc1: all warnings being treated as errors
make: *** [makefile-libj:167: vcat.o] Error 1
/home/viking/src/c/hosts/github/jsoftware/jsource/make2

Hope this will be the last one, as I'm not sure what switch I'd have needed to "cure" this problem.

bilam commented 2 years ago

I have fixed this, and will update when I have fixed other bugs for j64x=j64 with gcc.

brickviking commented 2 years ago

Okay, thanks for the time you're spending with this. I know roughly how to run the compiler, but I've never quite figured out all the -W and -f switches, usually I have configure/make along for the ride.

bilam commented 2 years ago

Fixed. Still some abi warnings on gcc but didn't look into it.

brickviking commented 2 years ago

Thank you again. That's fixed all the remaining bugs I think I had. I'll rerun it again from scratch and find out if it works properly.

Later: yup. All compiled fine. I'm done for the moment.

Cheers, brickviking.