CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > OpenFOAM > OpenFOAM Programming & Development

Compiling app changes in Docker

Register Blogs Community New Posts Updated Threads Search

Like Tree1Likes
  • 1 Post By daily

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   October 2, 2018, 13:27
Default Compiling app changes in Docker
  #1
New Member
 
John W Daily
Join Date: Sep 2014
Posts: 6
Rep Power: 12
daily is on a distinguished road
I have OF running in a Docker container. I want to make a small change to reactingFoam.C. However, when I try to run wmake, it doesn't do anything. Is tyhis a Docekr problem and is there a solution.
daily is offline   Reply With Quote

Old   October 2, 2018, 16:21
Default
  #2
Member
 
Vince
Join Date: Mar 2017
Posts: 45
Rep Power: 9
hyFoam is on a distinguished road
Hi,

1) Have you created a copy of the solver directory into your user directory?
2) Have you edited Make/files to



Code:
reactingFoam.C

EXE = $(FOAM_USER_APPBIN)/myreactingFoam
and run
Code:
wclean
wmake

Cheers,
Vincent
hyFoam is offline   Reply With Quote

Old   October 3, 2018, 11:24
Default Compiling app changes in Docker
  #3
New Member
 
John W Daily
Join Date: Sep 2014
Posts: 6
Rep Power: 12
daily is on a distinguished road
Vicent,

Thanks for the suggestion. I copied the solver directory into my user directory as you suggested. The files file is as you suggested. I then ran wclean and wmake (in my user directory). The result is listed below. Apparently there is a permissions issue when trying to write the binary.

Thanks for any suggestions.

John


