Compilation errors

I'm trying to compile some pure mdl projects, and I have followed the directions I found in this forum ("MicroStation MDL Development Environment"). It did work for a few days, but then something happened. First I got problems creating directories, or rather checking if they existed - if the line in my mki file read

$(BOLIS_OBJ)/$(tstdir) : $(BOLIS_OBJ)/$(tstdir)

I would get a message that no program was associated with that. I commented out those lines, knowing all the directories already existed. I got rid of that particular problem but I got no further than to mcomp where I got messages about include files that could not be opened. I give one example below.

C:\BentleyV8i\MicroStation\mdl\include\mselems.h(15) : error: can't open #include file -iC:\BentleyV8i\MicroStation\mdl\include\shareids\math.h, Invalid argument errno = 22

I can't understand why I suddenly get this problem when it worked before - what setting could I have changed? I can't even remember making any changes... And why is it looking for math.h in the shareids directory? And why doesn't the check of existing directories work anymore?

 Does anybody know or have a good guess at what might have happened? I would be very grateful for any suggestions because right now I'm completely stuck!

Lena

Parents
  • Did anything change on your system (e.g. new group policies, Windows update, etc.)? Does the same thing happen if you compile the delivered examples? How are you compiling your application (IOW, what is the command line that you are using)? Are you using the MicroStation Developer Shell?

      

  • Unfortunately I don't know if anything changed on my system from when I could compile V8i and when I couldn't any longer. It might have, there seems to be lots of updates coming all the time...

    I haven't found any delivered examples, so I haven't been able to try them... where are they? I have installed sdk 08110517, but there were no examples there, as far as I can see. I would be very interested in trying them!

     I'm using our own version of mstndevvars.bat which includes those compiler options needed to compile pure mdl, as well as defining some other variables we use and also running bmake on all files in the current directory with the extension mk8i. I have double checked it today and copied some lines from the original again but with no improvement. There is one more difference though - I'm not changing the directory to %msmde% as in mstndevvars since I'm compiling every mk8i file in the current directory and the variables we are using are all based on the compilation taking place in the base directory of the program being compiled. But that part hasn't changed since the days I could compile for V8i.

    In our make files I have included  mdl.mki as well as our own mki. Our own mki-file is defining a few variables, such as the appDir depending on the category of the program, where to find some include files of ours, defining the default language to swedish etc. I had to make some changes in this file to make the compilation work for V8i in the beginning, but I haven't made any changes from when it worked to when it stopped working. The directory checks I was writing about takes place in this mki file, so whatever has gone wrong I think have done that before this point - the first half of our mki file.

    There are a few definitions at the top of our mki file added by a collegue of mine eons ago. I don't know why they are there so I have tried to remove them just to see if something changes. It does, slightly. I still get a problem with the directory check, but the error messages when removing these changes a little - there is no directory mentioned, just "can't open #include file mdl.h" for example.The lines I commented out were definitions of mdlLibs, publishInc, publichIdsInc, stdlibInc, mdlLibs and rscdir. But still, it's not working!

     

    Lena

    /Lena A

  • I'm probably not doing this right because I can't compile any examples.

     I'm running the mstndevvars.bat first, and then

    bmake -dNO_COMPILERS_MKI -dBUILD_USING_NoToolset   <path\makefile>

    I get the message  "can't open include file mdl.mki"

     

    Have I missed anything?

    Lena

    /Lena A

  • Lena:
    I get the message "can't open include file mdl.mki"

    Did you install the SDK to its default location? Is that file in folder \MicroStation\mdl\include?

    In the Windows command window where you have run mstndevvars.bat, what are the values of environment variables MS and MSMDE?

    Regards, Jon Summers
    LA Solutions

     
    Regards, Jon Summers
    LA Solutions

  • mdl.mki is in the folder ...\MicroStation\mdl\include

    MS is pointing to ...\MicroStation\

    MSMDE to ...\MicroStation\mdl\

    /Lena A

  • You mentioned that you were using a "modified" version of mstndevvars.bat. If the case, what is BMAKE_OPT set to? Is that where mdl.mki is on your computer? Could you provide the custom mstndevvars.bat that you are using as well as the "target" command line that is being used to start the shell?

      

  • When I tried to compile the example, I used the standard version of mstndevvars.bat. I just found the mistake I made, I had typed the wrong path to the SDK in the command line (just happened to add \mdl). So now it works to compile the examples... Now I just have to find out what my problem is with my files...

    Our modified version of mstndevvars.bat has similar settings as mstndevvars.bat (except that I don't need to type in the paths in the command line so I've got rid of a potential error there...). The differences are the addition of some of our own variables, no change in the active directory, and the command line for running bmake for all make-files in the active directory with -dNO_COMPILERS_MKI -dBUILD_USING_NoToolset added to the command line.  It is quite short:

    set MS=C:\BentleyV8i\MicroStation\
    set mdltools=%MS%
    set MSMDE=%MS%
    set toolspath=%mdltools%mdl\bin\
    set BMAKE_OPT=-I%MS%MDL\include
    set PATH=%MS%\mdl\bin;%MS%\mdl\library;%MS%;%MS%\jmdl\bin;%PATH%
    set MLINK_STDLIB=%MS%mdl\library\builtin.dlo %MS%mdl\library\BentleyDgn.dlo %MS%mdl\library\toolsubs.dlo
    set BOLIS_SRC=c:\KALLKOD\mdl\bolis8i
    set BOLIS_LIB=c:\kallkod\mdl\bolislib
    set BOLIS_APPL=c:\kallkod\mdl\mdlapps
    set gensrc=%BOLIS_APPL%\
    if not exist \objects. mkdir \objects
    for %%f in ( *.mk8i ) do %MS%mdl\bin\bmake.exe -dNO_COMPILERS_MKI -dBUILD_USING_NoToolset %%f

     

    I still get the message "can't open #include file mdl.h" etc. when compiling. It's when running mcomp

    C:\BentleyV8i\MicroStation\mdl\bin\mcomp @make.opt

    and make.opt is

    -c
    -o.\OBJECTS\MS8i\english\bolmenu.mo
    -iC:\BentleyV8i\MicroStation\mdl\include
    -i
    -iC:\BentleyV8i\MicroStation\mdl\include\shareids
    -iC:\BentleyV8i\MicroStation\mdl\include\stdlib
    -ic:\kallkod\mdl\mdlapps
    -i.\ -ienglish\ -ic:\KALLKOD\mdl\bolis8i\include\
    -Wa -Iz
    .\bolmenu.mc

    Any ideas of where to look next?

    /Lena

    /Lena A

  • Lena, Are you doing a cincapnd include or modifying the include path somewhere in your make file? The -i with a blank after is causing the problem. I would also suspect an environment var is not set looking at the -i.\ then -ienglish in here. Since you are building the examples can you post your make file for us? thanks, mark anderson [Bentley]
  • Lena:
    
    set MS=C:\BentleyV8i\MicroStation\
    set PATH=%MS%\mdl\bin;%MS%\mdl\library;%MS%;%MS%\jmdl\bin;%PATH%
    
    

    Be careful with folder terminator slashes. Your definitions expand to:

    
    MS=C:\BentleyV8i\MicroStation\
    set PATH=C:\BentleyV8i\MicroStation\\mdl\bin;C:\BentleyV8i\MicroStation\\mdl\library;C:\BentleyV8i\MicroStation\;C:\BentleyV8i\MicroStation\\jmdl\bin;%PATH%
    
    

    There are several double terminators in the above line. They may cause problems.

    Lena:
    
    set BOLIS_SRC=c:\KALLKOD\mdl\bolis8i
    set BOLIS_LIB=c:\kallkod\mdl\bolislib
    set BOLIS_APPL=c:\kallkod\mdl\mdlapps
    set gensrc=%BOLIS_APPL%\
    
    

    Be consistent with folder terminator slashes. Your MDL paths are terminated, but your own paths are not. Confusion will follow.

    Regards, Jon Summers
    LA Solutions

     
    Regards, Jon Summers
    LA Solutions

  • I'm not sure what you mean by "cincapnd include".

    When I first tried to compile our programs for V8i, I got the problem that there where lots of -i's with blanks after them, so I added a few paths in the make file to make it work. Those were publishInc, stdlibInc etc.  Where should publishInc, stdlibInc etc be set normally?

    This is what the file looked like when I got the result I showed in my last post (I've tried to add or remove some of the declarations...):

    # these first rows were added to get the compilation for V8i to work - should be defined elsewhere, but where?#mdlLibs = $(MS)/mdl/library/
    publishInc = $(MSMDE)mdl/include/
    publishIdsInc = $(MSMDE)mdl/include/shareids/
    stdlibInc = $(MSMDE)mdl/include/stdlib
    mdlLibs = $(MSMDE)mdl/library/
    #rscDir = $(MSMDE)resource/

    # one of US95W, US95 US5, MS8, MS8i
    %if !defined (MS_VERSION)
    MS_VERSION = MS8
    %endif
    %if !defined (BOLIS_APPL)
    BOLIS_APPL = C:\TEMP\MDLAPPS
    %endif

    %if !defined (BOLIS_LIB)
    BOLIS_LIB = C:\TEMP\BOLISLIB
    %endif


    BOLIS_OBJ = ./OBJECTS

    %ifndef lang
    lang = svenska
    %endif
    %ifndef category
    category = gem
    %endif

    privateInc = ./
    bolInc = $(BOLIS_SRC)/include/
    langSpec = $(lang)/
    baseDir = ./

    # used by mdl.mki
    altIncs = -i./ -i$(lang)/ -i$(BOLIS_SRC)/include/
    appDir = $(BOLIS_APPL)/$(MS_VERSION)/$(lang)/$(category)/
    objectDir = $(BOLIS_OBJ)/$(MS_VERSION)/$(lang)/
    libDir = $(BOLIS_LIB)/$(MS_VERSION)/$(lang)/

    # Create base directorys (commented out because of the errors I've got lately)
    #$(BOLIS_OBJ)/$(tstdir) : $(BOLIS_OBJ)/$(tstdir)
    #$(BOLIS_LIB)/$(tstdir) : $(BOLIS_LIB)/$(tstdir)
    #$(BOLIS_APPL)/$(tstdir) : $(BOLIS_APPL)/$(tstdir)

    # Create version specific directorys
    #$(BOLIS_OBJ)/$(MS_VERSION)/$(tstdir) : $(BOLIS_OBJ)/$(MS_VERSION)/$(tstdir)
    #$(BOLIS_LIB)/$(MS_VERSION)/$(tstdir) : $(BOLIS_LIB)/$(MS_VERSION)/$(tstdir)
    #$(BOLIS_APPL)/$(MS_VERSION)/$(tstdir) : $(BOLIS_APPL)/$(MS_VERSION)/$(tstdir)
    # Create language directorys
    #$(BOLIS_OBJ)/$(MS_VERSION)/$(lang)/$(tstdir) : $(BOLIS_OBJ)/$(MS_VERSION)/$(lang)/$(tstdir)
    #$(BOLIS_LIB)/$(MS_VERSION)/$(lang)/$(tstdir) : $(BOLIS_LIB)/$(MS_VERSION)/$(lang)/$(tstdir)
    #$(BOLIS_APPL)/$(MS_VERSION)/$(lang)/$(tstdir) : $(BOLIS_APPL)/$(MS_VERSION)/$(lang)/$(tstdir)

    # Create category directory
    #$(BOLIS_APPL)/$(MS_VERSION)/$(lang)/$(category)/$(tstdir) : $(BOLIS_APPL)/$(MS_VERSION)/$(lang)/$(category)/$(tstdir)
    #----------------------------------------------------------
    # Creating include files from command table resources
    # This rule is copied from mdl.mki but outputfile is
    # to $(objectDir) insted of $(o).
    #----------------------------------------------------------
    .r.h:
    $(msg)
    > $(o)make.opt
    -ho$@
    -o$(objectDir)$*.rsc
    %if privateInc
    -i${privateInc}
    %endif
    $(rcompOpts)
    $(rscCompIncs)
    $(altIncs)
    -i${publishInc}
    -i${publishIdsInc}
    $(platformOpts)
    $(moreRscCompileOpts)
    $<
    <
    $(RCompCmd) @$(o)make.opt
    ~time

     

    The make files start with:

    lang = svenska
    MS_VERSION = MS8i
    %include $(MS)\mdl\include\mdl.mki
    %include $(BOLIS_SRC)\include\bolis.mki

    everything else is pretty similar to the example files

     

    /Lena

     

    /Lena A

  • Lena:
    
    objectDir = $(BOLIS_OBJ)/$(MS_VERSION)/$(lang)/
    #----------------------------------------------------------
    # Creating include files from command table resources
    # This rule is copied from mdl.mki but outputfile is 
    # to $(objectDir) instead of $(o). 
    #----------------------------------------------------------
    
    

    Don't duplicate code: just write:

    $(o) = $(objectDir)
    Lena:
    The make files start with:
    
    %include $(MS)\mdl\include\mdl.mki
    %include $(BOLIS_SRC)\include\bolis.mki
    
    

    By your previous definitions, the first path expands to:

    %include MS=C:\BentleyV8i\MicroStation\\mdl\include\mdl.mki

    Try removing the double-backslash.

    Regards, Jon Summers
    LA Solutions

     
    Regards, Jon Summers
    LA Solutions

  • Hi Jon,

    I know it's not a good idea to duplicate the code. I thing the reason is that it is a different objectdir for these files than all the others, so $(o), as defined earlier, is still used so I can't just redefine it, unfortunately.

    About the double-backslash in the path -  that has been fixed now. But changing it hasn't helped anything. Still the same problem...

    I think my problem is the -i with a blank after because it seems as this path is thought to be the next line including the -i,

    -iC:\BentleyV8i\MicroStation\mdl\include\

    Lena

     

    /Lena A

Reply
  • Hi Jon,

    I know it's not a good idea to duplicate the code. I thing the reason is that it is a different objectdir for these files than all the others, so $(o), as defined earlier, is still used so I can't just redefine it, unfortunately.

    About the double-backslash in the path -  that has been fixed now. But changing it hasn't helped anything. Still the same problem...

    I think my problem is the -i with a blank after because it seems as this path is thought to be the next line including the -i,

    -iC:\BentleyV8i\MicroStation\mdl\include\

    Lena

     

    /Lena A

Children
  • Java is no more: RIP

    Lena:
    I think my problem is the -i with a blank after
    
    set PATH= ... %MS%\jmdl\bin; ...
    
    

    There is no \jmdl folder with V8. It's a relic from MS/J. Remove that from your PATH definition and the '-i with a blank after' may vanish.

    Regards, Jon Summers
    LA Solutions

     
    Regards, Jon Summers
    LA Solutions

  • We don't pull things out of the path so that would just be a dead path statement. But I do see this in there that worries me: # used by mdl.mki altIncs = -i./ -i$(lang)/ -i$(BOLIS_SRC)/include/ if the lang or BOLIS_SRC is not set right it would leave a blank. don't redefine the rule if you can avoid it and maybe you can just append to the altIncs using the + not the = operator. You don't need to use the ./ in there use the $(_MakeFilePath) var it points to the dir for the source anyway (or usually does). HTH, mark anderson [Bentley]
  • I tried to change it to

    altIncs + -i$(lang)/ -i$(BOLIS_SRC)/include/

    Is that what you meant?

    The path in the error statement has changed a bit depending on which rows of the first 6 in bolis.mki I comment out, but with the settings I showed in my post I get this error still:

    can't open #include file -iC:\BentleyV8i\MicroStation\mdl\include\shareids\time.h

    As you can see, there is a "-i" in the path, that is why I thougth the -i with a blank might be a problem. It is also the same directory (shareids) as in the row after the -i + blank.

    Lena

    /Lena A

  • Lena:
    can't open #include file -iC:\BentleyV8i\MicroStation\mdl\include\shareids\time.h

    Try searching for time.h. It's one of the C standard header files, unlikely to be found in the \shareids folder. You will find it in folder \include\stdlib.

    Is \include\stdlib in your include paths? I suspect not.

    Try this environment variable setting:

    BMAKE_OPT=-I%MS%MDL\include -I%MS%MDL\include\stdlib

    Regards, Jon Summers
    LA Solutions

     
    Regards, Jon Summers
    LA Solutions

  •  I've tried that setting for BMAKE_OPT as well.

    \include\stdlib is in my path. The error message, as I said, depends on which of the variables mdlLibs, publishInc etc that I set in bolis.mki and which I don't set. These used to be set somewhere else with earlier versions, I don't know where, but I had to set some of them to make it work with V8i.

    I just removed the setting for publishIdsInc and now it seems to compile correctly! I hadn't tried just removing that single one apparently... But why do I need to set stdLibInc, publishInc etc. in our mki? Shouldn't they be set somewhere else?

    Now the only remaining problem is that of the directories. I get the message:

    'c:\kallkod\mdl\bolislib\MS8i\english\direxist.ext' is not recognized as an internal or external command,
    operable program or batch file.

    from this piece of code in my mki:

    $(BOLIS_OBJ)/$(MS_VERSION)/$(lang)/$(tstdir) : $(BOLIS_OBJ)/$(MS_VERSION)/$(lang)/$(tstdir)

     

    Lena

    /Lena A

  • Lena:
    The error message depends on which of the variables mdlLibs, publishInc etc that I set in bolis.mki and which I don't set.

    The various *Inc macros are defined in the *.mki files in the \mdl\include folder. Normally you should not need to redefine them; in fact it's probably a bad idea to even try to redefine them. Who knows what you may be breaking?

    Lena:
    These used to be set somewhere else with earlier versions, I don't know where

    You would find it easy to find them using a programmers' text editor that includes file search capability.

    Regards, Jon Summers
    LA Solutions

     
    Regards, Jon Summers
    LA Solutions

  • They seem to be defined in MicroStationPolicy.mki nowadays. Where do I include that?

    I used to include the lines about the policy in my first batchfile, copied from mstndevvars.bat, but it didn't work. I got the message that bmake for Windows had encountered a problem and needed to close!

     

    Lena

    /Lena A

  • You are in a maze of twisty passages, all alike

    Lena:
    They seem to be defined in MicroStationPolicy.mki nowadays. Where do I include that? Lena

    Let's get back to basics: you are creating a problem where none exists.

    Look at the example files delivered with the SDK for V8i. Take adrwdemo, and look at its .mke and .mki files. They don't include any Policy.mki files, because by default the right files are included. By making your own .mki files you are switching off many default options provided by mdl.mki.

     

    Your combination of environment variables, command-line switches, and your own macro definitions in your .mki files is also confusing everyone, especially me. Simplicate and add lightness!

    Regards, Jon Summers
    LA Solutions

     
    Regards, Jon Summers
    LA Solutions

  • Our own mki file originally didn't set any of these variables or switches, I had to include them to make it work the first time with V8i. In the last versions, they must have been defined elsewhere, and since we had no problem probably through mdl.mki since that is the only one we include. I can't see that the example files include anything else than I include, so that is why I was confused. I would be happy to remove these lines, except then it won't work. That is why I asked where these are defined nowadays, since I just ended up with  blanks after all -i's otherwise. I thought there should be a default defined somewhere, but still it was just blanks. My definitions added now are exactly the same as those in MicroStationPolicy.mki so I don't think there's anything wrong in the settings used to create these switches (MSMDE etc.). Why don't I get the default, then?

    Our file is just meant to include our own variables, the language setting and the destination and source of some files, and that sort of more or less "innocent" settings. The only exception to that was that part in the end that has been copied from mdl.mki. I tried to exclude that part and ended up with a cleaner version of our bolis.mki. This is all that is left in bolis.mki after my last cleanup (I have temporarily remove the creation of the directories since that didn't work anyway), but I have to keep the definitions in first four lines for it to work:

    mdlLibs = $(MS)mdl/library/
    publishInc = $(MSMDE)mdl/include/
    stdlibInc = $(MSMDE)mdl/include/stdlib
    rscDir = $(MSMDE)resource/
    BOLIS_OBJ = ./OBJECTS

    %if !defined (MS_VERSION)
    MS_VERSION = MS8
    %endif
    %if !defined (BOLIS_APPL)
    BOLIS_APPL = C:\TEMP\MDLAPPS
    %endif
    %if !defined (BOLIS_LIB)
    BOLIS_LIB = C:\TEMP\BOLISLIB
    %endif
    %ifndef lang
    lang = svenska
    %endif
    %ifndef category
    category = gem
    %endif
    privateInc = ./
    bolInc = $(BOLIS_SRC)/include/
    langSpec = $(lang)/
    baseDir = ./
    altIncs+ -i$(lang)/ -i$(BOLIS_SRC)/include/
    appDir = $(BOLIS_APPL)/$(MS_VERSION)/$(lang)/$(category)/
    objectDir = $(BOLIS_OBJ)/$(MS_VERSION)/$(lang)/
    libDir = $(BOLIS_LIB)/$(MS_VERSION)/$(lang)/

     I can't see what makes the first four lines necessary. I'm including mdl.mki before this one. This shouldn't switch off so many default options!

    /Lena

    /Lena A

  • Lena:
    
    mdlLibs = $(MS)mdl/library/
    publishInc = $(MSMDE)mdl/include/
    stdlibInc = $(MSMDE)mdl/include/stdlib
    
    

    As I've mentioned already, folder terminators should be consistently used.

    Regards, Jon Summers
    LA Solutions

     
    Regards, Jon Summers
    LA Solutions