Opened 4 years ago

Closed 4 years ago

Last modified 4 years ago

#6136 closed defect (fixed)

Mac OMEdit fails to build

Reported by: Adam Dershowitz Owned by: Martin Sjölund
Priority: high Milestone: 1.17.0
Component: Build Environment Version:
Keywords: Cc:

Description

I just tried to upgrade openmodelica-devel from 1.16.0~dev-614-gd632ddd_0 to 1.16.0~dev-647-g2a078a0_0
and it fails to build.

I've attached the log.

Attachments (2)

main.log (8.0 MB ) - added by Adam Dershowitz 4 years ago.
main.2.log (4.8 MB ) - added by Adam Dershowitz 4 years ago.
Build log 1.17.0~dev-5-g6c92491_0

Change History (54)

by Adam Dershowitz, 4 years ago

Attachment: main.log added

comment:1 by Adam Dershowitz, 4 years ago

As another data point, I just tried to upgrade again (now to 1.17.0~dev-1-ga4caee9_0) and it still fails.
Please let me know if you have any suggestions, as I'm happy to do what I can to help get the Mac version working again.

comment:2 by Adrian Pop, 4 years ago

This seems to be the problem:

:info:build /opt/local/var/macports/build/_opt_local_var_macports_sources_build.openmodelica.
org_macports_lang_openmodelica-devel/openmodelica-devel/work/
openmodelica_1.16.0~dev-646-g9613d0e/OMSimulator/3rdParty/FMIL/ThirdParty/Minizip/
minizip/miniunz.c:143:11: error: implicit declaration of function 'mkdir' is invalid in C99 [-Werror,-Wimplicit-function-declaration]

I'll see what I can do as it compiles fine for us.

comment:3 by Adam Dershowitz, 4 years ago

That error is also present for the newer attempt as well.
I am using the newest version of Xcode (12.0.1), if that might be at all related.

comment:4 by Adrian Pop, 4 years ago

Can you edit:
OpenModelica/OMCompiler/3rdParty/FMIL/ThirdParty/Minizip/minizip/miniunz.c
and apply the following change? Add the green stuff on line 31.

  • FMIL/ThirdParty/Minizip/minizip/miniunz.c

    diff --git a/FMIL/ThirdParty/Minizip/minizip/miniunz.c b/FMIL/ThirdParty/Minizip/minizip/miniunz.c
    index 19311615..b39dc9d7 100644
    a b  
    2828#endif
    2929
    3030#ifdef __APPLE__
     31#include <sys/stat.h>
    3132// In darwin and perhaps other BSD variants off_t is a 64 bit value, hence no need for specific 64 bit functions
    3233#define FOPEN_FUNC(filename, mode) fopen(filename, mode)
    3334#define FTELLO_FUNC(stream) ftello(stream)

Then try to compile again.

comment:5 by Adam Dershowitz, 4 years ago

I tried it, but I'm getting the same error.
To be specific, I edited the file that was still present after the build attempt:
/opt/local/var/macports/build/_opt_local_var_macports_sources_build.openmodelica.org_macports_lang_openmodelica-devel/openmodelica-devel/work/openmodelica_1.17.0~dev-1-ga4caee9/OMCompiler/3rdParty/FMIL/ThirdParty/Minizip/minizip/miniunz.c

Then, redid the build and got the same error as before.

comment:6 by Adrian Pop, 4 years ago

Maybe the build overwrites the change, restores the miniunz.c file.
I will attempt a fix on this end.

Last edited 4 years ago by Adrian Pop (previous) (diff)

comment:8 by Adam Dershowitz, 4 years ago

No. I confirmed that my edited version, with your change, is still there.
I also noticed that that the file is also in OMSimulator/3rdParty/FMIL/ThirdParty/Minizip/minizip/miniunz.c so I changed that one as well. But, it didn't help.
I'll try again in a little while, to hopefully get that PR.

comment:9 by Adrian Pop, 4 years ago

I now merged the PR in the master. Note that the change is in OpenModelica/OMCompiler/3rdParty
which is a submodule, you need to do:

# After cloning
> cd OpenModelica
> git checkout master
> git pull
> git submodule foreach --recursive "git checkout master"
# To update; you will need to merge each submodule, but your changes will remain
> git submodule foreach --recursive "git pull"
# Running master on all submodules might lead to build errors
# so use this to make sure you force all submodules to the commits
# from the OpenModelica glue project which are properly tested
> git submodule update --force --init --recursive

comment:10 by Adrian Pop, 4 years ago

Please do the build with some logging so you can attach the new file here, maybe there is some other error.

comment:11 by Adam Dershowitz, 4 years ago

I've only done builds of OM using Macports. So, it handles all downloads and building.
Do you mean that I should clone, outside of macport, then copy over the files into the Macport build directory and rebuild?

comment:12 by Adrian Pop, 4 years ago

