drorgl / esp32-tinyemu

A fork to Fabrice Bellard's TinyEmu ported to ESP32
MIT License
51 stars 14 forks source link

redefinition of 'clock_gettime' #6

Open tonyxforce opened 1 year ago

tonyxforce commented 1 year ago

I cloned the repo, opened it in vscode, hit upload and got this error:

 *  Executing task: C:\Users\domi\.platformio\penv\Scripts\platformio.exe run --target upload 

Processing native (platform: native)
---------------------------------------------------------------------------------------------------------------------------------------Verbose mode can be enabled via `-v, --verbose` option
LDF: Library Dependency Finder -> https://bit.ly/configure-pio-ldf
LDF Modes: Finder ~ chain, Compatibility ~ soft
Found 15 compatible libraries
Scanning dependencies...
Dependency Graph
|-- tinyemu @ 1.0.0  
|-- sdmount
|-- log_c
|-- simpleconsole    
|-- uartconsole      
|-- virtual_directory
Building in release mode
Compiling .pio\build\native\src\temu.o
Compiling .pio\build\native\lib60a\direct_cache\direct_cache.o
Compiling .pio\build\native\lib8ce\log_c\log.o
lib\direct_cache\direct_cache.c: In function 'direct_cache_init':
lib\direct_cache\direct_cache.c:32:29: warning: assignment to 'void *' from 'size_t' {aka 'long long unsigned int'} makes pointer from 
integer without a cast [-Wint-conversion]
   32 |         cache->cache[i].key = i + 1;
      |                             ^
lib\direct_cache\direct_cache.c: In function 'direct_cache_remove':
lib\direct_cache\direct_cache.c:58:28: warning: assignment to 'void *' from 'int' makes pointer from integer without a cast [-Wint-conversion]
   58 |     cache->cache[cell].key = cell + 1;
      |                            ^
Compiling .pio\build\native\libaa2\list\llist.o
Compiling .pio\build\native\libaa2\list\llist_iterator.o
Compiling .pio\build\native\libaa2\list\llist_node.o
Archiving .pio\build\native\lib8ce\liblog_c.a
Archiving .pio\build\native\libaa2\liblist.a
Archiving .pio\build\native\lib60a\libdirect_cache.a
Indexing .pio\build\native\lib8ce\liblog_c.a
Indexing .pio\build\native\lib60a\libdirect_cache.a
Indexing .pio\build\native\libaa2\liblist.a
Compiling .pio\build\native\libf7f\avltree\avltree.o
Compiling .pio\build\native\libbb7\memory_indexer\memory_indexer.o
lib\memory_indexer\memory_indexer.c: In function 'memory_indexer_init':
lib\memory_indexer\memory_indexer.c:34:53: warning: implicit declaration of function 'malloc' [-Wimplicit-function-declaration]
   34 |     memory_indexer_t *indexer = (memory_indexer_t *)malloc(sizeof(memory_indexer_t));
      |                                                     ^~~~~~
lib\memory_indexer\memory_indexer.c:34:53: warning: incompatible implicit declaration of built-in function 'malloc'
lib\memory_indexer\memory_indexer.c:5:1: note: include '<stdlib.h>' or provide a declaration of 'malloc'
    4 | #include <string.h>
  +++ |+#include <stdlib.h>
    5 |
lib\memory_indexer\memory_indexer.c: In function 'memory_indexer_set':
lib\memory_indexer\memory_indexer.c:44:67: warning: incompatible implicit declaration of built-in function 'malloc'
   44 |     struct memory_wrapper *memory_item = (struct memory_wrapper *)malloc(sizeof(struct memory_wrapper));
      |                                                                   ^~~~~~
lib\memory_indexer\memory_indexer.c:44:67: note: include '<stdlib.h>' or provide a declaration of 'malloc'
lib\memory_indexer\memory_indexer.c: In function 'memory_indexer_search':
lib\memory_indexer\memory_indexer.c:60:35: warning: initialization of 'struct avl_node_t *' from incompatible pointer type 'struct avl_node *' [-Wincompatible-pointer-types]
   60 |     struct avl_node_t *avl_node = avl_search(&indexer->avl_tree, &query.avl, cmp_func);
      |                                   ^~~~~~~~~~
