Opened 6 years ago

Closed 6 years ago

Last modified 6 years ago

#57225 closed defect (fixed)

testdisk @7.0 build failure after update of libewf: error: use of undeclared identifier 'LIBEWF_OPEN_READ_WRITE'

Reported by: Klaskviker Owned by: kencu (Ken)
Priority: Normal Milestone:
Component: ports Version:
Keywords: Cc: kencu (Ken), RJVB (René Bertin)
Port: testdisk

Description (last modified by jmroot (Joshua Root))

after port seftupdate && port upgrade outdated, libewf no longer builds on El Capitan as a dependency of testdisk:

Making all in src
make[2]: Entering directory `/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_sysutils_testdisk/testdisk/work/testdisk-7.0/src'
  CC       autoset.o
  CC       common.o
  CC       crc.o
  CC       ewf.o
clangclang: : clangwarningclang: : warningwarning: warning: argument unused during compilation: '-fnested-functions'argument unused during compilation: '-fnested-functions'
: : argument unused during compilation: '-fnested-functions'argument unused during compilation: '-fnested-functions'


In file included from crc.c:29:
./common.h:37:19: warning: unknown attribute 'gcc_struct' ignored [-Wunknown-attributes]
} __attribute__ ((gcc_struct, __packed__));
                  ^
In file included from autoset.c:27:
./common.h:37:19: warning: unknown attribute 'gcc_struct' ignored [-Wunknown-attributes]
} __attribute__ ((gcc_struct, __packed__));
                  ^
1 warning generated.
In file included from ewf.c:52:
./common.h:37:19: warning: unknown attribute 'gcc_struct' ignored [-Wunknown-attributes]
1 warning generated.
} __attribute__ ((gcc_struct, __packed__));
                  ^
In file included from ewf.c:60:
In file included from /opt/local/include/libewf.h:25:
In file included from /opt/local/include/libewf/codepage.h:25:
/opt/local/include/libewf/types.h:172:9: warning: 'HAVE_OFF64_T' macro redefined [-Wmacro-redefined]
#define HAVE_OFF64_T    1
        ^
../config.h:261:9: note: previous definition is here
#define HAVE_OFF64_T 0
        ^
In file included from common.c:49:
./common.h:37:19: warning: unknown attribute 'gcc_struct' ignored [-Wunknown-attributes]
} __attribute__ ((gcc_struct, __packed__));
                  ^
  CC       fnctdsk.o
ewf.c:182:4: error: use of undeclared identifier 'LIBEWF_OPEN_READ_WRITE'; did you mean 'LIBEWF_ACCESS_FLAG_WRITE'?
          LIBEWF_OPEN_READ_WRITE,
          ^~~~~~~~~~~~~~~~~~~~~~
          LIBEWF_ACCESS_FLAG_WRITE
/opt/local/include/libewf/definitions.h:43:2: note: 'LIBEWF_ACCESS_FLAG_WRITE' declared here
        LIBEWF_ACCESS_FLAG_WRITE                                = 0x02,
        ^
  CC       hdaccess.o
ewf.c:398:30: warning: unused parameter 'disk' [-Wunused-parameter]
static int fewf_sync(disk_t *disk)
                             ^
ewf.c:409:12: warning: implicit declaration of function 'libewf_handle_read_random' is invalid in C99 [-Wimplicit-function-declaration]
  taille = libewf_handle_read_random(
           ^
ewf.c:440:12: warning: implicit declaration of function 'libewf_handle_write_random' is invalid in C99 [-Wimplicit-function-declaration]
  taille = libewf_handle_write_random(
           ^
ewf.c:460:52: warning: unused parameter 'buffer' [-Wunused-parameter]
static int fewf_nopwrite(disk_t *disk, const void *buffer, const unsigned int count, const uint64_t offset)
                                                   ^
6 warnings and 1 error generated.
make[2]: *** [ewf.o] Error 1
make[2]: *** Waiting for unfinished jobs....
clang: warningclang: : argument unused during compilation: '-fnested-functions'
warning: argument unused during compilation: '-fnested-functions'
In file included from fnctdsk.c:35:
./common.h:37:19: warning: unknown attribute 'gcc_struct' ignored [-Wunknown-attributes]
} __attribute__ ((gcc_struct, __packed__));
                  ^
In file included from hdaccess.c:44:
./common.h:37:19: warning: unknown attribute 'gcc_struct' ignored [-Wunknown-attributes]
} __attribute__ ((gcc_struct, __packed__));
                  ^
1 warning generated.
hdaccess.c:138:19: warning: unknown attribute 'gcc_struct' ignored [-Wunknown-attributes]
} __attribute__ ((gcc_struct, __packed__));
                  ^
hdaccess.c:579:62: warning: unused parameter 'hd_h' [-Wunused-parameter]
static void disk_get_geometry(CHSgeometry_t *geom, const int hd_h, const char *device, const int verbose)
                                                             ^
hdaccess.c:937:38: warning: unused parameter 'hd_h' [-Wunused-parameter]
static void disk_get_model(const int hd_h, disk_t *dev, const unsigned int verbose)
                                     ^
hdaccess.c:937:52: warning: unused parameter 'dev' [-Wunused-parameter]
static void disk_get_model(const int hd_h, disk_t *dev, const unsigned int verbose)
                                                   ^
hdaccess.c:937:76: warning: unused parameter 'verbose' [-Wunused-parameter]
static void disk_get_model(const int hd_h, disk_t *dev, const unsigned int verbose)
                                                                           ^
hdaccess.c:1291:56: warning: unused parameter 'buf' [-Wunused-parameter]
static int file_nopwrite(disk_t *disk_car, const void *buf, const unsigned int count, const uint64_t offset)
                                                       ^
hdaccess.c:1521:41: warning: cast from 'unsigned char *' to 'unsigned long *' increases required alignment from 1 to 8 [-Wcast-align]
    if(memcmp(buffer,"DOSEMU",6)==0 && *(unsigned long*)(buffer+11)>0)
                                        ^~~~~~~~~~~~~~~~~~~~~~~~~~~
hdaccess.c:1524:33: warning: cast from 'unsigned char *' to 'unsigned long *' increases required alignment from 1 to 8 [-Wcast-align]
      disk_car->geom.cylinders=*(unsigned long*)(buffer+15);
                                ^~~~~~~~~~~~~~~~~~~~~~~~~~~
hdaccess.c:1525:42: warning: cast from 'unsigned char *' to 'unsigned long *' increases required alignment from 1 to 8 [-Wcast-align]
      disk_car->geom.heads_per_cylinder=*(unsigned long*)(buffer+7);
                                         ^~~~~~~~~~~~~~~~~~~~~~~~~~
hdaccess.c:1526:40: warning: cast from 'unsigned char *' to 'unsigned long *' increases required alignment from 1 to 8 [-Wcast-align]
      disk_car->geom.sectors_per_head=*(unsigned long*)(buffer+11);
                                       ^~~~~~~~~~~~~~~~~~~~~~~~~~~
hdaccess.c:1528:25: warning: cast from 'unsigned char *' to 'unsigned long *' increases required alignment from 1 to 8 [-Wcast-align]
      disk_car->offset=*(unsigned long*)(buffer+19);
                        ^~~~~~~~~~~~~~~~~~~~~~~~~~~
hdaccess.c:209:21: warning: unused function 'hd_glob_parse' [-Wunused-function]
static list_disk_t *hd_glob_parse(const char *device_pattern, list_disk_t *list_disk, const int verbose, const int testdisk_mode)
                    ^
1 warning generated.
13 warnings generated.
make[2]: Leaving directory `/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_sysutils_testdisk/testdisk/work/testdisk-7.0/src'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_sysutils_testdisk/testdisk/work/testdisk-7.0'
make: *** [all] Error 2
make: Leaving directory `/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_sysutils_testdisk/testdisk/work/testdisk-7.0'
Command failed:  cd "/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_sysutils_testdisk/testdisk/work/testdisk-7.0" && /usr/bin/make -j4 -w all 
Exit code: 2
Error: Failed to build testdisk: command execution failed
Error: See /opt/local/var/macports/logs/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_sysutils_testdisk/testdisk/main.log for details.
Error: rev-upgrade failed: Error rebuilding testdisk
Error: Follow https://guide.macports.org/#project.tickets to report a bug.
sh-3.2# 

testdisk's dependencies (osxfuse) were previously built by copying MacOSX10.11.sdk into Xcode 8.2.1' SDK folder.

Change History (16)

comment:1 Changed 6 years ago by jmroot (Joshua Root)

Description: modified (diff)
Milestone: MacPorts 2.7.0
Priority: HighNormal

comment:2 Changed 6 years ago by jmroot (Joshua Root)

Cc: kencu added

comment:3 Changed 6 years ago by kencu (Ken)

Yes. Sorry for breaking your software with the recent update of libewf. It was hard to test fully, because osxfuse doesn't seem to build on any of the buildbots, so all the builds fail.

LIBEWF_OPEN_READ_WRITE no longer exists in the libewf definitions, I see. There is LIBEWF_OPEN_READ and LIBEWF_OPEN_WRITE. I will have to see what is to be done about this.

testdisk is already at the current version of 7.0, and I can't find at the moment any repository of the sourcecode to see if this has already been fixed upstream in testdisk.

comment:4 Changed 6 years ago by kencu (Ken)

Port: testdisk added; libewf removed
Summary: libewf won't build after port upgradetestdisk @7.0 build failure after update of libewf: error: use of undeclared identifier 'LIBEWF_OPEN_READ_WRITE'

comment:5 Changed 6 years ago by kencu (Ken)

I'll ask Rene to check this perhaps, as he uses this software and fixed sleuthkit to build against the new libewf already.

Version 0, edited 6 years ago by kencu (Ken) (next)

comment:6 Changed 6 years ago by kencu (Ken)

Cc: RJVB added

comment:7 in reply to:  4 Changed 6 years ago by Klaskviker

Replying to kencu:

I could build Testdisk with the ports tree of two weeks ago, merely by copying MacOSX10.11.sdk into XCode 8' SDK folder, selecting 7.3.1 and then revert back to 8.

comment:8 Changed 6 years ago by Klaskviker

How do I revert the libewf port to the previous version in my ports tree?

comment:9 in reply to:  6 ; Changed 6 years ago by RJVB (René Bertin)

Replying to kencu:

That wasn't asking me - next time CC' me first and then add a comment why so I get that in my mail ;)

Anyway, try this in the file(s) that requires the undefined token:

#define LIBEWF_OPEN_READ_WRITE (LIBEWF_ACCESS_FLAG_READ|LIBEWF_ACCESS_FLAG_WRITE)

or activate the previous version of libewf via port activate libewf to check the actual definition of LIBEWF_OPEN_READ_WRITE. My hunch is though that you can simply set both read and write flags to open something in read+write mode.

If the trick above works we can consider adding it to libewf/definitions.h to avoid having to patch all dependents (though in theory the dependent port maintainers should do exactly that...)

comment:10 Changed 6 years ago by kencu (Ken)

So, Klashviker, first of all, sorry for breaking your port. I should have handled this differently, making a libewf-devel port and then assessing breakage. I may still do that.

But for right now, please

sudo port -v activate libewf

and when it shows you the list of installed versions, hit the number that corresponds to the previous version. It will stay like that until you change it, and then you'll be back where you were. You may not even need to rebuild testdisk after that, as things will just be "as they were".

Hopefully RJVB or I can fix testdisk to work against the current libewf. Sounds like testdisk is actively maintained, but I can't find a bug tracker or a source repo for it at this time.

comment:11 in reply to:  10 ; Changed 6 years ago by Klaskviker

Replying to kencu:

So, Klashviker, first of all, sorry for breaking your port. I should have handled this differently, making a libewf-devel port and then assessing breakage. I may still do that.

But for right now, please

sudo port -v activate libewf

and when it shows you the list of installed versions, hit the number that corresponds to the previous version. It will stay like that until you change it, and then you'll be back where you were. You may not even need to rebuild testdisk after that, as things will just be "as they were".

Hopefully RJVB or I can fix testdisk to work against the current libewf. Sounds like testdisk is actively maintained, but I can't find a bug tracker or a source repo for it at this time.

I can't restore a previous version of libewf, because I deleted them all when trying to fix the issue ((

Could you please restore the old version of libewf in the main port and move the current version to libewf-devel? Because it is possible that other ports will be affected.

comment:12 in reply to:  9 Changed 6 years ago by Klaskviker

Replying to RJVB:

Replying to kencu:

That wasn't asking me - next time CC' me first and then add a comment why so I get that in my mail ;)

Anyway, try this in the file(s) that requires the undefined token:

#define LIBEWF_OPEN_READ_WRITE (LIBEWF_ACCESS_FLAG_READ|LIBEWF_ACCESS_FLAG_WRITE)

or activate the previous version of libewf via port activate libewf to check the actual definition of LIBEWF_OPEN_READ_WRITE. My hunch is though that you can simply set both read and write flags to open something in read+write mode.

If the trick above works we can consider adding it to libewf/definitions.h to avoid having to patch all dependents (though in theory the dependent port maintainers should do exactly that...)

I'm sorry I'm not a developer, in what file(s) should I add these headers?

comment:13 Changed 6 years ago by kencu (Ken)

There is a PR in place that appears to fix testdisk for the slightly changed API in libewf 2017.

<https://github.com/macports/macports-ports/pull/2710>

It builds. The changes are very logical. If anyone uses testdisk on images that libewf is involved in, please test this out and give a yea or nay.

comment:14 in reply to:  11 Changed 6 years ago by RJVB (René Bertin)

Replying to Klaskviker:

I can't restore a previous version of libewf, because I deleted them all when trying to fix the issue ((

That's really a pity, because it's one of the really nice things of MacPorts.

For the future: there's never a reason to uninstall old, inactive versions of a port when you have an issue with a new version.

comment:15 Changed 6 years ago by kencu (Ken)

Owner: set to kencu
Resolution: fixed
Status: newclosed

In e819237c338c35f77d8d752eba2cabca5e038e8a/macports-ports (master):

testdisk: update for libewf 20171104

closes #57225

comment:16 in reply to:  13 Changed 6 years ago by Klaskviker

Replying to kencu:

There is a PR in place that appears to fix testdisk for the slightly changed API in libewf 2017.

<https://github.com/macports/macports-ports/pull/2710>

It builds. The changes are very logical. If anyone uses testdisk on images that libewf is involved in, please test this out and give a yea or nay.

Testdisk now is a clean built after a fresh port update, thanks guys.

Note: See TracTickets for help on using tickets.