Undefined Symbols For Architecture X86_64 Mac



While testing #394, I also found that the current master isn't building on mac (10.14.6 mojave). Same machine builds Slicer fine, so there's something off in the dcmqi superbuild configurat. Question or issue on macOS: I have upgraded a Mac to macOS 10.12.0 Sierra, and am trying to upgrade PHP to version 7.0.9, but ‘make test’ fails with: Undefined symbols for architecture x8664: 'libiconv', referenced from: zificonvsubstr in iconv.o zificonvmimeencode in iconv.o phpiconvstring in iconv.o phpiconvstrlen in iconv.o phpiconvstrpos in iconv.o phpiconv.

Question or issue on macOS:

I have upgraded a Mac to macOS 10.12.0 Sierra, and am trying to upgrade PHP to version 7.0.9, but ‘make test’ fails with:

I compiled it with:

and have tried adding different ‘–with-iconv-dir=’ options but always get the same undefined symbols error.

I have downloaded and compiled libiconv to no avail. Even configured the compile with:

CFLAGS=’-arch x86_64′ CCFLAGS=’-arch x86_64′ CXXFLAGS=’-arch x86_64′ ./configure

X86_64

but that made no difference. Any suggestions?

Any help would be much appreciated.

How to solve this problem?

Solution no. 1:

This might solve the problem

Solution no. 2:

  1. brew install libiconv (libiconv will install in /usr/local/opt/libiconv/)
  2. find EXTRA_LIBS variable in MakeFile.
  3. change -liconv to /usr/local/opt/libiconv/lib/libiconv.dylib

Here is the reason:

  • Mac os has its own libiconv.dylib in dir/usr/lib/libiconv.dylib, which do not
    contains _libiconv _libiconv_close . founctions. Update to a new libiconv version and reference to it will solve the case

Solution no. 3:

I’ll teach you. That’s caused due to broken symbol during your php source code compilation process.

Since OS X uses llvm toolchain based clang, and the php original source code is based on GNU libraries in which it’s compatible for gcc only rather than clang you’re already familiar with.

**


Their architectures seem to be incompatible somehow.

**

In one word, original libiconv source code was definitely not compatible with OS X.
Installing by the command in OS X resolved the issues:


brew install libiconv.

Is X86 64 Bit

[email protected] ~ % brew install libiconv

Updating Homebrew…
> Auto-updated Homebrew!
Updated 1 tap (homebrew/core).
> New Formulae
ghz
> Updated Formulae
ammonite-repl contentful-cli gwt libwebsockets salt
angular-cli detekt homeassistant-cli mapserver stress-ng
ask-cli ethereum katago php topgrade
bazel exploitdb lerna [email protected]
borgmatic fastlane libdeflate [email protected]
conan gatsby-cli libmypaint pidgin

Warning: libiconv 1.16 is already installed and up-to-date
To reinstall 1.16, run brew reinstall libiconv

Because it’ll be installing OS X-compatible library with complete x86-64bit symbol.

I had same issue yesterday when I was about to practicing php 5 earlier version. I compiled successfully on OS X – the latest version “Mac OS X 10.15.4, Catalina.”

Undefined Symbols For Architecture X86_64 Mac

I’m advising you that you do not use the latest version of every development toolchain as always. In a way, you would be conflicting less, it directly means less time consuming when you’re doing more important tasks.

and you even need to edit Makefile before you command “make” to compile on OS X.

Mac developer often uses “nano command line tool instead of vi”:

Undefined Symbols For Architecture X86_64 Mac Make


nano Makefile

and then find EXTRA_LIBS environment variable change -liconv to /usr/local/opt/libiconv/lib/libiconv.dylib – where it is location for Mac OS X compatible library is installed by homebrew.
Because -liconv’s default path is somewhere else: /usr/lib/ – which the incompatible with broken architecture symbol resides.

So where can you see the diffs between linux kernel system and OS X system:
.so file exension for linux one and dylib for mac os one?


The names imply their compiling architecture and the structure inside
are a little bit different.

I added more reasonable details for you beside the answer snippet above to explain clearly.

So let me explaining at one point:


It is the issue of broken architecture symbols during your GNU source
code compilation which is not compatible to OS X Unix system
environment.
Because OS X is more BSD system alike than is linux kernel alike.

  • I’m developing hobbyist. so I don’t even know all. you’ll need to learn everyday also. good luck.


I would like to recommend you read the book “The Software
Craftsman – written by Sandro Mancuso.” It is more suitable method(not a tool anyway) for
developing and debugging spaces I personally can think of. Someone else denies that
somehow.

Hope this helps!

What is going on here? I can't seem to build with gcc. How can I fix this.


mbp-mbp 09:24:18 ~/bin $ gcc connect.c -o connect

Undefined symbols for architecture x86_64:

'_res_9_init', referenced from:

_switch_ns in ccTLCqYq.o

ld: symbol(s) not found for architecture x86_64

collect2: error: ld returned 1 exit status

mbp-mbp 09:26:14 ~/bin $ gcc -v

Using built-in specs.

Undefined Symbols For Architecture X86_64 Mac

COLLECT_GCC=gcc

COLLECT_LTO_WRAPPER=/usr/local/Cellar/gcc/4.8.3/libexec/gcc/x86_64-apple-darwin1 3.2.0/4.8.3/lto-wrapper

Target: x86_64-apple-darwin13.2.0

Configured with: ../configure --build=x86_64-apple-darwin13.2.0 --prefix=/usr/local/Cellar/gcc/4.8.3 --enable-languages=c,c++,objc,obj-c++,fortran --with-gmp=/usr/local/opt/gmp --with-mpfr=/usr/local/opt/mpfr --with-mpc=/usr/local/opt/libmpc --with-cloog=/usr/local/opt/cloog --with-isl=/usr/local/opt/isl --with-system-zlib --enable-version-specific-runtime-libs --enable-libstdcxx-time=yes --enable-stage1-checking --enable-checking=release --enable-lto --disable-werror --enable-plugin --disable-nls --enable-multilib

Thread model: posix

Undefined Symbols For Architecture X86_64 Mac G++

gcc version 4.8.3 (GCC)


5.1.1 xcode nad command line tools


OSX 10.9.3


Cheers

Undefined Symbols For Architecture X86_64 Mac Cmake

Posted on Jun 14, 2014 12:34 PM