Code Monkey home page Code Monkey logo

Comments (16)

leonpano2006 avatar leonpano2006 commented on June 26, 2024

and this is same for box86
i don't think i should open issue on both side since is basically same thing

from box64.

ptitSeb avatar ptitSeb commented on June 26, 2024

Also, keep in mind that clang or gcc optimisation will affect only box64 (/box86) code, and not the generated Dynarec by box64. Don't expect too much difference between optimized build unless you use the Interpreter intensly. In normal use case, most of the time is spent in generated dynarec code...

from box64.

leonpano2006 avatar leonpano2006 commented on June 26, 2024

i got some errors in clang

/home/leonpano/box64/src/custommem.c:1289:40: warning: passing 'int *' to parameter of type 'uint32_t *' (aka 'unsigned int *') converts between pointers to integer types with different sign [-Wpointer-sign]
 1289 |         if(!rb_get_end(mapallmem, cur, &prot, &bend)) {
      |                                        ^~~~~
/home/leonpano/box64/src/include/rbtree.h:12:56: note: passing argument to parameter 'val' here
   12 | int rb_get_end(rbtree* tree, uintptr_t add[ 13%] Building C object CMakeFiles/box64.dir/src/elfs/elfloader.c.o
r, uint32_t* val, uintptr_t* end);
      |                                                        ^
/home/leonpano/box64/src/custommem.c:1322:40: warning: passing 'int *' to parameter of type 'uint32_t *' (aka 'unsigned int *') converts between pointers to integer types with different sign [-Wpointer-sign]
 1322 |         if(!rb_get_end(mapallmem, cur, &prot, &bend)) {
      |                                        ^~~~~
/home/leonpano/box64/src/include/rbtree.h:12:56: note: passing argument to parameter 'val' here
   12 | int rb_get_end(rbtree* tree, uintptr_t addr, uint32_t* val, uintptr_t* end);
      |                                                        ^
/home/leonpano/box64/src/custommem.c:1353:36: warning: passing 'int *' to parameter of type 'uint32_t *' (aka 'unsigned int *') converts between pointers to integer types with different sign [-Wpointer-sign]
 1353 |     if(!rb_get_end(mapallmem, cur, &prot, &bend)) {
      |                                    ^~~~~
/home/leonpano/box64/src/include/rbtree.h:12:56: note: passing argument to parameter 'val' here
   12 | int rb_get_end(rbtree* tree, uintptr_t addr, uint32_t* val, uintptr_t* end);
      |                                                        ^
/home/leonpano/box64/src/custommem.c:1430:40: warning: passing 'int *' to parameter of type 'uint32_t *' (aka 'unsigned int *') converts between pointers to integer types with different sign [-Wpointer-sign]
 1430 |         if(!rb_get_end(mapallmem, cur, &prot, &bend)) {
      |                                        ^~~~~
/home/leonpano/box64/src/include/rbtree.h:12:56: note: passing argument to parameter 'val' here
   12 | int rb_get_end(rbtree* tree, uintptr_t addr, uint32_t* val, uintptr_t* end);

and

/home/leonpano/box64/src/emu/x64emu.c:195:13: error: call to undeclared function 'internal_munmap'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
  195 |         if(!internal_munmap(emu->stack2free, emu->size_stack))
      |             ^
/home/leonpano/box64/src/emu/x64emu.c:196:13: error: call to undeclared function 'freeProtection'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
  196 |             freeProtection((uintptr_t)emu->stack2free, emu->size_stack);
      |             ^
[ 15%] Building C object CMakeFiles/box64.dir/src/emu/x64primop.c.o
/home/leonpano/box64/src/emu/x64emu.c:619:21: error: use of unknown builtin '__builtin_aarch64_get_fpcr' [-Wimplicit-function-declaration]
  619 |     uint64_t fpcr = __builtin_aarch64_get_fpcr();
      |                     ^
/home/leonpano/box64/src/emu/x64emu.c:627:5: error: use of unknown builtin '__builtin_aarch64_set_fpcr' [-Wimplicit-function-declaration]
  627 |     __builtin_aarch64_set_fpcr(fpcr);
      |     ^

from box64.

ptitSeb avatar ptitSeb commented on June 26, 2024

the 1st block is probably easy to fix, but the second part, it will need to be disable to build...

from box64.

leonpano2006 avatar leonpano2006 commented on June 26, 2024

1st part is not fatal
but 2nd part is problem to cause compile fail

from box64.

mcagabe19 avatar mcagabe19 commented on June 26, 2024

/home/leonpano/box64/src/emu/x64emu.c:195:13: error: call to undeclared function 'internal_munmap'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
195 | if(!internal_munmap(emu->stack2free, emu->size_stack))
| ^
/home/leonpano/box64/src/emu/x64emu.c:196:13: error: call to undeclared function 'freeProtection'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
196 | freeProtection((uintptr_t)emu->stack2free, emu->size_stack);
| ^

idk these

/home/leonpano/box64/src/emu/x64emu.c:619:21: error: use of unknown builtin '__builtin_aarch64_get_fpcr' [-Wimplicit-function-declaration]
619 | uint64_t fpcr = __builtin_aarch64_get_fpcr();
| ^
/home/leonpano/box64/src/emu/x64emu.c:627:5: error: use of unknown builtin '__builtin_aarch64_set_fpcr' [-Wimplicit-function-declaration]
627 | __builtin_aarch64_set_fpcr(fpcr);
| ^

these macros are doesn't exists in clang

from box64.

mcagabe19 avatar mcagabe19 commented on June 26, 2024

so yeah if ur linux ur stuck with gcc

from box64.

ptitSeb avatar ptitSeb commented on June 26, 2024

@leonpano2006 about the second blocks of error: it seems you are building box64 without dynarec! Is that on purpose?

from box64.

leonpano2006 avatar leonpano2006 commented on June 26, 2024

@leonpano2006 about the second blocks of error: it seems you are building box64 without dynarec! Is that on purpose?

Build with dynarec

from box64.

ptitSeb avatar ptitSeb commented on June 26, 2024

@leonpano2006 about the second blocks of error: it seems you are building box64 without dynarec! Is that on purpose?

Build with dynarec

Those warning/error:

/home/leonpano/box64/src/emu/x64emu.c:195:13: error: call to undeclared function 'internal_munmap'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
  195 |         if(!internal_munmap(emu->stack2free, emu->size_stack))
      |             ^
/home/leonpano/box64/src/emu/x64emu.c:196:13: error: call to undeclared function 'freeProtection'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
  196 |             freeProtection((uintptr_t)emu->stack2free, emu->size_stack);
      |             ^

Only appeared on non-dynarec build. I have just pushed a fix to it, the #include "custommem.h" was behind a #ifdef DYNAREC

from box64.

leonpano2006 avatar leonpano2006 commented on June 26, 2024
[ 44%] Building C object CMakeFiles/box64.dir/src/emu/x87emu_private.c.o
/home/leonpano/box64/src/emu/x64emu.c:619:21: error: use of unknown builtin '__builtin_aarch64_get_fpcr' [-Wimplicit-function-declaration]
  619 |     uint64_t fpcr = __builtin_aarch64_get_fpcr();
      |                     ^
/home/leonpano/box64/src/emu/x64emu.c:627:5: error: use of unknown builtin '__builtin_aarch64_set_fpcr' [-Wimplicit-function-declaration]
  627 |     __builtin_aarch64_set_fpcr(fpcr);
      |     ^
2 errors generated.
make[2]: *** [CMakeFiles/box64.dir/build.make:527: CMakeFiles/box64.dir/src/emu/x64emu.c.o] Error 1

build with cmake .. -D TEGRA_T194=1 -D CMAKE_BUILD_TYPE=RelWithDebInfo -DCMAKE_C_COMPILER=/usr/bin/clang-19 -D ARM_DYNAREC=ON
but i find sometimes i have to rm build then mkdir build again or it may have such issue like this

leonpano@leonpano-desktop:~/box64/build$ cmake .. -D TEGRA_T194=1 -D CMAKE_BUILD_TYPE=RelWithDebInfo -DCMAKE_C_COMPILER=/usr/bin/clang-19 -D ARM_DYNAREC=ON
-- The C compiler identification is Clang 19.0.0
-- The ASM compiler identification is Clang with GNU-like command-line
-- Found assembler: /usr/bin/clang-18
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /usr/bin/clang-19 - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Configuring done (1.8s)
-- Generating done (0.2s)
-- Build files have been written to: /home/leonpano/box64/build

from box64.

leonpano2006 avatar leonpano2006 commented on June 26, 2024

and after i do this to make it use right version

leonpano@leonpano-desktop:~/box64/build$ cd ..
leonpano@leonpano-desktop:~/box64$ rm -rf build;mkdir build; cd build/
leonpano@leonpano-desktop:~/box64/build$ cmake .. -D TEGRA_T194=1 -D CMAKE_BUILD_TYPE=RelWithDebInfo -DCMAKE_C_COMPILER=/usr/bin/clang-19 -D ARM_DYNAREC=ON
-- Found Python3: /usr/bin/python3.9 (found version "3.9.5") found components: Interpreter 
-- The C compiler identification is Clang 19.0.0
-- The ASM compiler identification is Clang with GNU-like command-line
-- Found assembler: /usr/bin/clang-19
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /usr/bin/clang-19 - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Configuring done (3.4s)
-- Generating done (0.2s)
-- Build files have been written to: /home/leonpano/box64/build

from box64.

leonpano2006 avatar leonpano2006 commented on June 26, 2024

and part you said i build without ARM dynarec just because of error build
but appears issue is not cause by ARM dynarec

from box64.

leonpano2006 avatar leonpano2006 commented on June 26, 2024

i think for now clang is not possible
unfortunately or someone have to fix code for clang to work
i tried clang-16 and 17 and 18 and 19
all clang are the same

build log form clang-19
https://gist.github.com/leonpano2006/72f2a340a8fd3edb42f8a4e5bda80c16

build log form gcc-13
https://gist.github.com/leonpano2006/a85fd3856b5188628f728a1e45e13b8b

from box64.

ptitSeb avatar ptitSeb commented on June 26, 2024

it's easy to fix, but I don't want to have to maintain clang build. If someone do a PR about it, I'll merge it, but I don't want to it myself as I have too many other things to maintain already.

from box64.

mcagabe19 avatar mcagabe19 commented on June 26, 2024

@leonpano2006 after this gets pulled u can build in clang

from box64.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.