[ofuser@480bb0f83044 reactingFoam]$ wmake
Making dependency list for source file reactingFoam.C
g++ -std=c++11 -m64 -DOPENFOAM=1806 -Dlinux64 -DWM_ARCH_OPTION=64 -DWM_DP -DWM_LABEL_SIZE=32 -Wall -Wextra -Wold-style-cast -Wnon-virtual-dtor -Wno-unused-parameter -Wno-invalid-offsetof -Wno-attributes -Wno-unknown-pragmas -O3 -DNoRepository -ftemplate-depth-100 -I/opt/OpenFOAM/OpenFOAM-v1806/src/finiteVolume/lnInclude -I/opt/OpenFOAM/OpenFOAM-v1806/src/meshTools/lnInclude -I/opt/OpenFOAM/OpenFOAM-v1806/src/sampling/lnInclude -I/opt/OpenFOAM/OpenFOAM-v1806/src/TurbulenceModels/turbulenceModels/lnInclude -I/opt/OpenFOAM/OpenFOAM-v1806/src/TurbulenceModels/compressible/lnInclude -I/opt/OpenFOAM/OpenFOAM-v1806/src/thermophysicalModels/specie/lnInclude -I/opt/OpenFOAM/OpenFOAM-v1806/src/thermophysicalModels/reactionThermo/lnInclude -I/opt/OpenFOAM/OpenFOAM-v1806/src/transportModels/compressible/lnInclude -I/opt/OpenFOAM/OpenFOAM-v1806/src/thermophysicalModels/basic/lnInclude -I/opt/OpenFOAM/OpenFOAM-v1806/src/thermophysicalModels/chemistryModel/lnInclude -I/opt/OpenFOAM/OpenFOAM-v1806/src/ODE/lnInclude -I/opt/OpenFOAM/OpenFOAM-v1806/src/combustionModels/lnInclude -IlnInclude -I. -I/opt/OpenFOAM/OpenFOAM-v1806/src/OpenFOAM/lnInclude -I/opt/OpenFOAM/OpenFOAM-v1806/src/OSspecific/POSIX/lnInclude -fPIC -c reactingFoam.C -o Make/linux64GccDPInt32Opt/reactingFoam.o
g++ -std=c++11 -m64 -DOPENFOAM=1806 -Dlinux64 -DWM_ARCH_OPTION=64 -DWM_DP -DWM_LABEL_SIZE=32 -Wall -Wextra -Wold-style-cast -Wnon-virtual-dtor -Wno-unused-parameter -Wno-invalid-offsetof -Wno-attributes -Wno-unknown-pragmas -O3 -DNoRepository -ftemplate-depth-100 -I/opt/OpenFOAM/OpenFOAM-v1806/src/finiteVolume/lnInclude -I/opt/OpenFOAM/OpenFOAM-v1806/src/meshTools/lnInclude -I/opt/OpenFOAM/OpenFOAM-v1806/src/sampling/lnInclude -I/opt/OpenFOAM/OpenFOAM-v1806/src/TurbulenceModels/turbulenceModels/lnInclude -I/opt/OpenFOAM/OpenFOAM-v1806/src/TurbulenceModels/compressible/lnInclude -I/opt/OpenFOAM/OpenFOAM-v1806/src/thermophysicalModels/specie/lnInclude -I/opt/OpenFOAM/OpenFOAM-v1806/src/thermophysicalModels/reactionThermo/lnInclude -I/opt/OpenFOAM/OpenFOAM-v1806/src/transportModels/compressible/lnInclude -I/opt/OpenFOAM/OpenFOAM-v1806/src/thermophysicalModels/basic/lnInclude -I/opt/OpenFOAM/OpenFOAM-v1806/src/thermophysicalModels/chemistryModel/lnInclude -I/opt/OpenFOAM/OpenFOAM-v1806/src/ODE/lnInclude -I/opt/OpenFOAM/OpenFOAM-v1806/src/combustionModels/lnInclude -IlnInclude -I. -I/opt/OpenFOAM/OpenFOAM-v1806/src/OpenFOAM/lnInclude -I/opt/OpenFOAM/OpenFOAM-v1806/src/OSspecific/POSIX/lnInclude -fPIC -Xlinker --add-needed -Xlinker --no-as-needed Make/linux64GccDPInt32Opt/reactingFoam.o -L/opt/OpenFOAM/OpenFOAM-v1806/platforms/linux64GccDPInt32Opt/lib \
-lfiniteVolume -lfvOptions -lmeshTools -lsampling -lturbulenceModels -lcompressibleTurbulenceModels -lreactionThermophysicalModels -lspecie -lcompressibleTransportModels -lfluidThermophysicalModels -lchemistryModel -lODE -lcombustionModels -lOpenFOAM -ldl \
-lm -o /opt/OpenFOAM/OpenFOAM-v1806/platforms/linux64GccDPInt32Opt/bin/reactingFoam
/usr/bin/ld: cannot open output file /opt/OpenFOAM/OpenFOAM-v1806/platforms/linux64GccDPInt32Opt/bin/reactingFoam: Permission denied
collect2: error: ld returned 1 exit status
make: *** [/opt/OpenFOAM/OpenFOAM-v1806/platforms/linux64GccDPInt32Opt/bin/reactingFoam] Error 1
daily is offline   Reply With Quote

Old   October 3, 2018, 15:17
Default
  #4
Member
 
Vince
Join Date: Mar 2017
Posts: 45
Rep Power: 9
hyFoam is on a distinguished road
Hi John,


It shouldn't be creating the binary in

/opt/OpenFOAM/OpenFOAM-v1806/platforms/linux64GccDPInt32Opt/bin/
with $FOAM_USER_APPBIN


Could you please print the result of:
echo $FOAM_USER_APPBIN
echo $WM_PROJECT_DIR



Cheers,
Vincent
hyFoam is offline   Reply With Quote

Old   October 4, 2018, 13:14
Default Compiling app changes in Docker
  #5
New Member
 
John W Daily
Join Date: Sep 2014
Posts: 6
Rep Power: 12
daily is on a distinguished road
[ofuser@480bb0f83044 bin]$ echo $FOAM_USER_APPBIN
/home/ofuser/OpenFOAM/ofuser-v1806/platforms/linux64GccDPInt32Opt/bin
[ofuser@480bb0f83044 bin]$ echo $WM_PROJECT_DIR
/opt/OpenFOAM/OpenFOAM-v1806
daily is offline   Reply With Quote

Old   October 7, 2018, 16:53
Default
  #6
New Member
 
John W Daily
Join Date: Sep 2014
Posts: 6
Rep Power: 12
daily is on a distinguished road
So after beating my head against the wall trying to run wmake I am completely confused. When I run it, I get the output below. What is interesting is that I cannot find any directory with "linux64GccDPInt32Opt" in the path, nor can I create any directories or files, or edit files. The binary files are located at "/opt/OpenFOAM/OpenFOAM-v1806/bin" which is inconsistent with $FOAM_USER_APPBIN or $FOAM_APPBIN.

I have read that I can't carry out certain things within the Docker container. So I tried copying my solvers directory to the working directory. However, wmake doesn't run there at all.

HELP!

wmake: 'Make' directory does not exist in /opt/OpenFOAM/OpenFOAM-v1806/applications/solvers/combustion/reactingFoam/Make
Searching up directories tree for Make directory
mkdir: cannot create directory '/opt/OpenFOAM/OpenFOAM-v1806/build': Permission denied
/bin/sh: /opt/OpenFOAM/OpenFOAM-v1806/build/linux64GccDPInt32Opt/applications/solvers/combustion/reactingFoam/options: No such file or directory
make: *** No rule to make target `/opt/OpenFOAM/OpenFOAM-v1806/build/linux64GccDPInt32Opt/applications/solvers/combustion/reactingFoam/options'. Stop.
/bin/sh: /opt/OpenFOAM/OpenFOAM-v1806/build/linux64GccDPInt32Opt/applications/solvers/combustion/reactingFoam/options: No such file or directory
make: *** No rule to make target `/opt/OpenFOAM/OpenFOAM-v1806/build/linux64GccDPInt32Opt/applications/solvers/combustion/reactingFoam/options', needed by `all'. Stop.
wmake error: file '/opt/OpenFOAM/OpenFOAM-v1806/build/linux64GccDPInt32Opt/applications/solvers/combustion/reactingFoam/sourceFiles' could not be created in /opt/OpenFOAM/OpenFOAM-v1806/applications/solvers/combustion/reactingFoam
daily is offline   Reply With Quote

Old   October 7, 2018, 17:59
Default
  #7
Retired Super Moderator
 
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 10,981
Blog Entries: 45
Rep Power: 128
wyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to all
Quote:
Originally Posted by daily View Post
[ofuser@480bb0f83044 bin]$ echo $FOAM_USER_APPBIN
/home/ofuser/OpenFOAM/ofuser-v1806/platforms/linux64GccDPInt32Opt/bin
Quick answer: The second line indicates the complete path to the folder that is defined by OpenFOAM for building the user's own applications, hence the suggestion to use "FOAM_USER_APPBIN".

Please post the content of the file "Make/files" that you have in your own copy of the source code.

The following wiki page points to a more complete example of what is being suggested by hyFoam, namely how to create a modified solver: https://wiki.openfoam.com/Programming4
__________________
wyldckat is offline   Reply With Quote

Old   October 8, 2018, 10:53
Default
  #8
New Member
 
John W Daily
Join Date: Sep 2014
Posts: 6
Rep Power: 12
daily is on a distinguished road
Thanks, finally got it to run!
wyldckat likes this.
daily is offline   Reply With Quote

Old   January 26, 2022, 07:19
Default
  #9
New Member
 
ehsan shadloo
Join Date: Sep 2021
Posts: 2
Rep Power: 0
esishad is on a distinguished road
hi daily
I have the same problem, can you explain how did you compile the code in docker?
esishad is offline   Reply With Quote

Old   February 1, 2022, 06:06
Default
  #10
Senior Member
 
Mark Olesen
Join Date: Mar 2009
Location: https://olesenm.github.io/
Posts: 1,715
Rep Power: 40
olesen has a spectacular aura aboutolesen has a spectacular aura about
Quote:
Originally Posted by esishad View Post
hi daily
I have the same problem, can you explain how did you compile the code in docker?

Assuming that you are using the docker 'dev' version (ie, the one with source headers, wmake tools etc), there should not be any problem. However, you do need to be fully aware about what/where you are trying to compile. If you are trying to rebuild parts of the OpenFOAM source tree itself and/or trying to build into the OpenFOAM installation directory, you will not be able to do so. If you build into a mounted filesystem, typically the FOAM_USER_APPBIN and FOAM_USER_LIBBIN targets, it should be fine.


You have two aspects to remember:
  1. when working with any system-installed libraries, be it OpenFOAM or any other installed library, they are located under /usr/bin, /usr/lib etc which are not writable by regular users and which should normally not be changed outside of using a packaging system (eg, deb or rpm installs)
  2. when working with containers, consider everything in the container to be essentially immutable. Sure you can use 'sudo' within the container to install new packages etc, but they are discarded when the container exits.
As a simple test:


Code:
$ openfoam-docker -dev 



 --------------------------------------------------------------------------- 
  =========                 | 
  \\      /  F ield         | OpenFOAM in a container [from OpenCFD Ltd.] 
   \\    /   O peration     | 
    \\  /    A nd           | www.openfoam.com 
     \\/     M anipulation  | 
--------------------------------------------------------------------------- 
 Release notes:  https://www.openfoam.com/news/main-news/openfoam-v2112 
 Documentation:  https://www.openfoam.com/documentation/ 
 Issue Tracker:  https://develop.openfoam.com/Development/openfoam/issues/ 
 Local Help:     more /openfoam/README 
--------------------------------------------------------------------------- 
System   :  Ubuntu 20.04.3 LTS  (admin user: sudofoam) 
OpenFOAM :  /usr/lib/openfoam/openfoam2112 
Build    :  _d44c8318-20220111 OPENFOAM=2112 patch=0 

Note 
    Different OpenFOAM components and modules may be present (or missing) 
    on any particular container installation. 
    Eg, source code, tutorials, in-situ visualization, paraview plugins, 
        external linear-solver interfaces etc. 

--------------------------------------------------------------------------- 
openfoam2112:~/ 
openfoam$ pwd 
 /home/openfoam

 
 openfoam2112:~/ 
openfoam$ dir 
Make  Test-wordRe.C  testRegexps 


openfoam2112:~/ 
 openfoam$ wmake 
Making dependency list for source file Test-wordRe.C 
g++ -std=c++14 -m64 -pthread -DOPENFOAM=2112 -DWM_DP -DWM_LABEL_SIZE=32 -Wall -Wextra -Wold-style-cast -Wnon-virtual-dtor -Wno-unused-parameter -Wno-invalid-of
fsetof -Wno-attributes -Wno-unknown-pragmas  -O3  -DNoRepository -ftemplate-depth-100  -iquote. -IlnInclude -I/usr/lib/openfoam/openfoam2112/src/OpenFOAM/lnInc
lude -I/usr/lib/openfoam/openfoam2112/src/OSspecific/POSIX/lnInclude   -fPIC -c Test-wordRe.C -o Make/linux64GccDPInt32Opt/Test-wordRe.o 
g++ -std=c++14 -m64 -pthread -DOPENFOAM=2112 -DWM_DP -DWM_LABEL_SIZE=32 -Wall -Wextra -Wold-style-cast -Wnon-virtual-dtor -Wno-unused-parameter -Wno-invalid-of
fsetof -Wno-attributes -Wno-unknown-pragmas  -O3  -DNoRepository -ftemplate-depth-100  -iquote. -IlnInclude -I/usr/lib/openfoam/openfoam2112/src/OpenFOAM/lnInc
lude -I/usr/lib/openfoam/openfoam2112/src/OSspecific/POSIX/lnInclude   -fPIC -Xlinker --add-needed -Xlinker --no-as-needed  Make/linux64GccDPInt32Opt/Test-word
Re.o -L/usr/lib/openfoam/openfoam2112/platforms/linux64GccDPInt32Opt/lib \ 
     -lOpenFOAM -ldl  \ 
     -lm -o /home/openfoam/OpenFOAM/openfoam-v2112/platforms/linux64GccDPInt32Opt/bin/Test-wordRe 
After this the 'Test-wordRes' application is available for use within the container, but it is actually stored on the mounted directory outside of the container.
olesen is offline   Reply With Quote

Old   February 1, 2022, 14:27
Default
  #11
New Member
 
ehsan shadloo
Join Date: Sep 2021
Posts: 2
Rep Power: 0
esishad is on a distinguished road
Thank you olesen for your complete answer, apparently my issue is because the code I'm trying to compile was for OpenFOAM v.2 and I'm using v.5 and it seems that some changes were made in file directories and some constant names that the code reads form OpenFOAM sources.
esishad is offline   Reply With Quote

Old   June 11, 2022, 07:23
Default Using Azure Managed Identity in a Docker container running on an Azure VM
  #12
New Member
 
digitaluser
Join Date: Jun 2022
Posts: 1
Rep Power: 0
digitaluser504 is on a distinguished road
I have a problem in which I cannot reach my company's Container registry via Azure Container Instances and Azure Container Apps, which has to do with VNET's and a private link to the company's registry, and the fact that dynamically launched containers can't be linked. Eventually I want to go to Kubernetes as a platform for my batch job workloads, but right now I have to find a quick solution that makes it able to have at least one container running, and maybe manually scale these when necessary (one is probably enough most of the times).

Right now, the way I am aiming to achieve this is by simply launching a VM (and maybe a couple more when necessary) and running a docker container on this VM with the (Python) application code.

Now I'm wondering if, and if yes how, the Docker container can use a (either system/user assigned) managed identity assigned to the VM. When assigned to an ACI container with a user managed identity assigned to it on startup, I could easily just have code like:

default_credential = DefaultAzureCredential()
q_client = QueueClient(
credential=default_credential,
queue_name='Queuename',
accounrt_url='someurl'
)
and be able to access - for instance - this queue. No need to request any kind of token, no need to specify any kind of environment variable.

Now I doubt this will work in a docker container running in a VM with a user identity assigned to it, since the user identity is not really assigned directly to the docker container. Is there any way to still achieve this or is this a fools errand and should I just work with environment variables for now? I don't really like the idea of the latter, but I haven't found a way to use managed identities this particular way.
digitaluser504 is offline   Reply With Quote

Reply

Tags
compile, docker


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
error when compiling wmake to include temperature in the icoFoam app CtnLuiz OpenFOAM Programming & Development 8 February 24, 2022 18:07
OpenFoam in docker (gcc 6) vs. OpenFoam natively compiled (gcc 8.1.1) Anouk OpenFOAM Running, Solving & CFD 0 September 17, 2018 09:02
[OpenFOAM.com] Docker vs Not Docker v2 AND installing editors into Docker u2berggeist OpenFOAM Installation 1 July 10, 2018 03:58
[OpenFOAM.com] v1606+ Install pb with Docker on OSX El Capitan BPich OpenFOAM Installation 3 October 10, 2016 19:52
[OpenFOAM.org] A Mac OS X of23x Development Environment Using Docker rt08 OpenFOAM Installation 1 February 28, 2016 20:00


All times are GMT -4. The time now is 12:46.