Intel® C++ Compiler
Community support and assistance for creating C++ code that runs on platforms based on Intel® processors.
7956 Discussions

Linking problem on Mac OS X 10.6

davechen
Beginner
927 Views
I'm having a C++ linking problem on Mac OS X 10.6 (Snow Leopard). It is the same as the one described in the following Intel article:


The article claims that the latest version of the Intel Compiler fixes the problem. However I am running the latest (downloaded yesterday) and I still get this problem.

Here is my link command and the error message:

/usr/bin/icpc -mmacosx-version-min=10.6 -headerpad_max_install_names CMakeFiles/imodel.app/Contents/MacOS/imodel.dir/args.C.o CMakeFiles/imodel.app/Contents/MacOS/imodel.dir/imodel.C.o CMakeFiles/imodel.app/Contents/MacOS/imodel.dir/gui.C.o CMakeFiles/imodel.app/Contents/MacOS/imodel.dir/colormap.C.o CMakeFiles/imodel.app/Contents/MacOS/imodel.dir/clipcube.C.o CMakeFiles/imodel.app/Contents/MacOS/imodel.dir/view.C.o CMakeFiles/imodel.app/Contents/MacOS/imodel.dir/loadfiles.C.o CMakeFiles/imodel.app/Contents/MacOS/imodel.dir/screen.C.o CMakeFiles/imodel.app/Contents/MacOS/imodel.dir/graphics.C.o CMakeFiles/imodel.app/Contents/MacOS/imodel.dir/phong.C.o CMakeFiles/imodel.app/Contents/MacOS/imodel.dir/dispmesh.C.o CMakeFiles/imodel.app/Contents/MacOS/imodel.dir/dispobj.C.o CMakeFiles/imodel.app/Contents/MacOS/imodel.dir/disppts.C.o CMakeFiles/imodel.app/Contents/MacOS/imodel.dir/disprbf.C.o CMakeFiles/imodel.app/Contents/MacOS/imodel.dir/dispvol.C.o CMakeFiles/imodel.app/Contents/MacOS/imodel.dir/dispvolbricked.C.o CMakeFiles/imodel.app/Contents/MacOS/imodel.dir/dispplaware.C.o CMakeFiles/imodel.app/Contents/MacOS/imodel.dir/displines.C.o CMakeFiles/imodel.app/Contents/MacOS/imodel.dir/painter.C.o CMakeFiles/imodel.app/Contents/MacOS/imodel.dir/interact.C.o CMakeFiles/imodel.app/Contents/MacOS/imodel.dir/pickConstraint.C.o CMakeFiles/imodel.app/Contents/MacOS/imodel.dir/deform.C.o CMakeFiles/imodel.app/Contents/MacOS/imodel.dir/deriv.C.o CMakeFiles/imodel.app/Contents/MacOS/imodel.dir/particle.C.o CMakeFiles/imodel.app/Contents/MacOS/imodel.dir/simp.C.o CMakeFiles/imodel.app/Contents/MacOS/imodel.dir/split.C.o -o ../bin/imodel.app/Contents/MacOS/imodel -lpthread ../bin/libdvol.a /usr/local/lib/libtiff.a /usr/local/lib/libz.a /usr/local/lib/libpng.a /usr/local/lib/libz.a ../bin/libvarimp.a ../bin/libgeom.a ../bin/libdmesh.a ../bin/libglui.a -framework GLUT -lobjc -framework AGL -framework OpenGL -framework vecLib -framework Carbon /usr/local/lib/libpng.a -framework GLUT -lobjc -framework AGL -framework OpenGL -framework vecLib -framework Carbon -lmx -lpthread
ld: in CMakeFiles/imodel.app/Contents/MacOS/imodel.dir/screen.C.o, ObjectFileAddressSpace::mappedAddress(0xFFFFFFFFFFFFFFFC) not in any section

and here are my system and compiler versions:

puget => sw_vers
ProductName: Mac OS X
ProductVersion: 10.6.2
BuildVersion: 10C540
puget => icpc -V
Intel C++ Intel 64 Compiler Professional for applications running on Intel 64, Version 11.1 Build 20091012 Package ID: m_cproc_p_11.1.076
Copyright (C) 1985-2009 Intel Corporation. All rights reserved.

Any ideas?

Thanks for any help.

Dave
0 Kudos
14 Replies
Quoc-An_L_Intel
Moderator
927 Views

The original problem was fixed several updates ago. Did you do a complete rebuild of the source? Was any of the libraries linked in built with an older compiler that does not have the fix?

See this article here: http://software.intel.com/en-us/articles/linking-error-on-macosx-106-with-xcode-32/
0 Kudos
davechen
Beginner
927 Views
Quoting - Qale (Intel)

The original problem was fixed several updates ago. Did you do a complete rebuild of the source? Was any of the libraries linked in built with an older compiler that does not have the fix?

See this article here: http://software.intel.com/en-us/articles/linking-error-on-macosx-106-with-xcode-32/

I did a clean build of my code. It does link against libraries that had been built with gcc. I'm not sure which version or versions of gcc.
0 Kudos
davechen
Beginner
927 Views
I've gone and recompiled the libraries I use (tiff, png & zlib) with the Intel compiler and linked. I am still getting the linking error.
0 Kudos
Quoc-An_L_Intel
Moderator
927 Views
What about these other static libs?

../bin/libdvol.a
/usr/local/lib/libtiff.a
/usr/local/lib/libz.a
/usr/local/lib/libpng.a
/usr/local/lib/libz.a
../bin/libvarimp.a
../bin/libgeom.a
../bin/libdmesh.a
../bin/libglui.a
/usr/local/lib/libpng.a -

You should not need to recompile the libs if they were compile with gcc 4.0 or newer. Would it be possible for you to provide me with the source / binaries / steps needed to reproduce this problem?

If yes, attached it to this thread. You can reply in private if you do not want anyone else to see it.

One possible work aroundis to link against dylibs instead of static lib.
0 Kudos
davechen
Beginner
927 Views
I took out my dependence on png, tiff and zlib. The other libraries are part of my code, so are built with icpc. But that isn't where the linking error is coming from anyways. It is showing up for the file screen.o, which is part of the main program, not a sub-library.

After more re-building, I've found that using just the "-g" flag it links OK. Without "-g" it fails, or with "-g -O2" it also fails.

I've attached a tar file of my code, "dsrc.tgz". You need to install CMake to build it (http://cmake.org/). In the directory dsrc, there's a build script, "Build.pl". Run it with the flags "-i -o" to do an optimized build with the Intel compiler like so:

Build.pl -i -o

Let me know if you have any problems building it.

Thanks,
Dave

0 Kudos
Quoc-An_L_Intel
Moderator
927 Views
Quoting - davechen
I took out my dependence on png, tiff and zlib. The other libraries are part of my code, so are built with icpc. But that isn't where the linking error is coming from anyways. It is showing up for the file screen.o, which is part of the main program, not a sub-library.

After more re-building, I've found that using just the "-g" flag it links OK. Without "-g" it fails, or with "-g -O2" it also fails.

I've attached a tar file of my code, "dsrc.tgz". You need to install CMake to build it (http://cmake.org/). In the directory dsrc, there's a build script, "Build.pl". Run it with the flags "-i -o" to do an optimized build with the Intel compiler like so:

Build.pl -i -o

Let me know if you have any problems building it.

Thanks,
Dave


0 Kudos
Quoc-An_L_Intel
Moderator
927 Views
Quoting - Qale (Intel)



I get the build errors below. My Xcode is installed in /Developer_3.2.1

BTW, if you have more than one version of ICC installed, could you add -V to the command line to verify that the script is calling the appropriate compiler.

intels-mac-pro:dsrc ale$ ./Build.pl -i -o >& log.txt

intels-mac-pro:dsrc ale$ cat log.txt

Source directory = /Users/ale/Downloads/dsrc
Build directory = build
Running cmake
Project Dmesh
Project Dvol
Project Implicit
GLUI library
Project iModel
You have changed variables that require your cache to be deleted.
Configure will be re-run and you may have to reset some variables.
The following variables have changed:
CMAKE_CXX_COMPILER= icpc

Project Dmesh
Project Dvol
Project Implicit
GLUI library
Project iModel
Compiling imodel
CMake Error: Parse error in cache file /Users/ale/Downloads/dsrc/build/CMakeCache.txt. Offending entry: /SDKs/MacOSX10.6.sdk
Project Dmesh
Project Dvol
Project Implicit
GLUI library
Project iModel
make: *** [cmake_check_build_system] Error 1

0 Kudos
davechen
Beginner
927 Views

It doesn't look like the build script is working right for you. I don't think it's even getting to the compile stage.

In the file build/CMakeCache.txt search for the word CMAKE_OSX_SYSROOT. It looks like yours got munged for some reason. In my file, it's at line #135 and looks like this:

CMAKE_OSX_SYSROOT:PATH=/Developer/SDKs/MacOSX10.6.sdk

Maybe there's a return cutting the line?

Also, search for the wordCMAKE_VERBOSE_MAKEFILE. If you change FALSE to TRUE, you can see all the compilation commands taking place.

After changing the file, just type "make" in the build directory.

UPDATE: I've added a new version of the Build.pl script that should output a lot more message. It adds the "-V" flag like so:

./Build.pl -i -o -V


0 Kudos
Quoc-An_L_Intel
Moderator
927 Views

It seems that the script does not like Xcode being installed in /Developer_3.2.1 instead of the default /Developer. I made the change, and use the new Build.pl and I can reproducethe errors.

How do I add compiler options to the command line?icpc -V will give me the compiler info etc. I can't seem to do that by adding it to CMakeCache.txt. Where can I add compiler options so that the MAKE picks up the option, similar to the option "-mmacosx-version-min-=10.6 and -headerpad_max_install_names"?

0 Kudos
davechen
Beginner
927 Views
You should be to just edit the variableCMAKE_CXX_FLAGS in the CMakeCache.txt file and then just type "make".
0 Kudos
Quoc-An_L_Intel
Moderator
927 Views

This is a bug, and the original fix might not cover this case. The problematic file is screen.C. If you compile everything with ICC, and only screen.C with GCC, you will NOT get this error.

I would suggest you file a bug on this so that you can get status update for resolution of this problem.
0 Kudos
Quoc-An_L_Intel
Moderator
927 Views

As a work around, add the linker option -Wl, -no_compact_unwind to your build to see if the problem is resolved.
0 Kudos
Jed_Kaplan
Beginner
927 Views

I had exactly the same error as is described in this thread when trying to compile netCDF-4.1 and followed this suggestion to use the compiler option:

-Wl,-no_compact_unwind (note there should be no space after the comma, as the previous post indicated)

and it did work!

I am using the latest icc (release 4, version 080) on Mac OS X 10.6

0 Kudos
Quoc-An_L_Intel
Moderator
927 Views
This issue is resolved in the latest compiler version 11.1 update 5. The download package is m_cproc_p_11.1.084.dmg.
0 Kudos
Reply