LINBIT / drbd-utils

DRBD userspace utilities (for 9.x, 8.4, 8.3)
GNU General Public License v2.0
78 stars 46 forks source link

al_transaction_types is already defined in drbd-headers/drbd_meta_data.h #3

Closed caronc closed 6 years ago

caronc commented 6 years ago

Calling make in CentOS 7.x:

gcc -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches   -m64 -mtune=generic -Wall -I../../drbd-headers -I.. -I. -I../shared    -c -o drbdmeta.o ../shared/drbdmeta.c
../shared/drbdmeta.c:690:6: error: nested redefinition of ‘enum al_transaction_types’
 enum al_transaction_types {
      ^
../shared/drbdmeta.c:690:6: error: redeclaration of ‘enum al_transaction_types’
In file included from ../shared/drbdmeta.c:57:0:
../../drbd-headers/drbd_meta_data.h:56:6: note: originally defined here
 enum al_transaction_types {
      ^
../shared/drbdmeta.c:691:2: error: redeclaration of enumerator ‘AL_TR_UPDATE’
  AL_TR_UPDATE = 0,
  ^
In file included from ../shared/drbdmeta.c:57:0:
../../drbd-headers/drbd_meta_data.h:57:2: note: previous definition of ‘AL_TR_UPDATE’ was here
  AL_TR_UPDATE = 0,
  ^
../shared/drbdmeta.c:692:2: error: redeclaration of enumerator ‘AL_TR_INITIALIZED’
  AL_TR_INITIALIZED = 0xffff
  ^
In file included from ../shared/drbdmeta.c:57:0:
../../drbd-headers/drbd_meta_data.h:58:2: note: previous definition of ‘AL_TR_INITIALIZED’ was here
  AL_TR_INITIALIZED = 0xffff
  ^
make[1]: *** [drbdmeta.o] Error 1
make[1]: Leaving directory `/builddir/build/BUILD/drbd-utils-9.5.0/user/v9'
make: *** [tools] Error 2

This pull request just removes the duplicate definition of al_transaction_types.

rck commented 6 years ago

No, I don't think this is correct. We continuously run CI builds every commit and check for errors (even warnings). As one of the submodule commits changed something related to that, I assume you created a mix and match of main module and submodule (both at HEAD I guess). That would explain your problem. Please try "git submodule update" (after reverting your commit) and try again.

rck commented 6 years ago

no reaction => close

caronc commented 6 years ago

Sorry about the delay in response. I went out of town shortly after I opened the pull request. I was back yesterday, but have not had a chance to try again. Your assumptions were correct though, I was using the master branch of the submodule. I will hopefully try again later this week.

The issue you closed just now however does make drbd-utils compatible with your latest drbd-headers module. Regardless, thanks for your input. I'll open a new ticket if I have any further issues.

rck commented 6 years ago

There is no "however". You are supposed to use the submodule commit that is referenced in the main code. That is how git submodules work, and what git submodule update does. Period. You are not supposed to use a submodule commit that is behind the reference in the main module and you are not supposed to use one that is newer (your case with using HEAD). No "however", you need to look up how git submodules work.

Newer commits in drbd-utils (not pushed), will then reference a submodule commit hat is now the HEAD of the submodule. And then again everything will work as expected (if one knows how to handle git submodules).

Nothing is broken here, you just don't know how git submodules work.