Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Trick to compiling? #1

Open
helpdeskdan opened this issue Mar 2, 2022 · 12 comments
Open

Trick to compiling? #1

helpdeskdan opened this issue Mar 2, 2022 · 12 comments

Comments

@helpdeskdan
Copy link

Am I doing this wrong? Do I need clang? I get tons of u_int vs uint errors, time.h is not sys/time.h - I've got to be doing something terrible wrong. Tips appreciated, thanks.

@Randrianasulu
Copy link
Owner

Randrianasulu commented Mar 2, 2022 via email

@helpdeskdan
Copy link
Author

helpdeskdan commented Mar 2, 2022

The makefile's just a gcc command, there's no XOPEN anywhere in any file. I cobbled the time.h and endian.h, but it's still a bag of worms. I'm afraid I'm no C programmer.

In file included from udf_create.h:39,
                 from udf_write.c:52:
udf_bswap.h:33:10: fatal error: sys/endian.h: No such file or directory
   33 | #include <sys/endian.h>

@Randrianasulu
Copy link
Owner

Randrianasulu commented Mar 2, 2022 via email

@helpdeskdan
Copy link
Author

Like I said, I got rid of a couple errors, but there's a lot. Got time to look?

gcc *.c -o newfs_udf
newfs_udf.c: In function ‘usage’:
newfs_udf.c:824:57: warning: implicit declaration of function ‘getprogname’ [-Wimplicit-function-declaration]
  824 |      "[-t gmtoff] [-v min_udf] [-V max_udf] special\n", getprogname());
      |                                                         ^~~~~~~~~~~
newfs_udf.c:822:33: warning: format ‘%s’ expects argument of type ‘char *’, but argument 3 has type ‘int’ [-Wformat=]
  822 |  (void)fprintf(stderr, "Usage: %s [-cFM] [-L loglabel] "
      |                                ~^
      |                                 |
      |                                 char *
      |                                %d
  823 |      "[-P discid] [-S sectorsize] [-s size] [-p perc] "
  824 |      "[-t gmtoff] [-v min_udf] [-V max_udf] special\n", getprogname());
      |                                                         ~~~~~~~~~~~~~
      |                                                         |
      |                                                         int
newfs_udf.c: In function ‘main’:
newfs_udf.c:840:2: warning: implicit declaration of function ‘setprogname’ [-Wimplicit-function-declaration]
  840 |  setprogname(argv[0]);
      |  ^~~~~~~~~~~
newfs_udf.c:852:26: warning: implicit declaration of function ‘time’; did you mean ‘utimes’? [-Wimplicit-function-declaration]
  852 |  srandom((unsigned long) time(NULL));
      |                          ^~~~
      |                          utimes
newfs_udf.c:865:7: warning: implicit declaration of function ‘localtime’ [-Wimplicit-function-declaration]
  865 |  tm = localtime(&now);
      |       ^~~~~~~~~
newfs_udf.c:865:5: warning: assignment to ‘struct tm *’ from ‘int’ makes pointer from integer without a cast [-Wint-conversion]
  865 |  tm = localtime(&now);
      |     ^
newfs_udf.c:866:21: error: dereferencing pointer to incomplete type ‘struct tm’
  866 |  context.gmtoff = tm->tm_gmtoff;
      |                     ^~
udf_create.c:33:9: error: expected declaration specifiers or ‘...’ before string constant
   33 | __RCSID("$NetBSD: udf_create.c,v 1.30 2021/08/20 20:25:26 andvar Exp $");
      |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from udf_create.c:46:
unicode.h: In function ‘wget_utf8’:
unicode.h:69:53: error: expected declaration specifiers before ‘__unused’
   69 | static u_int16_t wget_utf8(const char **, size_t *) __unused;
      |                                                     ^~~~~~~~
unicode.h:70:49: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘__unused’
   70 | static int wput_utf8(char *, size_t, u_int16_t) __unused;
      |                                                 ^~~~~~~~
