microsoft / omi

Open Management Infrastructure
Other
360 stars 114 forks source link

multiple definition of `__mi_server #682

Closed vitlav closed 3 years ago

vitlav commented 3 years ago

omi build has multiple definition of `__mi_server:

gcc -o /usr/src/RPM/BUILD/omi-1.6.8/Unix/output/bin/omiserver /usr/src/RPM/BUILD/omi-1.6.8/Unix/output/obj/server/server.o /usr/src/RPM/BUILD/omi-1.6.8/Unix/output/obj/server/servermain.o /usr/src/RPM/BUILD/omi-1.6.8/Unix/output/obj/server/servercommon.o -L/usr/src/RPM/BUILD/omi-1.6.8/Unix/output/lib -L/usr/lib64 -lwsman -lxmlserializer -lhttp -lprotocol -lsock -ldisp -lprovreg -lprovmgr -lmiapi -lwql -lbase -lxml -lpal -lindimgr -lomi_error -lindicmn -lmicodec -lmofparser  -lwsman -lxmlserializer -lhttp -lprotocol -lsock -ldisp -lprovreg -lprovmgr -lmiapi -lwql -lbase -lxml -lpal -lindimgr -lomi_error -lindicmn -lmicodec -lmofparser   -lpthread -ldl -lpam -lssl -lcrypto 
ld: /usr/src/RPM/BUILD/omi-1.6.8/Unix/output/lib/libomi_error.a(schema.o):/usr/src/RPM/BUILD/omi-1.6.8/Unix/omi_error/schema.c:503: multiple definition of `__mi_server'; /usr/src/RPM/BUILD/omi-1.6.8/Unix/output/lib/libprovmgr.a(indicationSchema.o):/usr/src/RPM/BUILD/omi-1.6.8/Unix/provmgr/indicationSchema.c:802: first defined here
JumpingYang001 commented 3 years ago

@vitlav , what is your OS version cat /etc/*-release and gcc & gcc-c++ version? did you follow this https://github.com/microsoft/build-omi?

vitlav commented 3 years ago

@vitlav , what is your OS version cat /etc/*-release and gcc & gcc-c++ version? did you follow this https://github.com/microsoft/build-omi?

It is just a gcc 10 issue. Please, check https://gcc.gnu.org/gcc-10/porting_to.html about multiple definition mistake. I used gcc 10.2.1.

jborean93 commented 3 years ago

While it doesn't fix the underlying issue itself you can ignore it and go back to the pre gcc 10 behaviour with https://github.com/jborean93/omi/blob/297686252944e32d2525ea2f72937df371df8c38/Unix/buildtool#L801-L804.

JumpingYang001 commented 3 years ago

@vitlav @jborean93 thanks for sharing!

because we used redhat5/centos5 to build universal packages, we doesn't meet the issue on our build system. For build the code on latest OS, we doesn't try it yet, maybe we will have chance to try it in the future.

build universal rpm/deb packages docs:

  1. build openssl: https://github.com/microsoft/ostc-openssl
  2. build universal packages: https://github.com/microsoft/Build-omi#building-packages
JumpingYang001 commented 3 years ago

@vitlav @jborean93 I have verified jborean93 's fixes works fine for gcc 10 compilation and the fixes also doesn't break exist build system, and I will new a PR next week to fix the issue, thanks for contribution!