MacOS M1 build target failed with code 1

28 views
Skip to first unread message

Chanelle

unread,
Mar 21, 2023, 12:28:08 PM3/21/23
to G3D Users
I'm trying to build G3D on a MacOS by following G3D 10 Build System Instructions. The build target fails due to:

ld: symbol(s) not found for architecture x86_64

clang: error: linker command failed with exit code 1 (use -v to see invocation)


Steps I followed:
1. Set up requirements and configuration for MacOS as stated in the instructions.
2. Installed minimum requirements: 
svn co --depth immediates https://svn.code.sf.net/p/g3d/code/ g3d
svn up --set-depth immediates g3d/data10
svn up --set-depth infinity g3d/G3D10 svn up --set-depth infinity g3d/data10/common
3. Ran the following command to build: 
./buildg3d lib data tools

Actual output:
When building viewer, there were numerous issues regarding tbb. Then, regarding members referenced from the G3D::VideoInput class.
Output snippet:

Building viewer

Computing dependencies

.

.

.

Linking

Undefined symbols for architecture x86_64:

  "tbb::task_group_context::init()", referenced from:

      tbb::interface9::internal::start_for<tbb::blocked_range<unsigned long>, G3D::Array<std::__1::shared_ptr<G3D::Light>, 10ul>::operator=(G3D::Array<std::__1::shared_ptr<G3D::Light>, 10ul> const&)::'lambda'(tbb::blocked_range<unsigned long> const&), tbb::auto_partitioner const>::run(tbb::blocked_range<unsigned long> const&, G3D::Array<std::__1::shared_ptr<G3D::Light>, 10ul>::operator=(G3D::Array<std::__1::shared_ptr<G3D::Light>, 10ul> const&)::'lambda'(tbb::blocked_range<unsigned long> const&) const&, tbb::auto_partitioner const&) in MD3Viewer.o

.
.
.

  "_sws_getContext", referenced from:

      G3D::VideoInput::initialize(G3D::G3DString<64ul> const&) in libG3D-app.a(VideoInput.o)

  "_sws_scale", referenced from:

      G3D::VideoInput::decode(G3D::VideoInput*) in libG3D-app.a(VideoInput.o)

ld: symbol(s) not found for architecture x86_64

clang: error: linker command failed with exit code 1 (use -v to see invocation)

961s

Note: build target failed with code 1


Related issue:
Here is a similar issue due to linker command fail in a MacOS build. 

Linwan Song

unread,
Mar 22, 2023, 4:24:43 PM3/22/23
to G3D Users
This is a known issue. 
R7201 introduced universal binaries on MacOS, which meant that most G3D libraries compiled for both ARM and x86. The problem with tbb and ffmpeg is that G3D compiles them differently than the other libraries, and we currently haven't figured out a way to compile them universally. This might actually require a version upgrade since iirc G3D uses version from before the M1 was introduced. 
You can revert that commit or manually reverse the universal binaries change in bin/icompile to get around this until it's fixed. 
- Linwan

Chanelle

unread,
Mar 23, 2023, 1:48:36 PM3/23/23
to G3D Users
Reverted the commit: svn merge -c -7201 . and rebuilt successfully. 

Thanks Linwan!
Reply all
Reply to author
Forward
0 new messages