lib\memory_indexer\memory_indexer.c: In function 'memory_indexer_remove':
lib\memory_indexer\memory_indexer.c:72:35: warning: initialization of 'struct avl_node_t *' from incompatible pointer type 'struct avl_node *' [-Wincompatible-pointer-types]
   72 |     struct avl_node_t *avl_node = avl_search(&indexer->avl_tree, &query.avl, cmp_func);
      |                                   ^~~~~~~~~~
lib\memory_indexer\memory_indexer.c:76:40: warning: passing argument 2 of 'avl_remove' from incompatible pointer type [-Wincompatible-pointer-types]
   76 |         avl_remove(&indexer->avl_tree, avl_node);
      |                                        ^~~~~~~~
      |                                        |
      |                                        struct avl_node_t *
In file included from lib\memory_indexer\memory_indexer.c:3:
lib\avltree/avltree.h:89:34: note: expected 'struct avl_node *' but argument is of type 'struct avl_node_t *'
   89 |                 struct avl_node *node);
      |                 ~~~~~~~~~~~~~~~~~^~~~
lib\memory_indexer\memory_indexer.c:77:9: warning: implicit declaration of function 'free' [-Wimplicit-function-declaration]
   77 |         free(wrapper);
      |         ^~~~
lib\memory_indexer\memory_indexer.c:77:9: warning: incompatible implicit declaration of built-in function 'free'
lib\memory_indexer\memory_indexer.c:77:9: note: include '<stdlib.h>' or provide a declaration of 'free'
lib\memory_indexer\memory_indexer.c:79:12: warning: 'return' with a value, in function returning void [-Wreturn-type]
   79 |     return NULL;
      |            ^~~~
lib\memory_indexer\memory_indexer.c:68:6: note: declared here
   68 | void memory_indexer_remove(memory_indexer_t *indexer, size_t key)
      |      ^~~~~~~~~~~~~~~~~~~~~
lib\memory_indexer\memory_indexer.c: In function 'memory_indexer_free':
lib\memory_indexer\memory_indexer.c:85:35: warning: initialization of 'struct avl_node_t *' from incompatible pointer type 'struct avl_node *' [-Wincompatible-pointer-types]
   85 |     struct avl_node_t *avl_node = avl_first(&indexer->avl_tree);
      |                                   ^~~~~~~~~
lib\memory_indexer\memory_indexer.c:89:29: warning: passing argument 1 of 'avl_next' from incompatible pointer type [-Wincompatible-pointer-types]
   89 |         avl_node = avl_next(avl_node);
      |                             ^~~~~~~~
      |                             |
      |                             struct avl_node_t *
In file included from lib\memory_indexer\memory_indexer.c:3:
lib\avltree/avltree.h:92:44: note: expected 'struct avl_node *' but argument is of type 'struct avl_node_t *'
   92 | struct avl_node* avl_next(struct avl_node *node);
      |                           ~~~~~~~~~~~~~~~~~^~~~
lib\memory_indexer\memory_indexer.c:89:18: warning: assignment to 'struct avl_node_t *' from incompatible pointer type 'struct avl_node *' [-Wincompatible-pointer-types]
   89 |         avl_node = avl_next(avl_node);
      |                  ^
Compiling .pio\build\native\lib8b6\lru_cache\lru_cache.o
Compiling .pio\build\native\lib799\HimemAllocator\himem_access\emulated_himem.o
lib\lru_cache\lru_cache.c: In function 'lru_cache_flush_items':
lib\lru_cache\lru_cache.c:108:64: warning: passing argument 2 of 'memory_indexer_remove' makes integer from pointer without a cast [-Wint-conversion]
  108 |         memory_indexer_remove(cache->memory_indexer, cache_item->key);
      |                                                      ~~~~~~~~~~^~~~~
      |                                                                |
      |                                                                void *
