coin3d / coin

Coin3D core library
BSD 3-Clause "New" or "Revised" License
289 stars 109 forks source link

Mac Framework not installing Libraries when using cmake #450

Open Schamschula opened 3 years ago

Schamschula commented 3 years ago

When I build Coin-4.0.0 using configure under MacPorts, I get

/opt/local/Library/Frameworks/Inventor.framework/Versions/D/Libraries/libCoin.80.0.0.dylib /opt/local/Library/Frameworks/Inventor.framework/Versions/D/Libraries/libCoin.80.dylib /opt/local/Library/Frameworks/Inventor.framework/Versions/D/Libraries/libCoin.dylib

while there is no such directory when building with cmake with

configure.args-append \ -DCOIN_BUILD_MAC_FRAMEWORK=ON \ -DCMAKE_INSTALL_PREFIX=${frameworks_dir}

all other files are installed correctly.

This is a blocker when trying to build SoQt, py-pivy and FreeCAD, as they are looking for the .cmake files.

VolkerEnderlein commented 3 years ago

Did you get any errors? What version of Darwin are you on? I just checked the latest sources on my VM with Mojave 10.14 and it built and installed without failure. I used the instructions from the BuildWithCMake wiki page. Can you provide the scripts you used for your MacPorts build?

Schamschula commented 3 years ago

My main build machine also is running Mojave.

I just had a look at the wiki page. Nothing particularly useful.

The first thing to note is that I get a configure error as downloading the source tarball from GitHub does not include the cpack.d directory. I commented it out from the CMakeLists.txt file as MacPorts takes care of packaging.

The second issue I ran into is

[ 86%] Linking CXX shared library ../lib/Inventor.framework/Inventor cd /opt/local/var/macports/build/_Users_marius_Development_MacPorts_ports_graphics_Coin/Coin-framework/work/build/src && /opt/local/bin/cmake -E cmake_link_script CMakeFiles/Coin.dir/link.txt --verbose=ON /usr/bin/clang++ -pipe -Os -DNDEBUG -I/opt/local/include -stdlib=libc++ -isysroot/Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk -arch x86_64 -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk -mmacosx-version-min=10.14 -dynamiclib -Wl,-headerpad_max_install_names -compatibility_version 80.0.0 -current_version 4.0.0 -o ../lib/Inventor.framework/Versions/D/Inventor -install_name @rpath/Inventor.framework/Versions/D/Inventor @CMakeFiles/Coin.dir/objects1.rsp -Wl,-rpath,/opt/local/lib /Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/System/Library/Frameworks/OpenGL.framework/OpenGL.tbd /Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/System/Library/Frameworks/OpenGL.framework/OpenGL.tbd -framework CoreFoundation -framework CoreGraphics /Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/System/Library/Frameworks/OpenGL.framework/OpenGL.tbd sh: /bin/ps: Operation not permitted Error running link command: Invalid argument

which I can work around in testing, by manually running

sudo /opt/local/bin/cmake -E cmake_link_script CMakeFiles/Coin.dir/link.txt --verbose=ON

in that directory and then proceeding with the MacPorts build. It looks like a permissions issue.

The current state of the Portfile is in flux as I'm attempting to move from autotools to cmake. Yes, the homepage hasn't been updated and the manpages variant certainly wouldn't build under cmake. As I can't directly attach a Portfile, I've pasted it here.

Note: Coin builds and installs correctly, but the Coin-framework subport fails.

PortSystem 1.0 PortGroup cmake 1.1 PortGroup github 1.0 PortGroup qt4 1.0

github.setup coin3d coin Coin-4.0.0 name Coin revision 0 license BSD description cross platform C++ OpenGL scene graph library long_description Coin is a high-level 3D graphics library with a \ C++ Application Programming Interface. Coin uses scene-graph data \ structures to render real-time graphics suitable for mostly all \ kinds of scientific and engineering visualization applications.

conflicts Coin-framework categories graphics devel platforms darwin maintainers nomaintainer

homepage https://bitbucket.org/Coin3D/coin/wiki/Home

github.tarball_from archive