Ah, sorry, I think I updated the macports as well, just go for that!
I thought you compiled from via git from scratch.

comment:13 by Adam Dershowitz, 4 years ago

I just tried again with Macports. I see the same error. It is version 1.17.0~dev-5-g6c92491_0. My guess is it didn't capture your changes yet. Is there an easy way to check?
I'l attach the log.

by Adam Dershowitz, 4 years ago

Attachment: main.2.log added

Build log 1.17.0~dev-5-g6c92491_0

comment:14 by Adrian Pop, 4 years ago

You do have the latest code and it does seem to have the same error. Completely weird. I really need access to a proper mac to test this stuff.

comment:15 by Adrian Pop, 4 years ago

What do you get if in a terminal you write:

man 2 mkdir

It should tell you which header file to include <sys/stat.h> which I did but if I look at the bottom it seems that also <sys/types.h> is needed.

Let's try another edit of file:
/opt/local/var/macports/build/_opt_local_var_macports_sources_build.openmodelica.org_macports_lang_openmodelica-devel/openmodelica-devel/work/openmodelica_1.17.0~dev-5-g6c92491/OMSimulator/3rdParty/FMIL/ThirdParty/Minizip/minizip/miniunz.c
and add #include <sys/types.h> before #include <sys/stat.h> at line 31.
Then try to build again.

comment:16 by Adam Dershowitz, 4 years ago

The man shows:

LEGACY SYNOPSIS
     #include <sys/types.h>
     #include <sys/stat.h>

     The include file <sys/types.h> is necessary.

I'll try the edit and let you know.
What I'm really curious about what has recently changed? Did this file change at all recently?

comment:17 by Adrian Pop, 4 years ago

Not at all, this file hasn't changed for years 4+ or more.

comment:18 by Adrian Pop, 4 years ago

But I guess your compiler has changed and it is more picky with some thing.

comment:19 by Adam Dershowitz, 4 years ago

When I opened that file it did not have either of the #includes. I added both and then tried to rebuild and i get the same error as before.

comment:20 by Adrian Pop, 4 years ago

Geez, we have two of 3rdParty and they both include FMIL and the bad include file. I only fixed OMCompiler/3rdParty, I need to fix OMSimulator/3rdParty as well. I'll do that.

comment:21 by Adam Dershowitz, 4 years ago

I actually see that filename in four places:

OMSimulator/3rdParty/zlib/minizip/miniunz.c
OMSimulator/3rdParty/zlib/zlib-1.2.11/contrib/minizip/miniunz.c
OMSimulator/3rdParty/FMIL/ThirdParty/Minizip/minizip/miniunz.c
OMCompiler/3rdParty/FMIL/ThirdParty/Minizip/minizip/miniunz.c

But, I think that the error has only been for the one that you noticed. I can try to change the others as well, to see what happens.

comment:22 by Mahder Alemseged Gebremedhin, 4 years ago

But I guess your compiler has changed and it is more picky with some thing.

I think it is C and -Werror,-Wimplicit-function-declaration combo that causes the error. The chances are that he probably did not have either -Werror or -Wimplicit-function-declaration set before.

Without those two flags compilation will probably succeed using implicit function declration. I think this happens even on Windows and Linux with FMIL sublibs, that is if you set -Werror=implicit-function-declaration you can't compile 3rdParty/FMIL/....

Last edited 4 years ago by Mahder Alemseged Gebremedhin (previous) (diff)

in reply to:  21 comment:23 by Adam Dershowitz, 4 years ago

Replying to dersh:

I actually see that filename in four places:

I tried to make those includes in all 4 files, but it didn't solve the problem.

comment:24 by Adrian Pop, 4 years ago

Ouch, what is the error now? Still the same?

in reply to:  22 comment:25 by Adrian Pop, 4 years ago

Replying to mahge930:

But I guess your compiler has changed and it is more picky with some thing.

I think it is C and -Werror,-Wimplicit-function-declaration combo that causes the error. The chances are that he probably did not have either -Werror or -Wimplicit-function-declaration set before.

Without those two flags compilation will probably succeed using implicit function declration. I think this happens even on Windows and Linux with FMIL sublibs, that is if you set -Werror=implicit-function-declaration you can't compile 3rdParty/FMIL/....

I guess macports build sets these extra warnings-as-error flags. I'm not sure if we can do something about it.

comment:26 by Adam Dershowitz, 4 years ago

Yes:

