Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pythonmagick: fix build #46469

Merged
merged 1 commit into from Sep 10, 2018
Merged

pythonmagick: fix build #46469

merged 1 commit into from Sep 10, 2018

Conversation

Ma27
Copy link
Member

@Ma27 Ma27 commented Sep 10, 2018

Motivation for this change

The original build broke with the following linker issue:

  CXXLD    _PythonMagick.la
/nix/store/h0lbngpv6ln56hjj59i6l77vxq25flbz-binutils-2.30/bin/ld: cannot find -l-L/nix/store/4gh6ynzsd5ndx37hmkl62xa8z30k43y1-imagemagick-6.9.9-34/lib
collect2: error: ld returned 1 exit status

This happens since BOOST_PYTHON_LIB wasn't set properly, however
_PythonMagick.la was linked with -l$(BOOST_PYTHON_LIB) $(MAGICK_LIBS). With an empty BOOST_PYTHON_LIB the linker got
confused.

To work around this, the boost library directory needs to be specified
explicitly. To ensure that the changes take effect, the original
configure script shipped with $src needs to be removed and recreated
using the autoreconfHook.

Additionally the imagemagick license (https://spdx.org/licenses/ImageMagick.html)
needs to be added to lib/licenses.nix to document the proper license
of pythonmagick in the meta section.

Things done
  • Tested using sandboxing (nix.useSandbox on NixOS, or option sandbox in nix.conf on non-NixOS)
  • Built on platform(s)
    • NixOS
    • macOS
    • other Linux distributions
  • Tested via one or more NixOS test(s) if existing and applicable for the change (look inside nixos/tests)
  • Tested compilation of all pkgs that depend on this change using nix-shell -p nox --run "nox-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
  • Determined the impact on package closure size (by running nix path-info -S before and after)
  • Fits CONTRIBUTING.md.

The original build broke with the following linker issue:

```
  CXXLD    _PythonMagick.la
/nix/store/h0lbngpv6ln56hjj59i6l77vxq25flbz-binutils-2.30/bin/ld: cannot find -l-L/nix/store/4gh6ynzsd5ndx37hmkl62xa8z30k43y1-imagemagick-6.9.9-34/lib
collect2: error: ld returned 1 exit status
```

This happens since `BOOST_PYTHON_LIB` wasn't set properly, however
`_PythonMagick.la` was linked with `-l$(BOOST_PYTHON_LIB)
$(MAGICK_LIBS)`. With an empty `BOOST_PYTHON_LIB` the linker got
confused.

To work around this, the `boost` library directory needs to be specified
explicitly. To ensure that the changes take effect, the original
`configure` script shipped with `$src` needs to be removed and recreated
using the `autoreconfHook`.

Additionally the `imagemagick` license (https://spdx.org/licenses/ImageMagick.html)
needs to be added to `lib/licenses.nix` to document the proper license
of `pythonmagick` in the meta section.
@Ma27
Copy link
Member Author

Ma27 commented Sep 10, 2018

Addresses #45960

@GrahamcOfBorg
Copy link

Success on x86_64-linux (full log)

Attempted: pythonmagick

Partial log (click to expand)

make[2]: Leaving directory '/build/PythonMagick-0.9.16'
make[1]: Leaving directory '/build/PythonMagick-0.9.16'
post-installation fixup
shrinking RPATHs of ELF executables and libraries in /nix/store/ppilg9vjgvrq001md4grhiwms3ppr656-pythonmagick-0.9.16
shrinking /nix/store/ppilg9vjgvrq001md4grhiwms3ppr656-pythonmagick-0.9.16/lib/python2.7/site-packages/PythonMagick/_PythonMagick.so
strip is /nix/store/h0lbngpv6ln56hjj59i6l77vxq25flbz-binutils-2.30/bin/strip
stripping (with command strip and flags -S) in /nix/store/ppilg9vjgvrq001md4grhiwms3ppr656-pythonmagick-0.9.16/lib
patching script interpreter paths in /nix/store/ppilg9vjgvrq001md4grhiwms3ppr656-pythonmagick-0.9.16
checking for references to /build in /nix/store/ppilg9vjgvrq001md4grhiwms3ppr656-pythonmagick-0.9.16...
/nix/store/ppilg9vjgvrq001md4grhiwms3ppr656-pythonmagick-0.9.16

@xeji xeji merged commit 6d6cbd3 into NixOS:master Sep 10, 2018
xeji pushed a commit that referenced this pull request Sep 10, 2018
The original build broke with the following linker issue:

```
  CXXLD    _PythonMagick.la
/nix/store/h0lbngpv6ln56hjj59i6l77vxq25flbz-binutils-2.30/bin/ld: cannot find -l-L/nix/store/4gh6ynzsd5ndx37hmkl62xa8z30k43y1-imagemagick-6.9.9-34/lib
collect2: error: ld returned 1 exit status
```

This happens since `BOOST_PYTHON_LIB` wasn't set properly, however
`_PythonMagick.la` was linked with `-l$(BOOST_PYTHON_LIB)
$(MAGICK_LIBS)`. With an empty `BOOST_PYTHON_LIB` the linker got
confused.

To work around this, the `boost` library directory needs to be specified
explicitly. To ensure that the changes take effect, the original
`configure` script shipped with `$src` needs to be removed and recreated
using the `autoreconfHook`.

Additionally the `imagemagick` license (https://spdx.org/licenses/ImageMagick.html)
needs to be added to `lib/licenses.nix` to document the proper license
of `pythonmagick` in the meta section.

(cherry picked from commit 6d6cbd3)
@GrahamcOfBorg
Copy link

Success on aarch64-linux (full log)

Attempted: pythonmagick

Partial log (click to expand)

make[2]: Leaving directory '/build/PythonMagick-0.9.16'
make[1]: Leaving directory '/build/PythonMagick-0.9.16'
post-installation fixup
shrinking RPATHs of ELF executables and libraries in /nix/store/bwg55c7c72av69ix20ki2x0xbvcrjq1b-pythonmagick-0.9.16
shrinking /nix/store/bwg55c7c72av69ix20ki2x0xbvcrjq1b-pythonmagick-0.9.16/lib/python2.7/site-packages/PythonMagick/_PythonMagick.so
strip is /nix/store/y4ymnvgxygpq05h03kyzbj572zmh6zla-binutils-2.30/bin/strip
stripping (with command strip and flags -S) in /nix/store/bwg55c7c72av69ix20ki2x0xbvcrjq1b-pythonmagick-0.9.16/lib
patching script interpreter paths in /nix/store/bwg55c7c72av69ix20ki2x0xbvcrjq1b-pythonmagick-0.9.16
checking for references to /build in /nix/store/bwg55c7c72av69ix20ki2x0xbvcrjq1b-pythonmagick-0.9.16...
/nix/store/bwg55c7c72av69ix20ki2x0xbvcrjq1b-pythonmagick-0.9.16

@Ma27 Ma27 deleted the fix-pythonmagick branch September 10, 2018 10:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants