Thread: I can't spot my mistake...

  1. #76
    Registered User
    Join Date
    Sep 2020
    Posts
    425
    Oh, and your binary has a relative path to the shared library (libalu.so). Because of this it will only run if you are in the 'bin' directory when you launch it:

    Code:
    ~/alu$ ldd bin/test_alu.AppImage
            linux-vdso.so.1 (0x00007fffc6c40000)
            libalu.so => ../lib/libalu.so (0x00007f06f0990000)
            libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f06f0590000)
            /lib64/ld-linux-x86-64.so.2 (0x00007f06f0e00000)
    Code:
    ~/alu$ bin/test_alu.AppImage
    bin/test_alu.AppImage: symbol lookup error: bin/test_alu.AppImage: undefined symbol: alu_int_set_raw

  2. #77
    Registered User awsdert's Avatar
    Join Date
    Jan 2015
    Posts
    1,733
    Quote Originally Posted by hamster_nz View Post
    Maybe "mkdir lib" and "mkdir bin" will help - when I cloned the repo there was no lib or bin directory.
    That's only because git ignores empty directories but I should've added the target that makes those directories so I'll rectify that now

  3. #78
    Registered User awsdert's Avatar
    Join Date
    Jan 2015
    Posts
    1,733
    Quote Originally Posted by hamster_nz View Post
    Oh, and your binary has a relative path to the shared library (libalu.so). Because of this it will only run if you are in the 'bin' directory when you launch it:

    Code:
    ~/alu$ ldd bin/test_alu.AppImage
            linux-vdso.so.1 (0x00007fffc6c40000)
            libalu.so => ../lib/libalu.so (0x00007f06f0990000)
            libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f06f0590000)
            /lib64/ld-linux-x86-64.so.2 (0x00007f06f0e00000)
    Code:
    ~/alu$ bin/test_alu.AppImage
    bin/test_alu.AppImage: symbol lookup error: bin/test_alu.AppImage: undefined symbol: alu_int_set_raw
    That lookup error is a curious one, I'll get back to that as soon as I see make actually find the app

    Edit: Well I tied adding in the dependencies but still having problems
    Code:
    make rebuild
    cd ../ && make --no-print-directory rebuild
    #MAKECMDGOALS=rebuild
    cd mak && make -j 1 --no-print-directory -f main.mak rebuild
    PRJ_LIB_NAME=alu
    PRJ_SRC_FILES = '../src/alu_bit.c ../src/alu_fpn.c ../src/alu_int.c ../src/alu_main.c ../src/alu_math.c ../src/alu_mem.c ../src/alu_uint.c ../src/alu_vec.c'
    Checking 3rd Party libraries are upto date
    cd '../cloned/unic' && git config pull.rebase false && git pull
    Finished checking
    PRJ_DST_BIN=test_alu.AppImage
    PRJ_DST_LIB=libalu.so
    rm -f ../bin/*.AppImage ../bin/*.exe
    rm -f ../lib/*.so ../lib/*.dll
    rm -f ../src/*.o ../src/*.obj
    rm -f ../tests/*.o ../tests/*.obj
    cc -D NDEBUG  -fPIC -shared  -o ../lib/libalu.so  -Wl,rpath=../lib
    /usr/bin/ld: cannot find rpath=../lib: No such file or directory
    collect2: error: ld returned 1 exit status
    make[2]: *** [main.mak:137: libalu.so] Error 1
    make[1]: *** [makefile:10: rebuild] Error 2
    make: *** [makefile:4: rebuild] Error 2
    Compilation failed.
    Any ideas from the newest upload?
    alu/main.mak at master * awsdert/alu * GitHub

  4. #79
    Registered User awsdert's Avatar
    Join Date
    Jan 2015
    Posts
    1,733
    Quote Originally Posted by awsdert View Post
    That lookup error is a curious one, I'll get back to that as soon as I see make actually find the app

    Edit: Well I tied adding in the dependencies but still having problems
    Code:
    make rebuild
    cd ../ && make --no-print-directory rebuild
    #MAKECMDGOALS=rebuild
    cd mak && make -j 1 --no-print-directory -f main.mak rebuild
    PRJ_LIB_NAME=alu
    PRJ_SRC_FILES = '../src/alu_bit.c ../src/alu_fpn.c ../src/alu_int.c ../src/alu_main.c ../src/alu_math.c ../src/alu_mem.c ../src/alu_uint.c ../src/alu_vec.c'
    Checking 3rd Party libraries are upto date
    cd '../cloned/unic' && git config pull.rebase false && git pull
    Finished checking
    PRJ_DST_BIN=test_alu.AppImage
    PRJ_DST_LIB=libalu.so
    rm -f ../bin/*.AppImage ../bin/*.exe
    rm -f ../lib/*.so ../lib/*.dll
    rm -f ../src/*.o ../src/*.obj
    rm -f ../tests/*.o ../tests/*.obj
    cc -D NDEBUG  -fPIC -shared  -o ../lib/libalu.so  -Wl,rpath=../lib
    /usr/bin/ld: cannot find rpath=../lib: No such file or directory
    collect2: error: ld returned 1 exit status
    make[2]: *** [main.mak:137: libalu.so] Error 1
    make[1]: *** [makefile:10: rebuild] Error 2
    make: *** [makefile:4: rebuild] Error 2
    Compilation failed.
    Any ideas from the newest upload?
    alu/main.mak at master * awsdert/alu * GitHub
    After removing the rpath flag and tweaking the run commands a little I found all compiles fine, it's just the system won't launch without the rpath, I must've done something wrong when shifting the source of the parameter, mind taking a look:
    Code:
    _F_Wl_rpath=-Wl,rpath=$1
    F_Wl_rpath=$(call ifin,$(CC),vc,,$(call _F_Wl_rpath,$1))
    ...
    RPATH_FLAG=$(call F_Wl_rpath,$(PRJ_LIB_DIR))

  5. #80
    Registered User awsdert's Avatar
    Join Date
    Jan 2015
    Posts
    1,733
    Quote Originally Posted by awsdert View Post
    After removing the rpath flag and tweaking the run commands a little I found all compiles fine, it's just the system won't launch without the rpath, I must've done something wrong when shifting the source of the parameter, mind taking a look:
    Code:
    _F_Wl_rpath=-Wl,rpath=$1
    F_Wl_rpath=$(call ifin,$(CC),vc,,$(call _F_Wl_rpath,$1))
    ...
    RPATH_FLAG=$(call F_Wl_rpath,$(PRJ_LIB_DIR))
    Found the mistake, didn't stick a - character before rpath

    Edit: Someone mind looking at main.mak to find out why my objects keep getting remove after they've been built (I understand before being built but not after)
    Code:
    make rebuild run
    cd ../ && make --no-print-directory rebuild run
    #MAKECMDGOALS=rebuild run
    cd mak && make -j 1 --no-print-directory -f main.mak rebuild run
    PRJ_LIB_NAME=alu
    Checking 3rd Party libraries are upto date
    cd '../cloned/unic' && git config pull.rebase false && git pull
    Finished checking
    PRJ_DST_BIN=test_alu.AppImage
    PRJ_DST_LIB=libalu.so
    rm -f ../bin/*.AppImage ../bin/*.exe
    rm -f ../lib/*.so ../lib/*.dll
    rm -f ../src/*.o ../src/*.obj
    rm -f ../tests/*.o ../tests/*.obj
    cc -D NDEBUG  -fPIC -Wall -Wextra -pedantic -I ../cloned/unic/include -I ../include  -o ../src/alu_bit.o -c ../src/alu_bit.c
    cc -D NDEBUG  -fPIC -Wall -Wextra -pedantic -I ../cloned/unic/include -I ../include  -o ../src/alu_fpn.o -c ../src/alu_fpn.c
    cc -D NDEBUG  -fPIC -Wall -Wextra -pedantic -I ../cloned/unic/include -I ../include  -o ../src/alu_int.o -c ../src/alu_int.c
    cc -D NDEBUG  -fPIC -Wall -Wextra -pedantic -I ../cloned/unic/include -I ../include  -o ../src/alu_main.o -c ../src/alu_main.c
    cc -D NDEBUG  -fPIC -Wall -Wextra -pedantic -I ../cloned/unic/include -I ../include  -o ../src/alu_math.o -c ../src/alu_math.c
    cc -D NDEBUG  -fPIC -Wall -Wextra -pedantic -I ../cloned/unic/include -I ../include  -o ../src/alu_mem.o -c ../src/alu_mem.c
    cc -D NDEBUG  -fPIC -Wall -Wextra -pedantic -I ../cloned/unic/include -I ../include  -o ../src/alu_uint.o -c ../src/alu_uint.c
    cc -D NDEBUG  -fPIC -Wall -Wextra -pedantic -I ../cloned/unic/include -I ../include  -o ../src/alu_vec.o -c ../src/alu_vec.c
    cc -D NDEBUG  -fPIC -shared  -o ../lib/libalu.so ../src/alu_bit.o ../src/alu_fpn.o ../src/alu_int.o ../src/alu_main.o ../src/alu_math.o ../src/alu_mem.o ../src/alu_uint.o ../src/alu_vec.o -Wl,-rpath,../lib
    cc -D NDEBUG  -fPIC -Wall -Wextra -pedantic -I ../cloned/unic/include -I ../include  -o ../tests/test_alu.o -c ../tests/test_alu.c
    cc -D NDEBUG  -fPIE -L ../lib  -o ../bin/test_alu.AppImage ../tests/test_alu.o -Wl,-rpath,../lib -l alu
    ../bin/test_alu.AppImage
    ../tests/test_alu.c:919: main() Pre-allocating 64 ALU registers...
    ../tests/test_alu.c:369: bitwise() 'Checking Bitwise Operations...'
    ../tests/test_alu.c:370: bitwise() '==========================================='
    ../tests/test_alu.c:196: modify() ~0x00000000DEADC0DE, Expected 0xFFFFFFFF21523F21, Got 0x0000000000000000, op = '~'
    ../tests/test_alu.c:196: modify() 0x00000000DEADC0DE & 0x0000000000C0FFEE, Expected 0x000000000080C0CE, Got 0x0000000000000000, op = '&'
    ../tests/test_alu.c:196: modify() 0x00000000DEADC0DE | 0x0000000000C0FFEE, Expected 0x00000000DEEDFFFE, Got 0x0000000000000000, op = '|'
    ../tests/test_alu.c:196: modify() 0x00000000DEADC0DE ^ 0x0000000000C0FFEE, Expected 0x00000000DE6D3F30, Got 0x0000000000000000, op = '^'
    ../tests/test_alu.c:386: bitwise() 'Shifting values...'
    ../tests/test_alu.c:387: bitwise() '==========================================='
    ../tests/test_alu.c:196: modify() 0x00000000DEADC0DE << 0x0000000000000004, Expected 0x0000000DEADC0DE0, Got 0x0000000000000000, op = '<'
    ../tests/test_alu.c:196: modify() 0x00000000DEADC0DE >> 0x0000000000000004, Expected 0x000000000DEADC0D, Got 0x0000000000000000, op = '>'
    ../tests/test_alu.c:403: bitwise() 'Rotating values...'
    ../tests/test_alu.c:404: bitwise() '==========================================='
    ../tests/test_alu.c:196: modify() 0x00000000DEADC0DE <<< 0x0000000000000004, Expected 0x0000000DEADC0DE0, Got 0x0000000000000000, op = 'l'
    ../tests/test_alu.c:196: modify() 0x00000000DEADC0DE >>> 0x0000000000000004, Expected 0xE00000000DEADC0D, Got 0x0000000000000000, op = 'r'
    ../tests/test_alu.c:429: mathmatical() 'Checking Mathematic Operations...'
    ../tests/test_alu.c:430: mathmatical() '==========================================='
    ../tests/test_alu.c:196: modify() 0x00000000DEADC0DE--, Expected 0x00000000DEADC0DD, Got 0x0000000000000000, op = 'd'
    rm ../src/alu_math.o ../tests/test_alu.o ../src/alu_main.o ../src/alu_uint.o ../src/alu_mem.o ../src/alu_int.o ../src/alu_bit.o ../src/alu_vec.o ../src/alu_fpn.o
    ../tests/test_alu.c:196: modify() 0x00000000DEADC0DE - 0x0000000000000BAD, Expected 0x00000000DEADB531, Got 0x0000000000000000, op = '-'
    ../tests/test_alu.c:196: modify() 0x00000000DEADC0DE / 0x0000000000000BAD, Expected 0x0000000000131264, Got 0x0000000000000000, op = '/'
    ../tests/test_alu.c:196: modify() 0x00000000DEADC0DE % 0x0000000000000BAD, Expected 0x000000000000074A, Got 0x0000000000000000, op = '%'
    ../tests/test_alu.c:196: modify() 0xFFFFFFFF21523F22--, Expected 0xFFFFFFFF21523F21, Got 0x0000000000000000, op = 'd'
    ../tests/test_alu.c:196: modify() 0xFFFFFFFF21523F22 - 0x0000000000000BAD, Expected 0xFFFFFFFF21523375, Got 0x0000000000000000, op = '-'
    ../tests/test_alu.c:196: modify() 0xFFFFFFFF21523F22 / 0x0000000000000BAD, Expected 0xFFFFFFFFFFECED9C, Got 0x0000000000000000, op = '/'
    ../tests/test_alu.c:196: modify() 0xFFFFFFFF21523F22 % 0x0000000000000BAD, Expected 0xFFFFFFFFFFFFF8B6, Got 0x0000000000000000, op = '%'
    ../tests/test_alu.c:196: modify() 0xFFFFFFFF21523F22--, Expected 0xFFFFFFFF21523F21, Got 0x0000000000000000, op = 'd'
    ../tests/test_alu.c:196: modify() 0xFFFFFFFF21523F22 - 0xFFFFFFFFFFFFF453, Expected 0xFFFFFFFF21524ACF, Got 0x0000000000000000, op = '-'
    ../tests/test_alu.c:196: modify() 0xFFFFFFFF21523F22 / 0xFFFFFFFFFFFFF453, Expected 0x0000000000131264, Got 0x0000000000000000, op = '/'
    ../tests/test_alu.c:196: modify() 0xFFFFFFFF21523F22 % 0xFFFFFFFFFFFFF453, Expected 0xFFFFFFFFFFFFF8B6, Got 0x0000000000000000, op = '%'
    ../tests/test_alu.c:196: modify() 0x00000000DEADC0DE--, Expected 0x00000000DEADC0DD, Got 0x0000000000000000, op = 'd'
    ../tests/test_alu.c:196: modify() 0x00000000DEADC0DE - 0x0000000000000000, Expected 0x00000000DEADC0DE, Got 0x0000000000000000, op = '-'
    ../tests/test_alu.c:196: modify() 0x00000000DEADC0DE % 0x0000000000000000, Expected 0x00000000DEADC0DE, Got 0x0000000000000000, op = '%'
    ../tests/test_alu.c:810: print_value() 'Printing values...'
    ../tests/test_alu.c:811: print_value() '==========================================='
    ../tests/test_alu.c:564: reg_print_value() 'Testing alu_lit2reg() & alu_reg2str()'
    ../tests/test_alu.c:565: reg_print_value() '-------------------------------------'
    ../tests/test_alu.c:601: reg_print_value() Expected = '123', Got = '123'
    ../tests/test_alu.c:624: uint_print_value() 'Testing alu_str2uint() & alu_uint2str()'
    ../tests/test_alu.c:625: uint_print_value() '---------------------------------------'
    ../tests/test_alu.c:638: uint_print_value() Error 0xFFFFFFFF -1 'Unknown error -1'
    ../tests/test_alu.c:856: print_value() Error 0xFFFFFFFF -1 'Unknown error -1'
    ../tests/test_alu.c:962: main() Error 0xFFFFFFFF -1 'Unknown error -1'
    make[2]: *** [main.mak:95: test] Error 1
    make[1]: *** [makefile:10: rebuild] Error 2
    make: *** [makefile:4: rebuild] Error 2
    Compilation failed.
    Not against you helping me find why the math broken also, not gonna get my hopes up on that one though, I'll return to trying to fix them after doing some quick shopping, gives peops a chance to have a look if they're so inclined

  6. #81
    Registered User awsdert's Avatar
    Join Date
    Jan 2015
    Posts
    1,733
    Okay I've narrowed down the source of my broken math, turns out somehow alu_reg_mov() is not seeing the data:
    Code:
    make run
    cd ../ && make --no-print-directory run
    #MAKECMDGOALS=run
    cd mak && make -j 1 --no-print-directory -f main.mak run
    PRJ_LIB_NAME=alu
    Checking 3rd Party libraries are upto date
    cd '../cloned/unic' && git config pull.rebase false && git pull
    Finished checking
    PRJ_DST_BIN=test_alu.AppImage
    PRJ_DST_LIB=libalu.so
    cc -D NDEBUG  -fPIC -Wall -Wextra -pedantic -I ../cloned/unic/include -I ../include -D UNIC_FALLBACK  -o ../src/alu_bit.o -c ../src/alu_bit.c
    cc -D NDEBUG  -fPIC -Wall -Wextra -pedantic -I ../cloned/unic/include -I ../include -D UNIC_FALLBACK  -o ../src/alu_fpn.o -c ../src/alu_fpn.c
    cc -D NDEBUG  -fPIC -Wall -Wextra -pedantic -I ../cloned/unic/include -I ../include -D UNIC_FALLBACK  -o ../src/alu_int.o -c ../src/alu_int.c
    cc -D NDEBUG  -fPIC -Wall -Wextra -pedantic -I ../cloned/unic/include -I ../include -D UNIC_FALLBACK  -o ../src/alu_main.o -c ../src/alu_main.c
    cc -D NDEBUG  -fPIC -Wall -Wextra -pedantic -I ../cloned/unic/include -I ../include -D UNIC_FALLBACK  -o ../src/alu_math.o -c ../src/alu_math.c
    cc -D NDEBUG  -fPIC -Wall -Wextra -pedantic -I ../cloned/unic/include -I ../include -D UNIC_FALLBACK  -o ../src/alu_mem.o -c ../src/alu_mem.c
    cc -D NDEBUG  -fPIC -Wall -Wextra -pedantic -I ../cloned/unic/include -I ../include -D UNIC_FALLBACK  -o ../src/alu_uint.o -c ../src/alu_uint.c
    cc -D NDEBUG  -fPIC -Wall -Wextra -pedantic -I ../cloned/unic/include -I ../include -D UNIC_FALLBACK  -o ../src/alu_vec.o -c ../src/alu_vec.c
    cc -D NDEBUG  -fPIC -shared  -o ../lib/libalu.so ../src/alu_bit.o ../src/alu_fpn.o ../src/alu_int.o ../src/alu_main.o ../src/alu_math.o ../src/alu_mem.o ../src/alu_uint.o ../src/alu_vec.o -Wl,-rpath,../lib
    cc -D NDEBUG  -fPIC -Wall -Wextra -pedantic -I ../cloned/unic/include -I ../include -D UNIC_FALLBACK  -o ../tests/test_alu.o -c ../tests/test_alu.c
    cc -D NDEBUG  -fPIE -L ../lib  -o ../bin/test_alu.AppImage ../tests/test_alu.o -Wl,-rpath,../lib -l alu
    ../bin/test_alu.AppImage
    ../tests/test_alu.c:921: main() Pre-allocating 64 ALU registers...
    ../tests/test_alu.c:371: bitwise() 'Checking Bitwise Operations...'
    ../tests/test_alu.c:372: bitwise() '==========================================='
    ../src/alu_math.c:316: mov() src = 0000000000000000000000000000000011011110101011011100000011011110
    ../src/alu_math.c:324: mov() s = 0, ptr = 0x55f812973320, mask = 0000000000000001, pos = 0, seg = 0, bit = 0
    ../src/alu_math.c:327: mov() d = 0, ptr = 0x55f812973320, mask = 0000000000000001, pos = 0, seg = 0, bit = 0
    ../src/alu_math.c:324: mov() s = 0, ptr = 0x55f812973320, mask = 0000000000000002, pos = 1, seg = 0, bit = 1
    ../src/alu_math.c:327: mov() d = 0, ptr = 0x55f812973320, mask = 0000000000000002, pos = 1, seg = 0, bit = 1
    ../src/alu_math.c:324: mov() s = 0, ptr = 0x55f812973320, mask = 0000000000000004, pos = 2, seg = 0, bit = 2
    ../src/alu_math.c:327: mov() d = 0, ptr = 0x55f812973320, mask = 0000000000000004, pos = 2, seg = 0, bit = 2
    ../src/alu_math.c:324: mov() s = 0, ptr = 0x55f812973320, mask = 0000000000000008, pos = 3, seg = 0, bit = 3
    ../src/alu_math.c:327: mov() d = 0, ptr = 0x55f812973320, mask = 0000000000000008, pos = 3, seg = 0, bit = 3
    ...
    ../tests/test_alu.c:640: uint_print_value() Error 0xFFFFFFFF -1 'Unknown error -1'
    ../tests/test_alu.c:858: print_value() Error 0xFFFFFFFF -1 'Unknown error -1'
    ../tests/test_alu.c:964: main() Error 0xFFFFFFFF -1 'Unknown error -1'
    make[2]: *** [main.mak:95: test] Error 1
    make[1]: *** [makefile:10: run] Error 2
    make: *** [makefile:4: run] Error 2
    Compilation failed.
    From this function:
    Code:
    int alu_reg_mov(
    	alu_t *alu,
    	alu_reg_t dst,
    	alu_reg_t src
    )
    {
    	int ret;
    	void *D, *S;
    	alu_bit_t d, s;
    	size_t ndiff, vdiff, upto;
    	bool neg, NaN = false;
    	alu_reg_t DEXP, DMAN, SEXP, SMAN;
    	
    	ret = alu_reg_clr( alu, dst );
    	
    	if ( ret == 0 )
    	{
    		dst.node %= alu_used( alu );
    		src.node %= alu_used( alu );
    		
    		D = alu_reg_data( alu, dst );
    		S = alu_reg_data( alu, dst );
    		
    		/* Check for +/- */
    		neg = alu_reg_below0( alu, src );
    		
    		if ( alu_reg_floating( src ) )
    		{
    ...
    			return ENOSYS;
    		}
    		
    		ndiff = dst.upto - dst.from;
    		vdiff = src.upto - src.from;
    		
    		alu_print_reg( __FILE__ ":" INT2STR(__LINE__) ": mov() src", alu, src, 0, 1 );
    		
    		d = alu_bit_set_bit( D, dst.from );
    		s = alu_bit_set_bit( S, src.from );
    		upto = dst.from + LOWEST( ndiff, vdiff );
    		
    		for ( ; d.bit < upto; alu_bit_inc(&d), alu_bit_inc(&s) )
    		{
    			alu_print_bit( __FILE__ ":" INT2STR(__LINE__) ": mov() s", s, 1 );
    			*(d.ptr) &= ~(d.mask);
    			*(d.ptr) |= SET1IF( *(s.ptr) & s.mask, s.mask );
    			alu_print_bit( __FILE__ ":" INT2STR(__LINE__) ": mov() d", d, 1 );
    		}
    		
    		for ( ; d.bit < dst.upto; alu_bit_inc(&d) )
    		{
    			*(d.ptr) &= ~(d.mask);
    			*(d.ptr) |= SET1IF( neg, d.mask );
    		}
    		
    		alu_print_reg( __FILE__ ":" INT2STR(__LINE__) ": mov() dst", alu, dst, 0, 1 );
    		
    		return 0;
    	}
    	
    	alu_error( ret );
    	return ret;
    }
    Any ideas?

    Edit: Just spotted that I had accidentally used dst for setting the pointer to the 1st segment of src register, rectifying that resolved my problem and all the math started behaving as expected

  7. #82
    Registered User awsdert's Avatar
    Join Date
    Jan 2015
    Posts
    1,733
    Ok, now that all those bugs have been sorted I've gone back to the alu_reg_mov() function to do more of the float to integer step (also rectified a few bugs I noticed there), I've dealt with the conversion of +/- Infinity to min/max of the integer, even dealt with the out of bounds exponent to 0/max, now I just need to do the final stretch, gonna take a break while I do some stuff for a neighbor (old guy who's not able to walk much anymore), in the mean time I'd like anyone interest in doing so to have a look at the function and tell me any problems they see or give any suggestions they have, (I will also be learning how to use check as laserlight keeps telling me to (although she didn't specifically mention a suite but check seems like it will be easier to learn) when I get back to coding later so you'll have plenty of time to do so before I go back to the function)

    Edit: Whoops forgot to actually paste the function in:
    Code:
    int alu_reg_mov(
    	alu_t *alu,
    	alu_reg_t dst,
    	alu_reg_t src
    )
    {
    	int ret;
    	void *D, *S;
    	alu_bit_t d, s;
    	size_t ndiff, vdiff, upto;
    	bool neg, NaN = false, Inf = false;
    	alu_reg_t DEXP, DMAN, SEXP, SMAN;
    	
    	ret = alu_reg_clr( alu, dst );
    	
    	if ( ret == 0 )
    	{
    		dst.node %= alu_used( alu );
    		src.node %= alu_used( alu );
    		
    		D = alu_reg_data( alu, dst );
    		S = alu_reg_data( alu, src );
    		
    		/* Check for +/- */
    		neg = alu_reg_below0( alu, src );
    		
    		if ( alu_reg_floating( src ) )
    		{
    			alu_reg_init( alu, SEXP, src.node, 0 );
    			alu_reg_init( alu, SMAN, src.node, 0 );
    			
    			SEXP.upto = src.upto - 1;
    			SEXP.from = src.from + src.mant;
    			SMAN.upto = src.from + src.mant;
    			SMAN.from = src.from;
    			
    			/* Check if should set NaN or Infinity */
    			DEXP.upto = SEXP.upto;
    			DEXP.from = SEXP.from;
    			alu_reg_set_max( alu, DEXP );
    			Inf = (alu_reg_cmp( alu, SEXP, DEXP ) == 0);
    			
    			if ( alu_reg_floating( dst ) )
    			{
    				alu_reg_init( alu, DEXP, dst.node, 0 );
    				
    				DEXP.upto = dst.upto - 1;
    				DEXP.from = dst.from + dst.mant;
    				DMAN.upto = dst.from + dst.mant;
    				DMAN.from = dst.from;
    				
    				/* Set +/- */
    				d = alu_bit_set_bit( D, DEXP.upto );
    				*(d.ptr) &= ~(d.mask);
    				*(d.ptr) |= (neg * d.mask);
    				
    				/* Simplify code and pass on duties to another instance, added
    				 * bonus of setting Infinity if >= Exponent limit */
    				alu_reg_mov( alu, DEXP, SEXP );
    				
    				ndiff = DMAN.upto - DMAN.from;
    				vdiff = SMAN.upto - SMAN.from;
    				
    				/* Make sure we copy the upper bits of the src mantissa */
    				SMAN.from = SMAN.upto - LOWEST( ndiff, vdiff );
    				
    				/* Whether it is NaN or a fittable number copying the mantissa
    				 * is fine as long as we make sure it was not Infinity to begin
    				 * with */
    				return Inf
    					? alu_reg_clr( alu, DMAN )
    					: alu_reg_mov( alu, DMAN, SMAN );
    			}
    			else if ( Inf )
    			{
    				/* Infinity is not something an integer can hold, default to
    				 * max of the integer, if -Infinity the not operation will flip
    				 * to min of the integer */
    				(void)alu_reg_set_max( alu, dst );
    				return neg ? alu_reg_not( alu, dst ) : 0;
    			}
    			
    			/* Mantissa is always bigger than exponent so it is safe to use
    			 * as the temporary copy of number to shift */
    			alu_reg__shr( alu, DEXP, DMAN, 1 );
    			
    			/* Check if exponent is negative - meaning the number is between
    			 * 0 & 1, if it is then just set the integer to 0 */
    			ret = alu_reg_cmp( alu, SEXP, DEXP );
    			
    			if ( ret < 0 )
    				return alu_reg_clr( alu, dst );
    			
    			DEXP.from = dst.from;
    			DEXP.upto = dst.upto;
    			ndiff = dst.upto - dst.from;
    			alu_reg_set_raw( alu, DEXP, &(ndiff), sizeof(size_t), 0 );
    			
    			ret = alu_reg_cmp( alu, DEXP, SEXP );
    			
    			/* Check if number is to big to fit in integer */
    			if ( ret >= 0 )
    				return alu_reg_set_max( alu, dst );
    			
    			// FIXME: Finish implementing moving alu_fpn_t to alu_int_t/alu_uint_t
    			// if ( alu_reg_cmp( alu, EXP, BIAS ) >= 0 )
    			return ENOSYS;
    		}
    		
    		ndiff = dst.upto - dst.from;
    		vdiff = src.upto - src.from;
    		
    		d = alu_bit_set_bit( D, dst.from );
    		s = alu_bit_set_bit( S, src.from );
    		upto = dst.from + LOWEST( ndiff, vdiff );
    		
    		for ( ; d.bit < upto; alu_bit_inc(&d), alu_bit_inc(&s) )
    		{
    			*(d.ptr) &= ~(d.mask);
    			*(d.ptr) |= SET1IF( *(s.ptr) & s.mask, s.mask );
    		}
    		
    		for ( ; d.bit < dst.upto; alu_bit_inc(&d) )
    		{
    			*(d.ptr) &= ~(d.mask);
    			*(d.ptr) |= SET1IF( neg, d.mask );
    		}
    		
    		return 0;
    	}
    	
    	alu_error( ret );
    	return ret;
    }

  8. #83

  9. #84
    Registered User awsdert's Avatar
    Join Date
    Jan 2015
    Posts
    1,733
    Getting a strange difference in behavior when I run 'make check' vs 'make check run', 'make check' gives me expected behavior but the other when ends in a fault at division despite using the same code and values:
    Code:
    make check (in directory: /mnt/MEDIA/HOME/github/alu/tests)
    cd ../ && make --no-print-directory check
    #MAKECMDGOALS=check
    cd mak && make -j 1 --no-print-directory -f main.mak check
    PRJ_LIB_NAME=alu
    Checking 3rd Party libraries are upto date
    cd '../cloned/unic' && git config pull.rebase false && git pull
    Finished checking
    PRJ_DST_BIN=check_alu.AppImage
    PRJ_DST_LIB=libalu.so
    cc -D NDEBUG  -fPIC -Wall -Wextra -pedantic -I ../cloned/unic/include -I ../include -D UNIC_FALLBACK  -o ../src/alu_bit.o -c ../src/alu_bit.c
    cc -D NDEBUG  -fPIC -Wall -Wextra -pedantic -I ../cloned/unic/include -I ../include -D UNIC_FALLBACK  -o ../src/alu_fpn.o -c ../src/alu_fpn.c
    cc -D NDEBUG  -fPIC -Wall -Wextra -pedantic -I ../cloned/unic/include -I ../include -D UNIC_FALLBACK  -o ../src/alu_int.o -c ../src/alu_int.c
    cc -D NDEBUG  -fPIC -Wall -Wextra -pedantic -I ../cloned/unic/include -I ../include -D UNIC_FALLBACK  -o ../src/alu_main.o -c ../src/alu_main.c
    cc -D NDEBUG  -fPIC -Wall -Wextra -pedantic -I ../cloned/unic/include -I ../include -D UNIC_FALLBACK  -o ../src/alu_math.o -c ../src/alu_math.c
    ../src/alu_math.c: In function ‘alu_reg_mov’:
    ../src/alu_math.c:235:12: warning: unused variable ‘NaN’ [-Wunused-variable]
      235 |  bool neg, NaN = false, Inf = false;
          |            ^~~
    cc -D NDEBUG  -fPIC -Wall -Wextra -pedantic -I ../cloned/unic/include -I ../include -D UNIC_FALLBACK  -o ../src/alu_mem.o -c ../src/alu_mem.c
    cc -D NDEBUG  -fPIC -Wall -Wextra -pedantic -I ../cloned/unic/include -I ../include -D UNIC_FALLBACK  -o ../src/alu_uint.o -c ../src/alu_uint.c
    cc -D NDEBUG  -fPIC -Wall -Wextra -pedantic -I ../cloned/unic/include -I ../include -D UNIC_FALLBACK  -o ../src/alu_vec.o -c ../src/alu_vec.c
    cc -D NDEBUG  -fPIC -shared  -o ../lib/libalu.so ../src/alu_bit.o ../src/alu_fpn.o ../src/alu_int.o ../src/alu_main.o ../src/alu_math.o ../src/alu_mem.o ../src/alu_uint.o ../src/alu_vec.o -Wl,-rpath,../lib
    cc -D NDEBUG  -fPIC -Wall -Wextra -pedantic -I ../cloned/unic/include -I ../include -D UNIC_FALLBACK  -o ../tests/check_alu.o -c ../tests/check_alu.c
    cc -D NDEBUG  -fPIE -L ../lib  -o ../bin/check_alu.AppImage ../tests/check_alu.o -Wl,-rpath,../lib -l alu -l check
    ../bin/check_alu.AppImage
    Running unit tests under 'check' test suite
    Running suite(s): Money
    Initialising ALU
    Getting registers
    100%: Checks: 1, Failures: 0, Errors: 0
    rm ../src/alu_math.o ../src/alu_main.o ../src/alu_uint.o ../src/alu_mem.o ../src/alu_int.o ../src/alu_bit.o ../src/alu_vec.o ../src/alu_fpn.o ../tests/check_alu.o
    Compilation finished successfully.
    Code:
    make check run (in directory:
    cd ../ && make --no-print-directory check run
    #MAKECMDGOALS=check run
    cd mak && make -j 1 --no-print-directory -f main.mak check run
    PRJ_LIB_NAME=alu
    Checking 3rd Party libraries are upto date
    cd '../cloned/unic' && git config pull.rebase false && git pull
    Finished checking
    PRJ_DST_BIN=check_alu.AppImage
    PRJ_DST_LIB=libalu.so
    cc -D NDEBUG  -fPIC -Wall -Wextra -pedantic -I ../cloned/unic/include -I ../include -D UNIC_FALLBACK  -o ../src/alu_bit.o -c ../src/alu_bit.c
    cc -D NDEBUG  -fPIC -Wall -Wextra -pedantic -I ../cloned/unic/include -I ../include -D UNIC_FALLBACK  -o ../src/alu_fpn.o -c ../src/alu_fpn.c
    cc -D NDEBUG  -fPIC -Wall -Wextra -pedantic -I ../cloned/unic/include -I ../include -D UNIC_FALLBACK  -o ../src/alu_int.o -c ../src/alu_int.c
    cc -D NDEBUG  -fPIC -Wall -Wextra -pedantic -I ../cloned/unic/include -I ../include -D UNIC_FALLBACK  -o ../src/alu_main.o -c ../src/alu_main.c
    cc -D NDEBUG  -fPIC -Wall -Wextra -pedantic -I ../cloned/unic/include -I ../include -D UNIC_FALLBACK  -o ../src/alu_math.o -c ../src/alu_math.c
    ../src/alu_math.c: In function ‘alu_reg_mov’:
    ../src/alu_math.c:235:12: warning: unused variable ‘NaN’ [-Wunused-variable]
      235 |  bool neg, NaN = false, Inf = false;
          |            ^~~
    cc -D NDEBUG  -fPIC -Wall -Wextra -pedantic -I ../cloned/unic/include -I ../include -D UNIC_FALLBACK  -o ../src/alu_mem.o -c ../src/alu_mem.c
    cc -D NDEBUG  -fPIC -Wall -Wextra -pedantic -I ../cloned/unic/include -I ../include -D UNIC_FALLBACK  -o ../src/alu_uint.o -c ../src/alu_uint.c
    cc -D NDEBUG  -fPIC -Wall -Wextra -pedantic -I ../cloned/unic/include -I ../include -D UNIC_FALLBACK  -o ../src/alu_vec.o -c ../src/alu_vec.c
    cc -D NDEBUG  -fPIC -shared  -o ../lib/libalu.so ../src/alu_bit.o ../src/alu_fpn.o ../src/alu_int.o ../src/alu_main.o ../src/alu_math.o ../src/alu_mem.o ../src/alu_uint.o ../src/alu_vec.o -Wl,-rpath,../lib
    cc -D NDEBUG  -fPIC -Wall -Wextra -pedantic -I ../cloned/unic/include -I ../include -D UNIC_FALLBACK  -o ../tests/check_alu.o -c ../tests/check_alu.c
    cc -D NDEBUG  -fPIE -L ../lib  -o ../bin/check_alu.AppImage ../tests/check_alu.o -Wl,-rpath,../lib -l alu -l check
    ../bin/check_alu.AppImage
    Running unit tests under 'check' test suite
    Running suite(s): Money
    Initialising ALU
    Getting registers
    100%: Checks: 1, Failures: 0, Errors: 0
    make[2]: Nothing to be done for 'run'.
    rm ../src/alu_math.o ../src/alu_main.o ../src/alu_uint.o ../src/alu_mem.o ../src/alu_int.o ../src/alu_bit.o ../src/alu_vec.o ../src/alu_fpn.o ../tests/check_alu.o
    #MAKECMDGOALS=check run
    cd mak && make -j 1 --no-print-directory -f main.mak check run
    PRJ_LIB_NAME=alu
    Checking 3rd Party libraries are upto date
    cd '../cloned/unic' && git config pull.rebase false && git pull
    Finished checking
    PRJ_DST_BIN=check_alu.AppImage
    PRJ_DST_LIB=libalu.so
    cc -D NDEBUG  -fPIC -Wall -Wextra -pedantic -I ../cloned/unic/include -I ../include -D UNIC_FALLBACK  -o ../src/alu_bit.o -c ../src/alu_bit.c
    cc -D NDEBUG  -fPIC -Wall -Wextra -pedantic -I ../cloned/unic/include -I ../include -D UNIC_FALLBACK  -o ../src/alu_fpn.o -c ../src/alu_fpn.c
    cc -D NDEBUG  -fPIC -Wall -Wextra -pedantic -I ../cloned/unic/include -I ../include -D UNIC_FALLBACK  -o ../src/alu_int.o -c ../src/alu_int.c
    cc -D NDEBUG  -fPIC -Wall -Wextra -pedantic -I ../cloned/unic/include -I ../include -D UNIC_FALLBACK  -o ../src/alu_main.o -c ../src/alu_main.c
    cc -D NDEBUG  -fPIC -Wall -Wextra -pedantic -I ../cloned/unic/include -I ../include -D UNIC_FALLBACK  -o ../src/alu_math.o -c ../src/alu_math.c
    ../src/alu_math.c: In function ‘alu_reg_mov’:
    ../src/alu_math.c:235:12: warning: unused variable ‘NaN’ [-Wunused-variable]
      235 |  bool neg, NaN = false, Inf = false;
          |            ^~~
    cc -D NDEBUG  -fPIC -Wall -Wextra -pedantic -I ../cloned/unic/include -I ../include -D UNIC_FALLBACK  -o ../src/alu_mem.o -c ../src/alu_mem.c
    cc -D NDEBUG  -fPIC -Wall -Wextra -pedantic -I ../cloned/unic/include -I ../include -D UNIC_FALLBACK  -o ../src/alu_uint.o -c ../src/alu_uint.c
    cc -D NDEBUG  -fPIC -Wall -Wextra -pedantic -I ../cloned/unic/include -I ../include -D UNIC_FALLBACK  -o ../src/alu_vec.o -c ../src/alu_vec.c
    cc -D NDEBUG  -fPIC -shared  -o ../lib/libalu.so ../src/alu_bit.o ../src/alu_fpn.o ../src/alu_int.o ../src/alu_main.o ../src/alu_math.o ../src/alu_mem.o ../src/alu_uint.o ../src/alu_vec.o -Wl,-rpath,../lib
    cc -D NDEBUG  -fPIC -Wall -Wextra -pedantic -I ../cloned/unic/include -I ../include -D UNIC_FALLBACK  -o ../tests/check_alu.o -c ../tests/check_alu.c
    cc -D NDEBUG  -fPIE -L ../lib  -o ../bin/check_alu.AppImage ../tests/check_alu.o -Wl,-rpath,../lib -l alu -l check
    ../bin/check_alu.AppImage
    Running unit tests under 'check' test suite
    Running suite(s): Money
    0%: Checks: 1, Failures: 1, Errors: 0
    ../tests/check_alu.c:121:F:Core:test_alu_create:0: Expected 3, Got 0
    make[2]: *** [main.mak:99: check] Error 1
    rm ../src/alu_math.o ../src/alu_main.o ../src/alu_uint.o ../src/alu_mem.o ../src/alu_int.o ../src/alu_bit.o ../src/alu_vec.o ../src/alu_fpn.o ../tests/check_alu.o
    make[1]: *** [makefile:10: run] Error 2
    make: *** [makefile:4: check] Error 2
    Compilation failed.
    Someone see what I don't see? (as usual the code is uploaded to github, link in my signature)

  10. #85
    Registered User
    Join Date
    Sep 2020
    Posts
    425
    I was going to look, but I can't get that far...

    Code:
    $ git pull
    Already up to date.
    $ make build
    #MAKECMDGOALS=build
    cd mak && make -j 1 --no-print-directory -f main.mak build
    PRJ_LIB_NAME=alu
    
    
    
    
    Checking 3rd Party libraries are upto date
    cd '../cloned/unic' && git config pull.rebase false && git pull
    Finished checking
    PRJ_DST_BIN=test_alu.AppImage
    PRJ_DST_LIB=libalu.so
    cc -D NDEBUG  -fPIC -Wall -Wextra -pedantic -I ../cloned/unic/include -I ../include -D UNIC_FALLBACK  -o ../src/alu_vec.o -c ../src/alu_vec.c
    In file included from ../include/alu.h:4:0,
                     from ../src/alu_vec.c:1:
    ../cloned/unic/include/unic/limits.h:137:0: warning: "CHAR_UNSIGNED" redefined
     #  define CHAR_UNSIGNED UNIC_CHAR_UNSIGNED
     
    ../cloned/unic/include/unic/limits.h:132:0: note: this is the location of the previous definition
     #  define CHAR_UNSIGNED 0
     
    In file included from ../include/alu.h:5:0,
                     from ../src/alu_vec.c:1:
    ../cloned/unic/include/unic/stdint.h:337:9: error: unknown type name ‘unic_ptrdiff_t’
     typedef unic_ptrdiff_t ptrdiff_t;
             ^~~~~~~~~~~~~~
    ../cloned/unic/include/unic/stdint.h:337:24: error: conflicting types for ‘ptrdiff_t’
     typedef unic_ptrdiff_t ptrdiff_t;
                            ^~~~~~~~~
    In file included from ../cloned/unic/include/unic/stdint.h:14:0,
                     from ../include/alu.h:5,
                     from ../src/alu_vec.c:1:
    /usr/lib/gcc/x86_64-linux-gnu/7/include/stddef.h:149:26: note: previous declaration of ‘ptrdiff_t’ was here
     typedef __PTRDIFF_TYPE__ ptrdiff_t;
                              ^~~~~~~~~
    main.mak:147: recipe for target '../src/alu_vec.o' failed
    make[1]: *** [../src/alu_vec.o] Error 1
    makefile:9: recipe for target 'build' failed
    make: *** [build] Error 2

  11. #86
    Registered User awsdert's Avatar
    Join Date
    Jan 2015
    Posts
    1,733
    Quote Originally Posted by hamster_nz View Post
    I was going to look, but I can't get that far...

    Code:
    $ git pull
    Already up to date.
    $ make build
    #MAKECMDGOALS=build
    cd mak && make -j 1 --no-print-directory -f main.mak build
    PRJ_LIB_NAME=alu
    
    
    
    
    Checking 3rd Party libraries are upto date
    cd '../cloned/unic' && git config pull.rebase false && git pull
    Finished checking
    PRJ_DST_BIN=test_alu.AppImage
    PRJ_DST_LIB=libalu.so
    cc -D NDEBUG  -fPIC -Wall -Wextra -pedantic -I ../cloned/unic/include -I ../include -D UNIC_FALLBACK  -o ../src/alu_vec.o -c ../src/alu_vec.c
    In file included from ../include/alu.h:4:0,
                     from ../src/alu_vec.c:1:
    ../cloned/unic/include/unic/limits.h:137:0: warning: "CHAR_UNSIGNED" redefined
     #  define CHAR_UNSIGNED UNIC_CHAR_UNSIGNED
     
    ../cloned/unic/include/unic/limits.h:132:0: note: this is the location of the previous definition
     #  define CHAR_UNSIGNED 0
     
    In file included from ../include/alu.h:5:0,
                     from ../src/alu_vec.c:1:
    ../cloned/unic/include/unic/stdint.h:337:9: error: unknown type name ‘unic_ptrdiff_t’
     typedef unic_ptrdiff_t ptrdiff_t;
             ^~~~~~~~~~~~~~
    ../cloned/unic/include/unic/stdint.h:337:24: error: conflicting types for ‘ptrdiff_t’
     typedef unic_ptrdiff_t ptrdiff_t;
                            ^~~~~~~~~
    In file included from ../cloned/unic/include/unic/stdint.h:14:0,
                     from ../include/alu.h:5,
                     from ../src/alu_vec.c:1:
    /usr/lib/gcc/x86_64-linux-gnu/7/include/stddef.h:149:26: note: previous declaration of ‘ptrdiff_t’ was here
     typedef __PTRDIFF_TYPE__ ptrdiff_t;
                              ^~~~~~~~~
    main.mak:147: recipe for target '../src/alu_vec.o' failed
    make[1]: *** [../src/alu_vec.o] Error 1
    makefile:9: recipe for target 'build' failed
    make: *** [build] Error 2
    It seems your copy of unic is out of date which means my code for auto-updating that in the makefile is faulty, I'm gonna take a look at that but for now try deleting unic from your directory and let it get re-downloaded

  12. #87
    Registered User awsdert's Avatar
    Join Date
    Jan 2015
    Posts
    1,733
    Seemed to have resolved it, seems the cause was a left over hack, removed it now

  13. #88
    Registered User awsdert's Avatar
    Join Date
    Jan 2015
    Posts
    1,733
    Turned out I hadn't resolved it, still getting errors, decided to step up my checks into loops iterating through the bit count of a segment, ended up with an error earlier in the tests, but this error is strange:
    Code:
    ../tests/check_alu.c:227:F:Core:test_alu_create:0: Line 359, 64 >> 32 = 64, Got 0
    Code:
    int test__alu_uint_shift
    (
    	size_t line
    	, alu_t* alu
    	, uint_t num
    	, uint_t val
    	, char *op
    	, uintmax_t expect
    	, func_alu_reg__shift_t _shift
    	, func_alu_reg_shift_t shift
    )
    {
    	int ret;
    	alu_reg_t NUM, VAL;
    	void *data;
    	
    	alu_reg_init( alu, NUM, num, 0 );
    	
    	ck_assert( NUM.node == num );
    	ck_assert( NUM.upto == alu_bits_perN(alu) );
    	ck_assert( NUM.from == 0 );
    	ck_assert( NUM.mant == 0 );
    	ck_assert( NUM.info == 0 );
    	
    	alu_reg_init( alu, VAL, val, 0 );
    	
    	ck_assert( VAL.node == val );
    	ck_assert( VAL.upto == alu_bits_perN(alu) );
    	ck_assert( VAL.from == 0 );
    	ck_assert( VAL.mant == 0 );
    	ck_assert( VAL.info == 0 );
    	
    	NUM.upto = bitsof(uintmax_t);
    	VAL.upto = bitsof(uintmax_t);
    	
    	ret = shift( alu, NUM, VAL, _shift );
    	
    	if ( ret == 0 )
    	{
    		data = alu_data( alu, num );
    		
    		ck_assert_msg
    		(
    			memcmp( data, &expect, sizeof(uintmax_t) ) == 0
    			, "Line %zu, %s = %ju, Got %ju"
    			, line
    			, op
    			, expect
    			, *((uintmax_t*)data)
    		);
    		
    		return 0;
    	}
    	
    	alu_error(ret);
    	return ret;
    }
    
    #define test_alu_uint_shift( alu, num, val, op, expect, _shift, shift ) \
    	test__alu_uint_shift( __LINE__, alu, num, val, op, (expect), _shift, shift )
    ...
    	for ( i = 0; i < bitsof(uintmax_t); ++i )
    	{
    		sprintf( stdstr, "%u >> %u", want, i );
    		
    		test_alu_uint_set_raw( __LINE__, alu, val, i );
    		
    		test_alu_uint_set_raw( __LINE__, alu, num, want );
    		test_alu_uint_shift
    		(
    			alu
    			, num
    			, val
    			, stdstr
    			, want >> i
    			, alu_reg__shr
    			, alu_reg__shift
    		);
    	}
    Anyone able to explain to me how the hardwired shift can end up with an incorrect result? btw both want and i are unsigned int

  14. #89
    Registered User
    Join Date
    Sep 2020
    Posts
    425
    A clean clone still doesn't work for me:

    Code:
    $ git clone GitHub - awsdert/alu: Library modeled after the Arithmetic Logic Unit built into CPUs
    Cloning into 'alu'...
    remote: Enumerating objects: 396, done.
    remote: Counting objects: 100% (396/396), done.
    remote: Compressing objects: 100% (377/377), done.
    remote: Total 396 (delta 277), reused 126 (delta 15), pack-reused 0
    Receiving objects: 100% (396/396), 138.31 KiB | 362.00 KiB/s, done.
    Resolving deltas: 100% (277/277), done.
    $ cd alu/
    $ make build
    #MAKECMDGOALS=build
    cd mak && make -j 1 --no-print-directory -f main.mak build
    PRJ_LIB_NAME=alu
    
    
    Cloning into 'unic'...
    remote: Enumerating objects: 193, done.
    remote: Counting objects: 100% (193/193), done.
    remote: Compressing objects: 100% (157/157), done.
    remote: Total 193 (delta 105), reused 112 (delta 26), pack-reused 0
    Receiving objects: 100% (193/193), 60.84 KiB | 293.00 KiB/s, done.
    Resolving deltas: 100% (105/105), done.
    
    
    Checking 3rd Party libraries are upto date
    cd '../cloned/unic' && git fetch && git pull
    Finished checking
    PRJ_DST_BIN=test_alu.AppImage
    PRJ_DST_LIB=libalu.so
    mkdir ../bin
    mkdir ../lib
    cc -D NDEBUG  -fPIC -Wall -Wextra -pedantic -I ../cloned/unic/include -I ../include -D UNIC_FALLBACK  -o ../src/alu_vec.o -c ../src/alu_vec.c
    In file included from /usr/include/stdio.h:41:0,
                     from ../include/alu.h:11,
                     from ../src/alu_vec.c:1:
    /usr/include/x86_64-linux-gnu/bits/libio.h:466:58: error: expected declaration specifiers or ‘...’ before ‘)’ token
     extern _IO_ssize_t _IO_padn (_IO_FILE *, int, _IO_ssize_t);
                                                              ^
    main.mak:147: recipe for target '../src/alu_vec.o' failed
    make[1]: *** [../src/alu_vec.o] Error 1
    makefile:9: recipe for target 'build' failed
    make: *** [build] Error 2

  15. #90
    Registered User
    Join Date
    Sep 2020
    Posts
    425
    But I can get it to build with:

    Code:
    gcc -o alu *.c ../tests/test_alu.c -I ../include -I ../cloned/unic/include   -Wall -pedantic -O4
    Will take a look

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. can anyone help to spot mistake in the code
    By chess_queen in forum C Programming
    Replies: 1
    Last Post: 10-21-2012, 10:37 AM
  2. Can you spot my mistake?
    By Brewer in forum C Programming
    Replies: 13
    Last Post: 11-12-2006, 12:50 PM
  3. going to a certain spot in a file...
    By agerealm in forum C++ Programming
    Replies: 3
    Last Post: 05-17-2002, 02:31 AM

Tags for this Thread