:info:build [ 34%] Building C object CMakeFiles/fmicapi.dir/src/CAPI/src/FMI2/fmi2_capi_me.c.o
:info:build config.status: creating include/Makefile
:info:build /opt/local/var/macports/build/_opt_local_var_macports_sources_build.openmodelica.org_macports_lang_openmodelica-devel/openmodelica-devel/work/openmodelica_1.17.0~dev-5-g6c92491/OMSimulator/3rdParty/FMIL/ThirdParty/Minizip/minizip/miniunz.c:110:13: warning: extra tokens at end of #ifdef directive [-Wextra-tokens]
:info:build #ifdef unix || __APPLE__
:info:build             ^
:info:build             //
:info:build /opt/local/var/macports/build/_opt_local_var_macports_sources_build.openmodelica.org_macports_lang_openmodelica-devel/openmodelica-devel/work/openmodelica_1.17.0~dev-5-g6c92491/OMSimulator/3rdParty/FMIL/ThirdParty/Minizip/minizip/miniunz.c:143:11: error: implicit declaration of function 'mkdir' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
:info:build     ret = mkdir (dirname,0775);
:info:build           ^
:info:build /opt/local/var/macports/build/_opt_local_var_macports_sources_build.openmodelica.org_macports_lang_openmodelica-devel/openmodelica-devel/work/openmodelica_1.17.0~dev-5-g6c92491/OMSimulator/3rdParty/FMIL/ThirdParty/Minizip/minizip/miniunz.c:432:25: warning: passing 'const char *' to parameter of type 'char *' discards qualifiers [-Wincompatible-pointer-types-discards-qualifiers]
:info:build                 makedir(write_filename);
:info:build                         ^~~~~~~~~~~~~~
:info:build 2 warnings and 1 error generated.
:info:build make[4]: *** [Config.cmake/Minizip/CMakeFiles/minizip.dir/__/__/ThirdParty/Minizip/minizip/miniunz.c.o] Error 1
:info:build make[4]: Leaving directory `/opt/local/var/macports/build/_opt_local_var_macports_sources_build.openmodelica.org_macports_lang_openmodelica-devel/openmodelica-devel/work/openmodelica_1.17.0~dev-5-g6c92491/OMSimulator/3rdParty/FMIL/build/mac'
:info:build make[3]: *** [Config.cmake/Minizip/CMakeFiles/minizip.dir/all] Error 2
:info:build make[3]: *** Waiting for unfinished jobs....

comment:27 by Adam Dershowitz, 4 years ago

comment:28 by Adrian Pop, 4 years ago

It seems it reverts your edits as it points to the same line 143 and if you add 2 includes it should have been 145.

comment:29 by Adrian Pop, 4 years ago

As far as I can tell macports seem to impose those GCC flags on the build, we don't put anything like that in the Portfile.

comment:30 by Adam Dershowitz, 4 years ago

I'll try the newer version, since I now see: 1.17.0~dev-6-gaa4dcca_0 Perhaps that will include your changes?

I also found that Xcode 12 release notes say:
Clang now reports an error when you use a function without an explicit declaration when building C or Objective-C code for macOS (-Werror=implicit-function-declaration flag is on). This additional error detection unifies Clang’s behavior for iOS/tvOS and macOS 64-bit targets for this diagnostic. (49917738)
https://developer.apple.com/documentation/xcode-release-notes/xcode-12-release-notes

I don't know why macports would be adding gcc flags. But, it should be possible to set specific flags in a Portfile. According to thishttps://developer.apple.com/forums/thread/127217, there is a "-Wno-implicit-function-declaration" the might help. I'll see what happens.

comment:31 by Adrian Pop, 4 years ago

Try the new port: 1.17.0~dev-7-gfacfb1f

comment:32 by Adam Dershowitz, 4 years ago

No luck. I tried the new one, and verified that both of the includes are now in /work/openmodelica_1.17.0~dev-7-gfacfb1f/OMSimulator/3rdParty/FMIL/ThirdParty/Minizip/minizip/miniunz.c but I'm getting the same error:

:info:build [ 34%] Building C object CMakeFiles/fmicapi.dir/src/CAPI/src/FMI2/fmi2_capi_me.c.o
:info:build config.status: creating include/Makefile
:info:build /opt/local/var/macports/build/_opt_local_var_macports_sources_build.openmodelica.org_macports_lang_openmodelica-devel/openmodelica-devel/work/openmodelica_1.17.0~dev-5-g6c92491/OMSimulator/3rdParty/FMIL/ThirdParty/Minizip/minizip/miniunz.c:110:13: warning: extra tokens at end of #ifdef directive [-Wextra-tokens]
:info:build #ifdef unix || __APPLE__
:info:build             ^
:info:build             //
:info:build /opt/local/var/macports/build/_opt_local_var_macports_sources_build.openmodelica.org_macports_lang_openmodelica-devel/openmodelica-devel/work/openmodelica_1.17.0~dev-5-g6c92491/OMSimulator/3rdParty/FMIL/ThirdParty/Minizip/minizip/miniunz.c:143:11: error: implicit declaration of function 'mkdir' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
:info:build     ret = mkdir (dirname,0775);
:info:build           ^
:info:build /opt/local/var/macports/build/_opt_local_var_macports_sources_build.openmodelica.org_macports_lang_openmodelica-devel/openmodelica-devel/work/openmodelica_1.17.0~dev-5-g6c92491/OMSimulator/3rdParty/FMIL/ThirdParty/Minizip/minizip/miniunz.c:432:25: warning: passing 'const char *' to parameter of type 'char *' discards qualifiers [-Wincompatible-pointer-types-discards-qualifiers]
:info:build                 makedir(write_filename);
:info:build                         ^~~~~~~~~~~~~~
:info:build 2 warnings and 1 error generated.
:info:build make[4]: *** [Config.cmake/Minizip/CMakeFiles/minizip.dir/__/__/ThirdParty/Minizip/minizip/miniunz.c.o] Error 1
:info:build make[4]: Leaving directory `/opt/local/var/macports/build/_opt_local_var_macports_sources_build.openmodelica.org_macports_lang_openmodelica-devel/openmodelica-devel/work/openmodelica_1.17.0~dev-5-g6c92491/OMSimulator/3rdParty/FMIL/build/mac'
:info:build make[3]: *** [Config.cmake/Minizip/CMakeFiles/minizip.dir/all] Error 2
:info:build make[3]: *** Waiting for unfinished jobs....