checksums rmd160 201e0c2abb7b90e348e7d2f9c0ee750ab5fe92dd \ sha256 b00d2a8e9d962397cf9bf0d9baa81bcecfbd16eef675a98c792f5cf49eb6e805 \ size 6788294

depends_lib-append port:boost \ port:simage \ port:fontconfig \ port:freetype \ port:zlib \ port:bzip2

patchfiles patch-CMakeLists.txt.diff \ clang-name-lookup.diff \ patch-src-fonts-freetype.cpp.diff

if {${name} eq ${subport}} {

variant manpages description {Include API documentation in manpages.} {
    depends_build-append    port:doxygen
    configure.args-append   --enable-man --mandir=${prefix}/share/man
    post-destroot {
        file rename ${destroot}${prefix}/share/man/man3/threads.3 \
            ${destroot}${prefix}/share/man/man3/threads-coin.3
        file rename ${destroot}${prefix}/share/man/man3/manips.3 \
            ${destroot}${prefix}/share/man/man3/manips-coin.3
    }
}

}

subport Coin-framework { conflicts Coin revision 0

configure.args-append \
                -DCOIN_BUILD_MAC_FRAMEWORK=ON \
                -DCMAKE_INSTALL_PREFIX=${frameworks_dir}

}

VolkerEnderlein commented 3 years ago

Thanks for reporting back.

Coin wiki Git section explains why downloading the source tarball from Releases won't work. Coin3D uses submodules all over its repositories and they won't be properly populated in the default Github generated source tarballs. Please use the CI generated source tarballs or zip files. Along those you'll find the md5 and sha256 checksum files to verify the downloads.

I was also facing the permissions issue as I am not permitted to install to /opt as a regular user. It needs administrative privileges to do so.

Man pages will be build properly if -DCOIN_BUILD_DOCUMENTATION=ON is added to the configure args in combination with -DCOIN_BUILD_DOCUMENTATION_MAN=ON. In the current sources the man page generation has been recently updated to generate uniquely named man pages (prefix them with coin_) so renaming them is not necessary anymore.

Expat may be added as additional dependency. Then -DUSE_EXTERNAL_EXPAT=ON needs to be added to the configure args.

Hope, that helps further for updating the macports port.

Schamschula commented 3 years ago

Unfortunately, downloading directly from a git repo is frowned upon by the MacPorts community, and is only used in -devel ports. A stable port should not have to pull in a number of sub-repos. Downloading and joining multiple sub-repos can be done manually, but that also means reproducing the github PortGroup functionality (an extreme example is the nginx Portfile).

I was not referring to installing in /opt, which is always done using sudo under MacPorts, but rather an issue during the build process, which is normally done w/o root privileges.

Since my last post I already figured out how to build the Documentation. However, I do not see the coin_ prefix on the man pages.

Thanks for the hint on expat!

VolkerEnderlein commented 3 years ago

"Unfortunately, downloading directly from a git repo is frowned upon by the MacPorts community, and is only used in -devel ports. A stable port should not have to pull in a number of sub-repos." Understandable from a package maintainers point of view.

I think I misunderstood or misinterpreted the installation issues as both builds, Coin 4.0.0 release and current Github coin repository went without issues as restricted user using a command line as given in the wiki. What CMake version and what Xcode version are you using? I used CMake 3.13.4 and Xcode 10.1 (A bit outdated, but it just works)

Are you building the coin 4.0.0 release? Then it's OK, it will not contain the man page fix. The fix has been only recently added. Time for a 4.0.1 release I think.

Schamschula commented 3 years ago

I tweaked the download to pull form releases rather than archive. Thus the patch to CMakeLists.txt is no longer needed, and the libraries get installed.

It turns out the issue with sh: /bin/ps: Operation not permitted only happens in trace mode (my default when test building, to pick up missing dependencies). I'll have to ask around to see how to deal with that.

Schamschula commented 3 years ago

Yes, I'm building the 4.0.0 release.

port info cmake cmake @3.19.5 (devel)

and

Xcode 10.3

VolkerEnderlein commented 2 years ago

I just added a PR to macports to update Coin3d related port files (simage, Coin, SoQt, and Quarter) to their current versions.