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

How to solve the zlib.h missing problem without root right

Register Blogs Community New Posts Updated Threads Search

Like Tree3Likes
  • 2 Post By wyldckat
  • 1 Post By Bloerb

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   May 29, 2013, 22:17
Default How to solve the zlib.h missing problem without root right
  #1
New Member
 
wuyu
Join Date: Mar 2010
Posts: 27
Rep Power: 16
seasoul is on a distinguished road
Dear All,

I want to build OpenFOAM 2.2.0 on my workstation. But it has to be say that I do not have the root right and the administrator is reluctant to give me the right.

The first error occurred is "fatal error: zlib.h: No such file or directory."

I know that is definitely because the missing of zlib-dev. But since I have no root right, I download zlib source and install it with custom path.

I tried to set the CPPFLAGS as the zlib include directory and even set the LD_LIBRARY_PATH as the libz.so as suggested by this post

Quote:
Originally Posted by gwierink View Post
Hi Yuri,

Maybe ld can't find zlib or the right zlib. Perhaps it helps to add the location of the right zlib to the LD_LIBRARY_PATH variable. For instance, if zlib lives in /usr/lib/libz.so, then you could add something like below to $HOMA/.bashrc and then source your bashrc:
Code:
LD_LIBRARY_PATH=/usr/lib/libz.so:$LD_LIBRARY_PATH
export LD_LIBRARY_PATH
The compiling still report the error of zlib.

How to solve this zlib.h missing problem without root right?

Best Reagards
seasoul is offline   Reply With Quote

Old   June 9, 2013, 06:54
Default
  #2
Retired Super Moderator
 
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 10,975
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
Greetings seasoul,

Unfortunately that quoted post is incorrect. The variable "LD_LIBRARY_PATH" is only meant for paths to the library files, not for specifying the paths to the files themselves.
So, for the library file itself ("libz.so"), the correct way to do this is:
Code:
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/path/to/zlib/lib
I haven't managed to test the following with this scenario of a custom zlib, but you can try using the following commands for forcefully adding the zlib "include" folder to the build search path:
Code:
export C_INCLUDE_PATH=/path/to/zlib/include
export CPLUS_INCLUDE_PATH=/path/to/zlib/include
I've had to use this trick in the past for building old GCC compilers in new Ubuntu versions and it worked back then.


If this doesn't work, then you can try another quick hack:
  1. Copy the "zlib.h" file to the folder "$FOAM_SRC/OpenFOAM/lnInclude/".
  2. Edit the file "$WM_THIRD_PARTY_DIR/etc/wmakeFiles/scotch/Makefile.inc.i686_pc_linux2.shlib-OpenFOAM-$WM_ARCH_OPTION" and add the following at the end of the line "CFLAGS":
    Code:
    -I/path/to/zlib/include
If you are unfamiliar with these long variable names, you can simply check what they equate to by running:
Code:
echo "$FOAM_SRC/OpenFOAM/lnInclude/"
echo "$WM_THIRD_PARTY_DIR/etc/wmakeFiles/scotch/Makefile.inc.i686_pc_linux2.shlib-OpenFOAM-$WM_ARCH_OPTION"
Best regards,
Bruno
acgnipper and tilasoldo like this.
__________________
wyldckat is offline   Reply With Quote

Old   June 11, 2013, 04:59
Default
  #3
New Member
 
wuyu
Join Date: Mar 2010
Posts: 27
Rep Power: 16
seasoul is on a distinguished road
This really works.

I tried the first option and it works. So I did not go further.

Thank you, Bruno.

Quote:
Originally Posted by wyldckat View Post
Greetings seasoul,

Unfortunately that quoted post is incorrect. The variable "LD_LIBRARY_PATH" is only meant for paths to the library files, not for specifying the paths to the files themselves.
So, for the library file itself ("libz.so"), the correct way to do this is:
Code:
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/path/to/zlib/lib
I haven't managed to test the following with this scenario of a custom zlib, but you can try using the following commands for forcefully adding the zlib "include" folder to the build search path:
Code:
export C_INCLUDE_PATH=/path/to/zlib/include
export CPLUS_INCLUDE_PATH=/path/to/zlib/include
I've had to use this trick in the past for building old GCC compilers in new Ubuntu versions and it worked back then.


If this doesn't work, then you can try another quick hack:
  1. Copy the "zlib.h" file to the folder "$FOAM_SRC/OpenFOAM/lnInclude/".
  2. Edit the file "$WM_THIRD_PARTY_DIR/etc/wmakeFiles/scotch/Makefile.inc.i686_pc_linux2.shlib-OpenFOAM-$WM_ARCH_OPTION" and add the following at the end of the line "CFLAGS":
    Code:
    -I/path/to/zlib/include
If you are unfamiliar with these long variable names, you can simply check what they equate to by running:
Code:
echo "$FOAM_SRC/OpenFOAM/lnInclude/"
echo "$WM_THIRD_PARTY_DIR/etc/wmakeFiles/scotch/Makefile.inc.i686_pc_linux2.shlib-OpenFOAM-$WM_ARCH_OPTION"
Best regards,
Bruno
seasoul is offline   Reply With Quote

Old   July 30, 2020, 10:32
Default
  #4
Senior Member
 
Join Date: Sep 2013
Posts: 353
Rep Power: 20
Bloerb will become famous soon enough
This did not work for me. However as it might be helpful to others, the following did work:

Installing zlib
Code:
./configure --prefix=/path/to/zlib-1.2.11/ 
make 
make install
making it available for compiling openfoam
Code:
export PATH=$PATH:/path/to/zlib-1.2.11/ 
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/path/to/zlib-1.2.11/lib/
export LIBRARY_PATH=$LIBRARY_PATH:/path/to/zlib-1.2.11/lib/ 
export C_INCLUDE_PATH=/path/to/zlib-1.2.11/include/ 
export CPLUS_INCLUDE_PATH=/path/to/zlib-1.2.11/include/ 
export PKG_CONFIG_PATH=/path/to/zlib-1.2.11/lib/pkgconfig
I am however unsure if all of these are necessary
Gerry Kan likes this.
Bloerb is offline   Reply With Quote

Reply


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
how to solve large scale problem send1000 ANSYS 0 September 3, 2011 13:46
how to solve a problem involving both laminar and turbulent flow seefd FLUENT 1 June 3, 2011 03:20
Someone use Icepak to solve microchannel problem ? Bernie FLUENT 1 October 31, 2006 14:29
extremely simple problem... can you solve it properly? Mikhail Main CFD Forum 40 September 9, 1999 09:11
use of MAC method to solve sloshing problem. S.R.SAHI Main CFD Forum 1 April 15, 1999 22:28


All times are GMT -4. The time now is 07:18.