comment:33 by Adam Dershowitz, 4 years ago

I tried to insert the following into my local Portfile:

configure.cflags-append -Wno-implicit-function-declaration

I was hoping that would solve the problem. The strange thing is that it allowed a bunch more progress, but didn't solve it. So now my log file has the same error, for a different file:

:info:build [ 57%] Building CXX object runtime/CMakeFiles/antlr4_static.dir/src/atn/PredictionMode.cpp.o
:info:build cd "/opt/local/var/macports/build/_Users_adershowitz_Programming_ports_lang_openmodelica-devel/openmodelica-devel/work/openmodelica_1.17.0~dev-7-gfacfb1f/OMParser/3rdParty/antlr4/runtime/Cpp/build/runtime" && /Library/Developer/CommandLineTools/usr/bin/clang++  -I"/opt/local/var/macports/build/_Users_adershowitz_Programming_ports_lang_openmodelica-devel/openmodelica-devel/work/openmodelica_1.17.0~dev-7-gfacfb1f/OMParser/3rdParty/antlr4/runtime/Cpp/runtime/src" -I"/opt/local/var/macports/build/_Users_adershowitz_Programming_ports_lang_openmodelica-devel/openmodelica-devel/work/openmodelica_1.17.0~dev-7-gfacfb1f/OMParser/3rdParty/antlr4/runtime/Cpp/runtime/src/atn" -I"/opt/local/var/macports/build/_Users_adershowitz_Programming_ports_lang_openmodelica-devel/openmodelica-devel/work/openmodelica_1.17.0~dev-7-gfacfb1f/OMParser/3rdParty/antlr4/runtime/Cpp/runtime/src/dfa" -I"/opt/local/var/macports/build/_Users_adershowitz_Programming_ports_lang_openmodelica-devel/openmodelica-devel/work/openmodelica_1.17.0~dev-7-gfacfb1f/OMParser/3rdParty/antlr4/runtime/Cpp/runtime/src/misc" -I"/opt/local/var/macports/build/_Users_adershowitz_Programming_ports_lang_openmodelica-devel/openmodelica-devel/work/openmodelica_1.17.0~dev-7-gfacfb1f/OMParser/3rdParty/antlr4/runtime/Cpp/runtime/src/support" -I"/opt/local/var/macports/build/_Users_adershowitz_Programming_ports_lang_openmodelica-devel/openmodelica-devel/work/openmodelica_1.17.0~dev-7-gfacfb1f/OMParser/3rdParty/antlr4/runtime/Cpp/runtime/src/support/utf8" -I"/opt/local/var/macports/build/_Users_adershowitz_Programming_ports_lang_openmodelica-devel/openmodelica-devel/work/openmodelica_1.17.0~dev-7-gfacfb1f/OMParser/3rdParty/antlr4/runtime/Cpp/runtime/src/tree" -I"/opt/local/var/macports/build/_Users_adershowitz_Programming_ports_lang_openmodelica-devel/openmodelica-devel/work/openmodelica_1.17.0~dev-7-gfacfb1f/OMParser/3rdParty/antlr4/runtime/Cpp/runtime/src/tree/pattern" -I"/opt/local/var/macports/build/_Users_adershowitz_Programming_ports_lang_openmodelica-devel/openmodelica-devel/work/openmodelica_1.17.0~dev-7-gfacfb1f/OMParser/3rdParty/antlr4/runtime/Cpp/runtime/src/tree/xpath" -Wall -pedantic -W -std=c++11 -stdlib=libc++ -O3 -DNDEBUG -O3 -DNDEBUG  -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk -mmacosx-version-min=10.15 -Wno-overloaded-virtual -Wno-dollar-in-identifier-extension -Wno-four-char-constants  -std=gnu++11 -o CMakeFiles/antlr4_static.dir/src/atn/PredictionMode.cpp.o -c "/opt/local/var/macports/build/_Users_adershowitz_Programming_ports_lang_openmodelica-devel/openmodelica-devel/work/openmodelica_1.17.0~dev-7-gfacfb1f/OMParser/3rdParty/antlr4/runtime/Cpp/runtime/src/atn/PredictionMode.cpp"
:info:build open62541.c:27031:8: error: implicit declaration of function 'gethostname' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
:info:build     if(gethostname(hostname, 255) == 0) {
:info:build        ^
:info:build open62541.c:27031:8: note: did you mean 'gethostbyname'?
:info:build /Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk/usr/include/netdb.h:275:17: note: 'gethostbyname' declared here
:info:build struct hostent  *gethostbyname(const char *);
:info:build                  ^
:info:build open62541.c:27034:29: error: implicitly declaring library function 'snprintf' with type 'int (char *, unsigned long, const char *, ...)' [-Werror,-Wimplicit-function-declaration]
:info:build         du.length = (size_t)snprintf(discoveryUrl, 255, "opc.tcp://%s:%d",
:info:build                             ^
:info:build open62541.c:27034:29: note: include the header <stdio.h> or explicitly provide a declaration for 'snprintf'
:info:build if /bin/sh ../../../libtool --tag=CXX --mode=compile /usr/bin/clang++  -DHAVE_CONFIG_H -I. -I`echo .`     -pipe -Os -Wno-implicit-function-declaration -isysroot/Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk -arch x86_64 -fno-stack-protector -pipe -Os -stdlib=libc++ -isysroot/Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk -arch x86_64 -std=c++11   -DIPOPT_BUILD -MT IpOptionsList.lo -MD -MP -MF ".deps/IpOptionsList.Tpo" -c -o IpOptionsList.lo IpOptionsList.cpp; \
:info:build 	then mv -f ".deps/IpOptionsList.Tpo" ".deps/IpOptionsList.Plo"; else rm -f ".deps/IpOptionsList.Tpo"; exit 1; fi
:info:build 2 errors generated.
:info:build make[3]: *** [open62541.o] Error 1
:info:build make[3]: Leaving directory `/opt/local/var/macports/build/_Users_adershowitz_Programming_ports_lang_openmodelica-devel/openmodelica-devel/work/openmodelica_1.17.0~dev-7-gfacfb1f/OMCompiler/SimulationRuntime/opc/ua'
:info:build make[2]: *** [opc] Error 2
:info:build make[2]: *** Waiting for unfinished jobs....

comment:34 by Adam Dershowitz, 4 years ago

I also tried to insert each of these in the Portfile:

configure.cppflags-append -Wno-implicit-function-declaration
configure.cppflags-delete -Wimplicit-function-declaration

But, neither seemed to help it get any further.

comment:35 by Adrian Pop, 4 years ago

We need do find a way to fix this, it can be either of:

  1. find a way to disable the flags from macport
  2. add these flags as default for all the builds and fix all the issues in our code and 3rdParty libs

@dersh, I think you're on the good path with configure.cppflags-delete or configure.cppflags-append.
Try using configure.cxxflags-delete or configure.cxxflags-append instead and let us know if that works.

Last edited 4 years ago by Adrian Pop (previous) (diff)

comment:36 by Adam Dershowitz, 4 years ago

I tried both of those also, and didn't get any further.
I don't see why it would work for miniunz.c, but not for open62541.c It seems like somehow the make process must be picking up some flag from somewhere else.

comment:37 by Mahder Alemseged Gebremedhin, 4 years ago

It should be configure.cflags-delete instead of configure.cxxflags-delete right?

The error message is confusing because it looks like it is for CXX(in antlr4) file but it is for a C file. And it is still setting [-Werror,-Wimplicit-function-declaration]

Btw this specific C file is confusing because it is located in 3rdParty/open62541 originally but it is then copied to SimulationRuntime/opc/ua by the Makefiles in there and then compiled there. I think we add -Werror=implicit-function-declaration ourselves to the compilations in SimulationRuntime.

I guess we should include the header files <unistd.h> (for gethostname) <stdio.h> (for snprintf) at the top of 3rdParty/open62541/open62541.c

OR

You can also delete Werror itself instead of -Wimplicit-function-declaration.

configure.cflags-delete -Werror

Adding -Werror to all compilations is a very restrictive addition in my opinion.

Last edited 4 years ago by Mahder Alemseged Gebremedhin (previous) (diff)

comment:38 by Adam Dershowitz, 4 years ago

I tried configure.cflags-delete as well, without any luck.

I tried adding <unistd.h> (for gethostname) <stdio.h> (for snprintf) at the top of 3rdParty/open62541/open62541.c (and the above) without any luck building.

And, I tried using:

configure.cflags-delete -Werror

and I still am not having any luck. It seems as though the flag settings in the portfile are not making it to open62541. Are some other flags being set somehow that are overriding? Might it relate to how the files are copied and compiled in a different directory (as you mentioned earlier)?

comment:39 by Mahder Alemseged Gebremedhin, 4 years ago

The error messages did not even change when you added the includes?

In that case can you check the file OMCompiler/SimulationRuntime/opc/ua/open62541.c and see if it also has the includes you added? If not, it means it has not updated (copied over) after you modified the original one.

comment:40 by Adam Dershowitz, 4 years ago

No, the error message didn't change, before. But, I now have gotten it to build successfully.

What worked was to add to the Portfile

configure.cflags-delete -Werror

and let it fail. I then edited both copies (just to make sure) of open62541.c

#include <unistd.h>
#include <stdio.h>

I then rebuilt and it worked.

in reply to:  36 ; comment:41 by Francesco Casella, 4 years ago

Replying to dersh:

I don't see why it would work for miniunz.c, but not for open62541.c It seems like somehow the make process must be picking up some flag from somewhere else.

If I showed this to my wife, she would probably think we are totally insane.

Maybe she would have a point, after all :)

in reply to:  41 comment:42 by Adam Dershowitz, 4 years ago

Replying to casella:

Replying to dersh:

I don't see why it would work for miniunz.c, but not for open62541.c It seems like somehow the make process must be picking up some flag from somewhere else.

If I showed this to my wife, she would probably think we are totally insane.

Maybe she would have a point, after all :)

I wouldn't argue with her.

comment:43 by Adrian Pop, 4 years ago

Milestone: Future1.17.0
Resolution: fixed
Status: newclosed

I now added the macports control files to:
https://github.com/OpenModelica/OpenModelicaBuildScripts/commit/837f0ad14cca6b7ad65260fd41f4402756832821
and apply your change:
https://github.com/OpenModelica/OpenModelicaBuildScripts/commit/b33195b65175d086f8ab032d77c8090b9c5a29e9
Then also fixed the open62541.c includes in 3rdParty:
https://github.com/OpenModelica/OMCompiler-3rdParty/pull/68
and finally updated the 3rdParty inside OpenModelica/OMCpompiler
https://github.com/OpenModelica/OpenModelica/pull/6792

Hopefully you won't need to manually play with it anymore (well, until the next slip of macports). Reopen when needed.

comment:44 by Adam Dershowitz, 4 years ago

I just tried the new build (1.17.0~dev-11-g5580cb6_0) and it works!
Thank you!

comment:45 by Francesco Casella, 4 years ago

@adrpo, should we try to backport this to 1.16.0 as well? Or do we risk to cause more trouble?

comment:46 by Adrian Pop, 4 years ago

Not needed. Is only on some Macs that these issues are present, on our own Mac where we build, it works fine without any of these.

Last edited 4 years ago by Adrian Pop (previous) (diff)

comment:47 by Adam Dershowitz, 4 years ago

Likely it is any Mac that has been updated to Xcode 12. The update is free so it is probably common for anyone who does development. But, if OM 1.17 is becoming "current" there is probably little reason for people to go back to 1.16.

comment:48 by Francesco Casella, 4 years ago

The plan is to release 1.17.0 Beta by Christmas and final in Jan 2021, see #6145

Last edited 4 years ago by Francesco Casella (previous) (diff)

comment:49 by Adam Dershowitz, 4 years ago

It has stopped building again. I'm not sure if it is the same issue, if I should create a new ticket, or re-open this one.
Here's what I see in the log file:

:info:build In file included from /opt/local/include/pugixml.hpp:1451:
:info:build /opt/local/var/macports/build/_opt_local_var_macports_sources_build.openmodelica.org_macports_lang_openmodelica-devel/openmodelica-devel/work/openmodelica_1.17.0~dev-22-gf1438db/OMSimulator/3rdParty/PugiXml/pugixml.cpp:11945:12: error: array type 'pugi::xpath_node [1]' is not assignable
:info:build                 _storage = rhs._storage;
:info:build                 ~~~~~~~~ ^
:info:build /opt/local/var/macports/build/_opt_local_var_macports_sources_build.openmodelica.org_macports_lang_openmodelica-devel/openmodelica-devel/work/openmodelica_1.17.0~dev-22-gf1438db/OMSimulator/3rdParty/PugiXml/pugixml.cpp:11946:24: error: comparison of distinct pointer types ('pugi::xpath_node *' and 'pugi::xpath_node (*)[1]')
:info:build                 _begin = (rhs._begin == &rhs._storage) ? &_storage : rhs._begin;
:info:build                           ~~~~~~~~~~ ^  ~~~~~~~~~~~~~
:info:build /opt/local/var/macports/build/_opt_local_var_macports_sources_build.openmodelica.org_macports_lang_openmodelica-devel/openmodelica-devel/work/openmodelica_1.17.0~dev-22-gf1438db/OMSimulator/3rdParty/PugiXml/pugixml.cpp:11950:16: error: assigning to 'pugi::xpath_node *' from incompatible type 'pugi::xpath_node (*)[1]'
:info:build                 rhs._begin = &rhs._storage;
:info:build                              ^~~~~~~~~~~~~
:info:build /opt/local/var/macports/build/_opt_local_var_macports_sources_build.openmodelica.org_macports_lang_openmodelica-devel/openmodelica-devel/work/openmodelica_1.17.0~dev-22-gf1438db/OMSimulator/3rdParty/PugiXml/pugixml.cpp:11955:67: error: cannot initialize a member subobject of type 'pugi::xpath_node *' with an rvalue of type 'pugi::xpath_node (*)[1]'
:info:build         PUGI__FN xpath_node_set::xpath_node_set(): _type(type_unsorted), _begin(&_storage), _end(&_storage)
:info:build                                                                          ^      ~~~~~~~~~
:info:build /opt/local/var/macports/build/_opt_local_var_macports_sources_build.openmodelica.org_macports_lang_openmodelica-devel/openmodelica-devel/work/openmodelica_1.17.0~dev-22-gf1438db/OMSimulator/3rdParty/PugiXml/pugixml.cpp:11955:86: error: cannot initialize a member subobject of type 'pugi::xpath_node *' with an rvalue of type 'pugi::xpath_node (*)[1]'
:info:build         PUGI__FN xpath_node_set::xpath_node_set(): _type(type_unsorted), _begin(&_storage), _end(&_storage)
:info:build                                                                                             ^    ~~~~~~~~~
:info:build /opt/local/var/macports/build/_opt_local_var_macports_sources_build.openmodelica.org_macports_lang_openmodelica-devel/openmodelica-devel/work/openmodelica_1.17.0~dev-22-gf1438db/OMSimulator/3rdParty/PugiXml/pugixml.cpp:11959:123: error: cannot initialize a member subobject of type 'pugi::xpath_node *' with an rvalue of type 'pugi::xpath_node (*)[1]'
:info:build         PUGI__FN xpath_node_set::xpath_node_set(const_iterator begin_, const_iterator end_, type_t type_): _type(type_unsorted), _begin(&_storage), _end(&_storage)
:info:build                                                                                                                                  ^      ~~~~~~~~~
:info:build /opt/local/var/macports/build/_opt_local_var_macports_sources_build.openmodelica.org_macports_lang_openmodelica-devel/openmodelica-devel/work/openmodelica_1.17.0~dev-22-gf1438db/OMSimulator/3rdParty/PugiXml/pugixml.cpp:11959:142: error: cannot initialize a member subobject of type 'pugi::xpath_node *' with an rvalue of type 'pugi::xpath_node (*)[1]'
:info:build         PUGI__FN xpath_node_set::xpath_node_set(const_iterator begin_, const_iterator end_, type_t type_): _type(type_unsorted), _begin(&_storage), _end(&_storage)
:info:build                                                                                                                                                     ^    ~~~~~~~~~
:info:build /opt/local/var/macports/build/_opt_local_var_macports_sources_build.openmodelica.org_macports_lang_openmodelica-devel/openmodelica-devel/work/openmodelica_1.17.0~dev-22-gf1438db/OMSimulator/3rdParty/PugiXml/pugixml.cpp:11966:14: error: comparison of distinct pointer types ('pugi::xpath_node *' and 'pugi::xpath_node (*)[1]')
:info:build                 if (_begin != &_storage)
:info:build                     ~~~~~~ ^  ~~~~~~~~~
:info:build /opt/local/var/macports/build/_opt_local_var_macports_sources_build.openmodelica.org_macports_lang_openmodelica-devel/openmodelica-devel/work/openmodelica_1.17.0~dev-22-gf1438db/OMSimulator/3rdParty/PugiXml/pugixml.cpp:11970:91: error: cannot initialize a member subobject of type 'pugi::xpath_node *' with an rvalue of type 'pugi::xpath_node (*)[1]'
:info:build         PUGI__FN xpath_node_set::xpath_node_set(const xpath_node_set& ns): _type(type_unsorted), _begin(&_storage), _end(&_storage)
:info:build                                                                                                  ^      ~~~~~~~~~
:info:build /opt/local/var/macports/build/_opt_local_var_macports_sources_build.openmodelica.org_macports_lang_openmodelica-devel/openmodelica-devel/work/openmodelica_1.17.0~dev-22-gf1438db/OMSimulator/3rdParty/PugiXml/pugixml.cpp:11970:110: error: cannot initialize a member subobject of type 'pugi::xpath_node *' with an rvalue of type 'pugi::xpath_node (*)[1]'
:info:build         PUGI__FN xpath_node_set::xpath_node_set(const xpath_node_set& ns): _type(type_unsorted), _begin(&_storage), _end(&_storage)
:info:build                                                                                                                     ^    ~~~~~~~~~
:info:build /opt/local/var/macports/build/_opt_local_var_macports_sources_build.openmodelica.org_macports_lang_openmodelica-devel/openmodelica-devel/work/openmodelica_1.17.0~dev-22-gf1438db/OMSimulator/3rdParty/PugiXml/pugixml.cpp:11985:27: error: 'xpath_node_set' is missing exception specification 'noexcept'
:info:build         PUGI__FN xpath_node_set::xpath_node_set(xpath_node_set&& rhs): _type(type_unsorted), _begin(&_storage), _end(&_storage)
:info:build                                  ^
:info:build                                                                       noexcept
:info:build /opt/local/include/pugixml.hpp:1362:3: note: previous declaration is here
:info:build                 xpath_node_set(xpath_node_set&& rhs) PUGIXML_NOEXCEPT;
:info:build                 ^
:info:build In file included from /opt/local/var/macports/build/_opt_local_var_macports_sources_build.openmodelica.org_macports_lang_openmodelica-devel/openmodelica-devel/work/openmodelica_1.17.0~dev-22-gf1438db/OMSimulator/src/OMSimulatorLib/BusConnector.cpp:1:
:info:build In file included from /opt/local/var/macports/build/_opt_local_var_macports_sources_build.openmodelica.org_macports_lang_openmodelica-devel/openmodelica-devel/work/openmodelica_1.17.0~dev-22-gf1438db/OMSimulator/src/OMSimulatorLib/../OMSimulatorLib/BusConnector.h:7:
:info:build In file included from /opt/local/var/macports/build/_opt_local_var_macports_sources_build.openmodelica.org_macports_lang_openmodelica-devel/openmodelica-devel/work/openmodelica_1.17.0~dev-22-gf1438db/OMSimulator/src/OMSimulatorLib/../OMSimulatorLib/Connector.h:36:
:info:build In file included from /opt/local/var/macports/build/_opt_local_var_macports_sources_build.openmodelica.org_macports_lang_openmodelica-devel/openmodelica-devel/work/openmodelica_1.17.0~dev-22-gf1438db/OMSimulator/src/OMSimulatorLib/../OMSimulatorLib/ssd/ConnectorGeometry.h:37:
:info:build In file included from /opt/local/include/pugixml.hpp:1451:
:info:build /opt/local/var/macports/build/_opt_local_var_macports_sources_build.openmodelica.org_macports_lang_openmodelica-devel/openmodelica-devel/work/openmodelica_1.17.0~dev-22-gf1438db/OMSimulator/3rdParty/PugiXml/pugixml.cpp:11985:87: error: cannot initialize a member subobject of type 'pugi::xpath_node *' with an rvalue of type 'pugi::xpath_node (*)[1]'
:info:build         PUGI__FN xpath_node_set::xpath_node_set(xpath_node_set&& rhs): _type(type_unsorted), _begin(&_storage), _end(&_storage)
:info:build                                                                                              ^      ~~~~~~~~~
:info:build /opt/local/var/macports/build/_opt_local_var_macports_sources_build.openmodelica.org_macports_lang_openmodelica-devel/openmodelica-devel/work/openmodelica_1.17.0~dev-22-gf1438db/OMSimulator/3rdParty/PugiXml/pugixml.cpp:11985:106: error: cannot initialize a member subobject of type 'pugi::xpath_node *' with an rvalue of type 'pugi::xpath_node (*)[1]'
:info:build         PUGI__FN xpath_node_set::xpath_node_set(xpath_node_set&& rhs): _type(type_unsorted), _begin(&_storage), _end(&_storage)
:info:build                                                                                                                 ^    ~~~~~~~~~
:info:build fatal error: too many errors emitted, stopping now [-ferror-limit=]

I can attach the full log file as well if that might help. I have tried both 1.17.0~dev-22-gf1438db_0 and 1.17.0~dev-22-gf1438db_0

comment:50 by Adam Dershowitz, 4 years ago

It looks like the pugixml port is installed, for a different port, and it got updated from 1.8.1_0 to 1.10_0. And that might be causing the problem. But, I don't see that OM should depend on that. Does it have it's own version of that file and it is finding the wrong one?

comment:51 by Adam Dershowitz, 4 years ago

I found a workaround. If I deactivate pugixml, OMEdit builds fine, and then I can allow macports to reactivate pugixml.
So, it seems likely that OMEdit is finding the wrong version of this file doing build, instead of using its own version. I'm not sure why, or what the actual fix is.

comment:52 by Adrian Pop, 4 years ago

The build should put the system include last and our own includes first. That is the issue with pugixml. I'll see if I can find a fix on our side.

Note: See TracTickets for help on using tickets.