In file included from lib\lru_cache\lru_cache.c:5:
lib\memory_indexer/memory_indexer.h:12:62: note: expected 'size_t' {aka 'long long unsigned int'} but argument is of type 'void *'     
   12 | void memory_indexer_remove(memory_indexer_t *indexer, size_t key);
      |                                                       ~~~~~~~^~~
Compiling .pio\build\native\lib799\HimemAllocator\himem_access\esp32_himem.o
Archiving .pio\build\native\libbb7\libmemory_indexer.a
Archiving .pio\build\native\libf7f\libavltree.a
Indexing .pio\build\native\libbb7\libmemory_indexer.a
Archiving .pio\build\native\lib8b6\liblru_cache.a
Compiling .pio\build\native\lib799\HimemAllocator\himem_allocator.o
Indexing .pio\build\native\libf7f\libavltree.a
In file included from src\temu.c:81:
lib\simpleconsole/simpleconsole.h: In function 'simple_console_get_size':
lib\simpleconsole/simpleconsole.h:87:20: warning: unused variable 'ws' [-Wunused-variable]
   87 |     struct winsize ws;
      |                    ^~
src\temu.c: In function 'main':
src\temu.c:768:34: warning: variable 'build_preload_file' set but not used [-Wunused-but-set-variable]
  768 |     const char *path, *cmdline, *build_preload_file;
      |                                  ^~~~~~~~~~~~~~~~~~
Indexing .pio\build\native\lib8b6\liblru_cache.a
Compiling .pio\build\native\libb0a\page_cache\page_cache.o
Compiling .pio\build\native\lib9c7\VMM\vmm.o
lib\page_cache\page_cache.c:28:1: warning: no semicolon at end of struct or union
   28 | };
      | ^
lib\page_cache\page_cache.c: In function 'on_page_flush':
lib\page_cache\page_cache.c:46:26: warning: passing argument 1 of 'page_cache->on_flush' makes integer from pointer without a cast [-Wint-conversion]
   46 |     page_cache->on_flush(key,page_cache->flush_buffer, page_cache->flush_context);
      |                          ^~~
      |                          |
      |                          void *
lib\page_cache\page_cache.c:46:26: note: expected 'size_t' {aka 'long long unsigned int'} but argument is of type 'void *'
lib\page_cache\page_cache.c: In function 'page_cache_get':
lib\page_cache\page_cache.c:73:86: warning: passing argument 2 of 'direct_cache_get' makes pointer from integer without a cast [-Wint-conversion]
   73 |     struct page_cache_item_t *page_item = direct_cache_get(page_cache->direct_cache, page_number);
      |                                                                                      ^~~~~~~~~~~
      |                                                                                      |
      |                                                                                      size_t {aka long long unsigned int}       
In file included from lib\page_cache\page_cache.c:10:
lib\direct_cache/direct_cache.h:10:53: note: expected 'void *' but argument is of type 'size_t' {aka 'long long unsigned int'}
   10 | void *direct_cache_get(direct_cache_t *cache, void *key);
      |                                               ~~~~~~^~~
lib\page_cache\page_cache.c:75:58: warning: passing argument 2 of 'lru_cache_get' makes pointer from integer without a cast [-Wint-conversion]
   75 |         page_item = lru_cache_get(page_cache->lru_cache, page_number);
      |                                                          ^~~~Compiling .pio\build\native\libdb7\virtual_directory\virtual_directory.o
~~~~~~~
      |                                                          |
      |                                                          size_t {aka long long unsigned int}
In file included from lib\page_cache\page_cache.c:9:
lib\lru_cache/lru_cache.h:14:43: note: expected 'void *' but argument is of type 'size_t' {aka 'long long unsigned int'}
   14 | void *lru_cache_get(cache_t *cache, void *key);
      |                                     ~~~~~~^~~
Compiling .pio\build\native\lib226\tinyemu\aes.o
lib\page_cache\page_cache.c: In function 'page_cache_set':
lib\page_cache\page_cache.c:91:86: warning: passing argument 2 of 'direct_cache_get' makes pointer from integer without a cast [-Wint-conversion]
   91 |     struct page_cache_item_t *page_item = direct_cache_get(page_cache->direct_cache, page_number);
      |                                                                                      ^~~~~~~~~~~
      |                                                                                      |
      |                                                                                      size_t {aka long long unsigned int}       