unicode.h:78:1: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘{’ token
   78 | {
      | ^
unicode.h:132:1: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘{’ token
  132 | {
      | ^
In file included from udf_create.h:33,
                 from udf_create.c:47:

@Randrianasulu
Copy link
Owner

Randrianasulu commented Mar 2, 2022 via email

@Randrianasulu
Copy link
Owner

@helpdeskdan
Copy link
Author

gcc *.c -o newfs_udf `pkg-config --cflags libbsd-overlay

Well... that does seem to help a little. The unused def helps. Let's see.... put a "stdint.h" here, a sys/time.h there.... linking error! Nuts! getprogname is in bsd/stdlib.h, not sure how to get it work.

gcc *.c -o newfs_udf `pkg-config --cflags libbsd-overlay` 
udf_create.c: In function ‘udf_calculate_disc_layout’:
udf_create.c:412:48: warning: format ‘%llu’ expects argument of type ‘long long unsigned int’, but argument 2 has type ‘uint64_t’ {aka ‘long unsigned int’} [-Wformat=]
  412 |  printf("Total space on this medium approx. %llu KiB, %llu MiB\n",
      |                                             ~~~^
      |                                                |
      |                                                long long unsigned int
      |                                             %lu
  413 |    kbsize/1024, kbsize/(1024*1024));
      |    ~~~~~~~~~~~                                  
      |          |
      |          uint64_t {aka long unsigned int}
udf_create.c:412:58: warning: format ‘%llu’ expects argument of type ‘long long unsigned int’, but argument 3 has type ‘uint64_t’ {aka ‘long unsigned int’} [-Wformat=]
  412 |  printf("Total space on this medium approx. %llu KiB, %llu MiB\n",
      |                                                       ~~~^
      |                                                          |
      |                                                          long long unsigned int
      |                                                       %lu
  413 |    kbsize/1024, kbsize/(1024*1024));
      |                 ~~~~~~~~~~~~~~~~~~                        
      |                       |
      |                       uint64_t {aka long unsigned int}
udf_create.c:416:47: warning: format ‘%llu’ expects argument of type ‘long long unsigned int’, but argument 2 has type ‘uint64_t’ {aka ‘long unsigned int’} [-Wformat=]
  416 |  printf("Free space on this volume approx. %llu KiB, %llu MiB\n\n",
      |                                            ~~~^
      |                                               |
      |                                               long long unsigned int
      |                                            %lu
  417 |    kbsize/1024, kbsize/(1024*1024));
      |    ~~~~~~~~~~~                                 
      |          |
      |          uint64_t {aka long unsigned int}
udf_create.c:416:57: warning: format ‘%llu’ expects argument of type ‘long long unsigned int’, but argument 3 has type ‘uint64_t’ {aka ‘long unsigned int’} [-Wformat=]
  416 |  printf("Free space on this volume approx. %llu KiB, %llu MiB\n\n",
      |                                                      ~~~^
      |                                                         |
      |                                                         long long unsigned int
      |                                                      %lu
  417 |    kbsize/1024, kbsize/(1024*1024));
      |                 ~~~~~~~~~~~~~~~~~~                       
      |                       |
      |                       uint64_t {aka long unsigned int}
udf_create.c: In function ‘udf_add_logvol_part_sparable’:
udf_create.c:980:11: warning: taking address of packed member of ‘struct part_map_spare’ may result in an unaligned pointer value [-Waddress-of-packed-member]
  980 |  st_pos = &pmap->pms.st_loc[0];
      |           ^~~~~~~~~~~~~~~~~~~~
udf_create.c: In function ‘udf_update_lvintd’:
udf_create.c:1203:8: warning: taking address of packed member of ‘struct logvol_int_desc’ may result in an unaligned pointer value [-Waddress-of-packed-member]
 1203 |  pos = &lvid->tables[0];
      |        ^~~~~~~~~~~~~~~~
udf_create.c: In function ‘udf_extattr_append_internal’:
udf_create.c:1784:23: warning: taking address of packed member of ‘struct impl_extattr_entry’ may result in an unaligned pointer value [-Waddress-of-packed-member]
 1784 |   spos = (uint16_t *) implext->data;
      |                       ^~~~~~~
/usr/bin/ld: /tmp/ccudWxD2.o: in function `usage':
newfs_udf.c:(.text+0x121d): undefined reference to `getprogname'
/usr/bin/ld: /tmp/ccudWxD2.o: in function `main':
newfs_udf.c:(.text+0x1282): undefined reference to `setprogname'
/usr/bin/ld: newfs_udf.c:(.text+0x16ec): undefined reference to `bsd_getopt'
collect2: error: ld returned 1 exit status
make: *** [Makefile:2: all] Error 1

@Randrianasulu
Copy link
Owner

Randrianasulu commented Mar 3, 2022 via email

@helpdeskdan
Copy link
Author

Say, that might have done it!

Usage: newfs_udf [-cFM] [-L loglabel] [-P discid] [-S sectorsize] [-s size] [-p perc] [-t gmtoff] [-v min_udf] [-V max_udf] special

Few warnings:

gcc *.c -o newfs_udf `pkg-config --cflags libbsd-overlay pkg-config --libs libbsd-overlay` 
udf_create.c: In function ‘udf_calculate_disc_layout’:
udf_create.c:412:48: warning: format ‘%llu’ expects argument of type ‘long long unsigned int’, but argument 2 has type ‘uint64_t’ {aka ‘long unsigned int’} [-Wformat=]
  412 |  printf("Total space on this medium approx. %llu KiB, %llu MiB\n",
      |                                             ~~~^
      |                                                |
      |                                                long long unsigned int
      |                                             %lu
  413 |    kbsize/1024, kbsize/(1024*1024));
      |    ~~~~~~~~~~~                                  
      |          |
      |          uint64_t {aka long unsigned int}
udf_create.c:412:58: warning: format ‘%llu’ expects argument of type ‘long long unsigned int’, but argument 3 has type ‘uint64_t’ {aka ‘long unsigned int’} [-Wformat=]
  412 |  printf("Total space on this medium approx. %llu KiB, %llu MiB\n",
      |                                                       ~~~^
      |                                                          |
      |                                                          long long unsigned int
      |                                                       %lu
  413 |    kbsize/1024, kbsize/(1024*1024));
      |                 ~~~~~~~~~~~~~~~~~~                        
      |                       |
      |                       uint64_t {aka long unsigned int}
udf_create.c:416:47: warning: format ‘%llu’ expects argument of type ‘long long unsigned int’, but argument 2 has type ‘uint64_t’ {aka ‘long unsigned int’} [-Wformat=]
  416 |  printf("Free space on this volume approx. %llu KiB, %llu MiB\n\n",
      |                                            ~~~^
      |                                               |
      |                                               long long unsigned int
      |                                            %lu
  417 |    kbsize/1024, kbsize/(1024*1024));
      |    ~~~~~~~~~~~                                 
      |          |
      |          uint64_t {aka long unsigned int}
udf_create.c:416:57: warning: format ‘%llu’ expects argument of type ‘long long unsigned int’, but argument 3 has type ‘uint64_t’ {aka ‘long unsigned int’} [-Wformat=]
  416 |  printf("Free space on this volume approx. %llu KiB, %llu MiB\n\n",
      |                                                      ~~~^
      |                                                         |
      |                                                         long long unsigned int
      |                                                      %lu
  417 |    kbsize/1024, kbsize/(1024*1024));
      |                 ~~~~~~~~~~~~~~~~~~                       
      |                       |
      |                       uint64_t {aka long unsigned int}
udf_create.c: In function ‘udf_add_logvol_part_sparable’:
udf_create.c:980:11: warning: taking address of packed member of ‘struct part_map_spare’ may result in an unaligned pointer value [-Waddress-of-packed-member]
  980 |  st_pos = &pmap->pms.st_loc[0];
      |           ^~~~~~~~~~~~~~~~~~~~
udf_create.c: In function ‘udf_update_lvintd’:
udf_create.c:1203:8: warning: taking address of packed member of ‘struct logvol_int_desc’ may result in an unaligned pointer value [-Waddress-of-packed-member]
 1203 |  pos = &lvid->tables[0];
      |        ^~~~~~~~~~~~~~~~
udf_create.c: In function ‘udf_extattr_append_internal’:
udf_create.c:1784:23: warning: taking address of packed member of ‘struct impl_extattr_entry’ may result in an unaligned pointer value [-Waddress-of-packed-member]
 1784 |   spos = (uint16_t *) implext->data;
      |                       ^~~~~~~

@helpdeskdan
Copy link
Author

Granted, Linux lacking UDF 2.5 write support, I've accomplished rather a Pyrrhic victory with no ability to put anything on said filesystem....

@Randrianasulu
Copy link
Owner

Randrianasulu commented Mar 3, 2022 via email

@helpdeskdan
Copy link
Author

2.01 is supposed to be R/W in Linux. (Disclaimer: Haven't tried)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants