Re: make failing in custom code

2018-09-27 Thread Csaba Raduly
Hi,

On Thu, Sep 27, 2018 at 4:31 PM, Tapas Mishra  wrote:
> Hi,
> I am trying to do a project  when I do a make on project code
> in cygwin environment I get following error
>
> gcc -Wall -g -c main.c -o main.o
> main.c: In function ‘main’:
> main.c:50:8: warning: unused variable ‘physmem’ [-Wunused-variable]
>   char *physmem = page_table_get_physmem(pt);
> ^~~
> gcc -Wall -g -c page_table.c -o page_table.o
> page_table.c: In function ‘page_table_set_entry’:
> page_table.c:125:2: warning: implicit declaration of function
> ‘remap_file_pages’ [-Wimplicit-function-declaration]
>   remap_file_pages(pt->virtmem+page*PAGE_SIZE,PAGE_SIZE,0,frame,0);
>   ^~~~
> gcc -Wall -g -c disk.c -o disk.o
> gcc -Wall -g -c program.c -o program.o
> gcc main.o page_table.o disk.o program.o -o virtmem
> page_table.o: In function `page_table_set_entry':
> /home/DEEL/cs602/try1/page_table.c:125: undefined reference to
> `remap_file_pages'
> /home/DEEL/cs602/try1/page_table.c:125:(.text+0x491): relocation
> truncated to fit: R_X86_64_PC32 against undefined symbol
> `remap_file_pages'
> collect2: error: ld returned 1 exit status
> make: *** [makefile:2: virtmem] Error 1
>
> I compiled the same code on a linux instance hosted on amazon cloud
> and it compiled successfully. So this brought me to a conclusion some
> files are missing in cygwin and hence I reached here.

remap_file_pages is a Linux system call:

http://man7.org/linux/man-pages/man2/remap_file_pages.2.html

It is not implemented on Cygwin.


Csaba
-- 
You can get very substantial performance improvements
by not doing the right thing. - Scott Meyers, An Effective C++11/14 Sampler
So if you're looking for a completely portable, 100% standards-conformat way
to get the wrong information: this is what you want. - Scott Meyers (C++TDaWYK)

--
Problem reports:   http://cygwin.com/problems.html
FAQ:   http://cygwin.com/faq/
Documentation: http://cygwin.com/docs.html
Unsubscribe info:  http://cygwin.com/ml/#unsubscribe-simple



Re: make failing in custom code

2018-09-27 Thread Mark Geisert

Tapas Mishra wrote:

Hi,
I am trying to do a project  when I do a make on project code
in cygwin environment I get following error

gcc -Wall -g -c main.c -o main.o
main.c: In function ‘main’:
main.c:50:8: warning: unused variable ‘physmem’ [-Wunused-variable]
  char *physmem = page_table_get_physmem(pt);
^~~
gcc -Wall -g -c page_table.c -o page_table.o
page_table.c: In function ‘page_table_set_entry’:
page_table.c:125:2: warning: implicit declaration of function
‘remap_file_pages’ [-Wimplicit-function-declaration]
  remap_file_pages(pt->virtmem+page*PAGE_SIZE,PAGE_SIZE,0,frame,0);
  ^~~~
gcc -Wall -g -c disk.c -o disk.o
gcc -Wall -g -c program.c -o program.o
gcc main.o page_table.o disk.o program.o -o virtmem
page_table.o: In function `page_table_set_entry':
/home/DEEL/cs602/try1/page_table.c:125: undefined reference to
`remap_file_pages'
/home/DEEL/cs602/try1/page_table.c:125:(.text+0x491): relocation
truncated to fit: R_X86_64_PC32 against undefined symbol
`remap_file_pages'
collect2: error: ld returned 1 exit status
make: *** [makefile:2: virtmem] Error 1

I compiled the same code on a linux instance hosted on amazon cloud
and it compiled successfully. So this brought me to a conclusion some
files are missing in cygwin and hence I reached here.


I glanced at your pastebin files briefly.  These warnings and errors appear to 
be garden variety coding issues.  Nothing Cygwin-specific that I can see.


The first warning is that you've defined physmem but aren't using that 
definition anywhere in the same function.  The second warning tells that you 
haven't defined remap_file_pages() at any point before it's used in that source 
file.  It needs to be defined before use in that file, or in a header file 
#included before use.  And the error message is messily saying 
remap_file_pages() wasn't defined in any of the object files you're linking.


Dunno how this could work as-is anywhere :-).  Minor tweaks should fix it.

..mark


--
Problem reports:   http://cygwin.com/problems.html
FAQ:   http://cygwin.com/faq/
Documentation: http://cygwin.com/docs.html
Unsubscribe info:  http://cygwin.com/ml/#unsubscribe-simple



make failing in custom code

2018-09-27 Thread Tapas Mishra
Hi,
I am trying to do a project  when I do a make on project code
in cygwin environment I get following error

gcc -Wall -g -c main.c -o main.o
main.c: In function ‘main’:
main.c:50:8: warning: unused variable ‘physmem’ [-Wunused-variable]
  char *physmem = page_table_get_physmem(pt);
^~~
gcc -Wall -g -c page_table.c -o page_table.o
page_table.c: In function ‘page_table_set_entry’:
page_table.c:125:2: warning: implicit declaration of function
‘remap_file_pages’ [-Wimplicit-function-declaration]
  remap_file_pages(pt->virtmem+page*PAGE_SIZE,PAGE_SIZE,0,frame,0);
  ^~~~
gcc -Wall -g -c disk.c -o disk.o
gcc -Wall -g -c program.c -o program.o
gcc main.o page_table.o disk.o program.o -o virtmem
page_table.o: In function `page_table_set_entry':
/home/DEEL/cs602/try1/page_table.c:125: undefined reference to
`remap_file_pages'
/home/DEEL/cs602/try1/page_table.c:125:(.text+0x491): relocation
truncated to fit: R_X86_64_PC32 against undefined symbol
`remap_file_pages'
collect2: error: ld returned 1 exit status
make: *** [makefile:2: virtmem] Error 1

I compiled the same code on a linux instance hosted on amazon cloud
and it compiled successfully. So this brought me to a conclusion some
files are missing in cygwin and hence I reached here.

so let me know what could be missing. If it is possible to know from
above error The code is mostly signal handling virtual memory
implementation in userspace level and handling of block files etc no
where it deals with kernel etc. So I hope it should work in cygwin
environment.

The code on which make is executing can be read/seen here
disk.c https://pastebin.com/uywHhbKZ
disk.h https://pastebin.com/cXKkDifg

main.c https://pastebin.com/z7xakvz5
page_table.c https://pastebin.com/WpVgB9Fh
page_table.h https://pastebin.com/Lur8uJXN
program.c https://pastebin.com/5giXardt

program.h https://pastebin.com/eiyfSNem
makefile https://pastebin.com/Axi9gtFa
---
Thanks

--
Problem reports:   http://cygwin.com/problems.html
FAQ:   http://cygwin.com/faq/
Documentation: http://cygwin.com/docs.html
Unsubscribe info:  http://cygwin.com/ml/#unsubscribe-simple