In file included from lib\page_cache\page_cache.c:10:
Archiving .pio\build\native\libb0a\libpage_cache.a
lib\direct_cache/direct_cache.h:10:53: note: expected 'void *' but argument is of type 'size_t' {aka 'long long unsigned int'}
   10 | void *direct_cache_get(direct_cache_t *cache, void *key);
      |                                               ~~~~~~^~~
Archiving .pio\build\native\lib799\libHimemAllocator.a
lib\page_cache\page_cache.c:93:58: warning: passing argument 2 of 'lru_cache_get' makes pointer from integer without a cast [-Wint-conversion]
Compiling .pio\build\native\lib226\tinyemu\cutils.o
   93 |         page_item = lru_cache_get(page_cache->lru_cache, page_number);
Indexing .pio\build\native\libb0a\libpage_cache.a
      |                                                          ^~~~~~~~~Archiving .pio\build\native\libdb7\libvirtual_directory.a
~~
Indexing .pio\build\native\lib799\libHimemAllocator.a
      |                                                          |
Compiling .pio\build\native\lib226\tinyemu\fs.o
      |                                                          size_t {aka long long unsigned int}
Indexing .pio\build\native\libdb7\libvirtual_directory.a
In file included from lib\page_cache\page_cache.c:9:
lib\lru_cache/lru_cache.h:14:43: note: expected 'void *' but argument is of type 'size_t' {aka 'long long unsigned int'}
   14 | void *lru_cache_get(cache_t *cache, void *key);
      |                                     ~~~~~~^~~
lib\page_cache\page_cache.c:116:62: warning: passing argument 2 of 'lru_cache_remove' makes pointer from integer without a cast [-Wint-conversion]
  116 |             lru_cache_remove(page_cache->lru_cache, page_item->page_number);
      |                                                     ~~~~~~~~~^~~~~~~~~~~~~
      |                                                              |
      |                                                              size_t {aka long long unsigned int}
In file included from lib\page_cache\page_cache.c:9:
lib\lru_cache/lru_cache.h:18:46: note: expected 'void *' but argument is of type 'size_t' {aka 'long long unsigned int'}
   18 | void lru_cache_remove(cache_t * cache, void* key);
      |                                        ~~~~~~^~~
lib\page_cache\page_cache.c:117:68: warning: passing argument 2 of 'direct_cache_remove' makes pointer from integer without a cast [-Wint-conversion]
  117 |             direct_cache_remove(page_cache->direct_cache, page_item->page_number);
      |                                                           ~~~~~~~~~^~~~~~~~~~~~~
Compiling .pio\build\native\lib226\tinyemu\fs_utils.o
      |                                                                    |
Compiling .pio\build\native\lib226\tinyemu\ide.o
      |                                                                    size_t {aka long long unsigned int}
In file included from lib\page_cache\page_cache.c:10:
Compiling .pio\build\native\lib226\tinyemu\iomem.o
lib\direct_cache/direct_cache.h:13:55: note: expected 'void *' but argument is of type 'size_t' {aka 'long long unsigned int'}
   13 | void direct_cache_remove(direct_cache_t *cache, void *key);
Compiling .pio\build\native\lib226\tinyemu\json.o
      |                                                 ~~~~~~^~~
Compiling .pio\build\native\lib226\tinyemu\machine.o
lib\page_cache\page_cache.c:127:46: warning: passing argument 2 of 'lru_cache_add' makes pointer from integer without a cast [-Wint-conversion]
  127 |         lru_cache_add(page_cache->lru_cache, page_number, page_item);
      |                                              ^~~~~~~~~~~
      |                                              |
      |                                              size_t {aka long long unsigned int}
In file included from lib\page_cache\page_cache.c:9:
lib\lru_cache/lru_cache.h:23:42: note: expected 'void *' but argument is of type 'size_t' {aka 'long long unsigned int'}
   23 | void lru_cache_add(cache_t *cache, void *key, void *value);
      |                                    ~~~~~~^~~
Compiling .pio\build\native\lib226\tinyemu\pci.o
lib\page_cache\page_cache.c:128:51: warning: passing argument 2 of 'direct_cache_set' makes pointer from integer without a cast [-Wint-conversion]
Compiling .pio\build\native\lib226\tinyemu\pckbd.o
  128 |         direct_cache_set(page_cache->direct_cache,page_number, page_item);
      |                                                   ^~~~~~~~~~Compiling .pio\build\native\lib226\tinyemu\ps2.o
~
      |                                                   |
      |                                                   size_t {aka long long unsigned int}
In file included from lib\page_cache\page_cache.c:10:
lib\direct_cache/direct_cache.h:12:52: note: expected 'void *' but argument is of type 'size_t' {aka 'long long unsigned int'}
   12 | void direct_cache_set(direct_cache_t *cache, void *key, void *value);
      |                                              ~~~~~~Archiving .pio\build\native\lib9c7\libVMM.a
^~~
lib\tinyemu\iomem.c: In function 'phys_mem_get_ram_ptr':
lib\tinyemu\iomem.c:289:20: warning: initialization of 'uint64_t' {aka 'long long unsigned int'} from 'uint8_t *' {aka 'unsigned char *'} makes integer from pointer without a cast [-Wint-conversion]
  289 |     uint64_t ptr = pr->phys_mem + /*(uintptr_t)*/offset;
      |                    ^~
Compiling .pio\build\native\lib226\tinyemu\riscv_cpu128.o
lib\VMM\vmm.c: In function 'backing_store_write':
Indexing .pio\build\native\lib9c7\libVMM.a
lib\VMM\vmm.c:115:49: warning: passing argument 3 of 'page_cache_set' discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers]
  115 |     page_cache_set(vmm->page_cache,page_number, buf);
Compiling .pio\build\native\lib226\tinyemu\riscv_cpu32.o
      |                                                 ^~~
In file included from lib\VMM\vmm.h:9,
                 from lib\VMM\vmm.c:1:
Compiling .pio\build\native\lib226\tinyemu\riscv_cpu64.o
lib\page_cache/page_cache.h:17:73: note: expected 'void *' but argument is of type 'const uint8_t *' {aka 'const unsigned char *'}
   17 | void page_cache_set(page_cache_t *page_cache, size_t page_number, void *buff);
      |                                                                   ~~~~~~^~~~
lib\tinyemu\ide.c: In function 'padstr':
lib\tinyemu\ide.c:244:19: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
  244 |         *(char *)((long)str ^ 1) = v;
      |                   ^
lib\tinyemu\ide.c:244:10: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
Compiling .pio\build\native\lib226\tinyemu\riscv_machine.o
  244 |         *(char *)((long)str ^ 1) = v;
      |          ^
Compiling .pio\build\native\lib226\tinyemu\sha256.o
Compiling .pio\build\native\lib226\tinyemu\simplefb.o
Compiling .pio\build\native\lib226\tinyemu\softfp.o
Compiling .pio\build\native\lib226\tinyemu\splitimg.o
lib\tinyemu\riscv_machine.c:87:5: error: redefinition of 'clock_gettime'
   87 | int clock_gettime(int x, struct timespec *spec)      //C-file part
      |     ^~~~~~~~~~~~~
In file included from C:/TDM-GCC-64/x86_64-w64-mingw32/include/time.h:308,
                 from lib\tinyemu\riscv_machine.c:33:
C:/TDM-GCC-64/x86_64-w64-mingw32/include/pthread_time.h:115:12: note: previous definition of 'clock_gettime' was here
  115 | inline int clock_gettime(__winpthreads_clockid_t clock_id, struct timespec *tp) { return __pthread_clock_gettime(clock_id, tp); }
      |            ^~~~~~~~~~~~~
*** [.pio\build\native\lib226\tinyemu\riscv_machine.o] Error 1
===================================================== [FAILED] Took 15.44 seconds =====================================================
drorgl commented 1 year ago

You're trying to build a native executable (i.e. Windows/Linux/Mac), build the esp32 env.

pio run -e esp32 -t upload