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

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

Register Blogs Members List Search Today's Posts Mark Forums Read

Reply
 
LinkBack Thread Tools 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: 20
Rep Power: 7
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
Super Moderator
 
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 8,258
Blog Entries: 34
Rep Power: 84
wyldckat is just really nicewyldckat is just really nicewyldckat is just really nicewyldckat is just really nice
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
wyldckat is offline   Reply With Quote

Old   June 11, 2013, 04:59
Default
  #3
New Member
 
wuyu
Join Date: Mar 2010
Posts: 20
Rep Power: 7
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

Reply

Thread Tools
Display Modes

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 On
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 15: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 02:07.