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

Error loading address parser module errno:Not enough space windows #486

Closed
amrkamal2025 opened this issue Apr 2, 2020 · 9 comments
Closed

Comments

@amrkamal2025
Copy link

I compiled libpostal library and followed the instruction for windows and everything looks good and everything looks download correctly the data file that contains address_expansions, address_parser, ..etc is downloaded completely with size of 1.84 GB then i use the sample code for libpostal, after i link the library in QT IDE using

LIBS += D:\cook\libpostal\libpostal\src\.libs\libpostal.a
LIBS += D:\cook\libpostal\libpostal\src\.libs\libpostal.dll.a
LIBS += D:\cook\libpostal\libpostal\src\.libs\libscanner.a
INCLUDEPATH += D:\cook\libpostal\libpostal\src\

then I use this code to set the datadir and parser datadir then simple example of parse address

libpostal_setup_datadir("D:\\cook\\libpostal\\Data\\libpostal");
libpostal_setup_parser_datadir("D:\\cook\\libpostal\\Data\\libpostal");


// Setup (only called once at the beginning of your program)
if (!libpostal_setup() || !libpostal_setup_parser()) {
    exit(EXIT_FAILURE);
}

libpostal_address_parser_options_t options = libpostal_get_address_parser_default_options();
libpostal_address_parser_response_t *parsed = libpostal_parse_address("781 Franklin Ave Crown Heights Brooklyn NYC NY 11216 USA", options);

for (size_t i = 0; i < parsed->num_components; i++) {
    printf("%s: %s\n", parsed->labels[i], parsed->components[i]);
}

// Free parse result
libpostal_address_parser_response_destroy(parsed);

// Teardown (only called once at the end of your program)
libpostal_teardown();
libpostal_teardown_parser();

return 0;

but I got this error

ERR   Error loading address parser module, dir=D:\cook\libpostal\Data\libpostal\address_parser
 at libpostal_setup_parser_datadir (libpostal.c:434) errno:Not enough space
ERR   parser is not setup, call libpostal_setup_address_parser()
 at address_parser_parse (address_parser.c:1666) errno:Not enough space
ERR   Parser returned NULL
 at libpostal_parse_address (libpostal.c:267) errno:Not enough space

so what i did wrong, I have for sure space on my disk more than 100GB and i still got this error.

@w0pr
Copy link

w0pr commented Apr 2, 2020

errno:Not enough space

This is ENOMEM and refers to available RAM.

@amrkamal2025
Copy link
Author

I'm using windows 10 and i compiled using msys32 and i test the msys64 now, is there any solution for this problem?

@w0pr
Copy link

w0pr commented Apr 2, 2020

I'm using windows 10 and i compiled using msys32 and i test the msys64 now, is there any solution for this problem?

I used msys64, apart from that; having more memory available?

@amrkamal2025
Copy link
Author

how can I check, I have 16 GB ram iam using laptop lenovo Y5070 core I7 so i think for sure yes, i need more??

@AeroXuk
Copy link
Contributor

AeroXuk commented Apr 2, 2020

If using 32bit you need to run this to make it large address space aware:

libpostal/.appveyor.yml

Lines 40 to 45 in 790e24b

$Paths = @(
(Join-Path $Env:APPVEYOR_BUILD_FOLDER "src"),
(Join-Path $Env:APPVEYOR_BUILD_FOLDER "src\.libs"),
(Join-Path $Env:APPVEYOR_BUILD_FOLDER "test"),
(Join-Path $Env:APPVEYOR_BUILD_FOLDER "test\.libs"))
Get-ChildItem -Path $Paths | ?{ $_.Name -Match '\.(exe|dll)$' } | % { & 'C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\bin\editbin.exe' /NOLOGO /LARGEADDRESSAWARE $_.FullName }

If using 64bit make sure application and library are compiled as 64bit.

Also check that RAM usage isn’t at 100% in task manager while the app is running.

@amrkamal2025
Copy link
Author

Thank you for the answer, but please can you tell me how to run it? using msys32? do i need to compile the library from begin or just run this will solve it?
if so please tell me the command to use to run it thank you.

@AeroXuk
Copy link
Contributor

AeroXuk commented Apr 2, 2020

This is the powershell script that runs as part of the automated libpostal build.

The important bit is the call to the ‘editbin.exe’ passing the ‘/LARGEADDRESSAWARE’ parameter followed by the .exe file you compile. This was also run against the .dll files too.

This command run against the compiled .exe & .dlls allows windows programs to allocate over 2GB of memory in 32bit mode.

@AeroXuk
Copy link
Contributor

AeroXuk commented Apr 2, 2020

I would recommend using msys64 launched from the msys64 start menu option to compile the library if your hardware supports 64bit

@amrkamal2025
Copy link
Author

it worked Thank you very much I use this command
editbin /LARGEADDRESSAWARE "D:\WorkPlace\CppProject\Systemview\build-libpostalTest-Desktop_Qt_5_13_2_MinGW_32_bit-Release\Final\libpostalTest.exe"

this editbin found in visual c++

C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\bin

it worked thank you very much, and sure I will make a 64 compile

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants