Coder Social home page Coder Social logo

Compilation fails at link stage about njoy21 HOT 11 CLOSED

njoy avatar njoy commented on July 29, 2024
Compilation fails at link stage

from njoy21.

Comments (11)

nathangibson14 avatar nathangibson14 commented on July 29, 2024

Thank you for reaching out. Unfortunately, our team does not often use NJOY on Windows, and I'm not sure the last time we attempted to build it on Windows. I will try to get my hands on a Windows machine and recreate the problem. A quick search tells me this error is Windows-specific and there may be some compile flags we could turn on to fix it. I don't really expect this to help, but you could try an older version of GCC in the meantime.

In any case, I suspect NJOY2016 won't run into the same issues. Thanks for telling us that our installation instructions for it are unclear. These are the commands I would run:

git clone https://github.com/njoy/NJOY2016
cd NJOY2016
mkdir bin && cd bin
cmake ..
make

That should give you version 2016.57 by default. But you could type git checkout 2016.57 or whatever other tag you are looking for after the second line above to be sure.

from njoy21.

RokShox avatar RokShox commented on July 29, 2024

Update
The issue is related to two limitations in the Windows PE/COFF object file format:

  • A maximum of 32766 sections are allowed
  • The string table can't be longer than 10 million bytes

The fix for the first limitation is to add the flag "-Wa,-mbig-obj" to the GCC compilation flags. Note this is a single argument which arranges for the -mbig-obj flag to be passed to the assembler (-Wa).

I modified CMakeLists.txt line 132:
set( njoy21_GNU_CYGWIN_common_flags "-Wno-subobject-linkage" "-Wall" "-Wextra" "-Wpedantic" "-std=gnu++17" "-Wa,-mbig-obj" )

The second limitation I encountered when trying to build the debug version (cmake -DCMAKE_BUILD_TYPE=Debug ...) and is likely just too much debug info being put in the object file. The Release build, compiled with O3 optimization, does not encounter this limit.

So the Release version compiles with the addition of the "-Wa,-mbig-obj" flag.

But, all but the first test failed when I did a "make test". I reduced the optimization to O1 at CMakeLists.txt line 134:

set( njoy21_GNU_CYGWIN_RELEASE_flags "-O1" "-DNDEBUG" )

and it still compiles but fails the same tests. I'll look into this some more.

from njoy21.

RokShox avatar RokShox commented on July 29, 2024

Update 2

The tests were failing because shared libraries could not be located. I assume the cmake process is munging LD_LIBRARY_PATH during the "make test" to point at the dlls in ./subprojects, but Cygwin does not use LD_LIBRARY_PATH. Instead it looks for shared libraries on PATH directories.

I copied these dlls to /usr/local/bin (already on my PATH):

  • cygnjoy.dll
  • cygnjoy_c_bindings.dll
  • cygnjoy21.dll
  • cygutility.dll

And all tests passed.

from njoy21.

nathangibson14 avatar nathangibson14 commented on July 29, 2024

I'm glad that worked, those were the flags I was going to try. We'll hopefully get those implemented into our build system soon so that it works out of the box for future updates. Thanks for being willing to dig into the issue!

from njoy21.

kahlerac avatar kahlerac commented on July 29, 2024

from njoy21.

jlconlin avatar jlconlin commented on July 29, 2024

So I'm glad that you were able to find a workaround for this. Officially, we do not support NJOY running in the Cygwin environment and suggest people use WSL. The only reason for this is that we don't have the resources to test every environment. We are working on improving the build system and hopefully that will improve our options for Windows environments.

from njoy21.

nathangibson14 avatar nathangibson14 commented on July 29, 2024

Just to be clear, njoy21.io says:
"Note that in Windows we currently support compiling and running under the Windows Subsystem for Linux or the Cygwin environment. If you have the necesssary components installed, this should also work in the DOS environment."

We should probably change that if we aren't going to officially support Cygwin :)

from njoy21.

jlconlin avatar jlconlin commented on July 29, 2024

Oh

Just to be clear, njoy21.io says:
"Note that in Windows we currently support compiling and running under the Windows Subsystem for Linux or the Cygwin environment. If you have the necesssary components installed, this should also work in the DOS environment."

We should probably change that if we aren't going to officially support Cygwin :)

Oops. I thought that it only said WSL. We are going to have to fix that.

from njoy21.

RokShox avatar RokShox commented on July 29, 2024

I'm not married to Cygwin wrt NJOY, but the support required was a simple compiler flag. I do use Cygwin apps for a lot of other stuff, particularly my precious Emacs.

from njoy21.

nathangibson14 avatar nathangibson14 commented on July 29, 2024

@RokShox Thanks for the input. I agree, pushing your change to the CMakeLists to support Cygwin with the current version is easy enough.

That said, we're currently revamping our build system, so we'll have to have some internal discussions about how to approach the environments we support as part of that. The concern is if we make a big change (e.g., adding a new dependency, upgrading the C++ standard), we need to ensure it works on all officially-supported environments. And right now, we clearly aren't testing Cygwin!

from njoy21.

RokShox avatar RokShox commented on July 29, 2024

Yes, of course. I'm not pushing for it.

from njoy21.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.